{"id":34032151,"url":"https://github.com/zolutal/pwn_gadget","last_synced_at":"2026-04-06T02:02:30.229Z","repository":{"id":58507765,"uuid":"532096500","full_name":"zolutal/pwn_gadget","owner":"zolutal","description":"Check for satisfied one gadget constraints using the state of a running gdb instance","archived":false,"fork":false,"pushed_at":"2024-02-06T06:03:28.000Z","size":117,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T21:58:12.680Z","etag":null,"topics":["ctf","gdb-plugin","one-gadget-rce","pwn","pwntools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zolutal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-09-02T22:34:02.000Z","updated_at":"2025-04-15T01:56:11.000Z","dependencies_parsed_at":"2024-02-06T07:24:11.781Z","dependency_job_id":"6738d722-3e38-4c3e-a73a-7d5de5e7dedc","html_url":"https://github.com/zolutal/pwn_gadget","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.03703703703703709,"last_synced_commit":"d5b0dd242b507f2feff9fd317e317fa1b19d3ef4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zolutal/pwn_gadget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zolutal%2Fpwn_gadget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zolutal%2Fpwn_gadget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zolutal%2Fpwn_gadget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zolutal%2Fpwn_gadget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zolutal","download_url":"https://codeload.github.com/zolutal/pwn_gadget/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zolutal%2Fpwn_gadget/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31456664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":["ctf","gdb-plugin","one-gadget-rce","pwn","pwntools"],"created_at":"2025-12-13T18:38:15.991Z","updated_at":"2026-04-06T02:02:30.223Z","avatar_url":"https://github.com/zolutal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pwn_gadget\nCheck for satisfied one gadget constraints using the state of a running gdb instance\n\n# Installation\n*Required* to have the [one_gadget](https://github.com/david942j/one_gadget) tool installed and in your path, it is called via subprocess to gather the gadgets/constraints\n## Manual Install \nInstalls pwn_gadget package for use in pwntools scripts and as a gdb command\n```\ngit clone https://github.com/zolutal/pwn_gadget \u0026\u0026 \\\npip install pwn_gadget/ \u0026\u0026 \\\ncp pwn_gadget/pwn_gadget.py ~/.pwn_gadget.py \u0026\u0026 echo \"source ~/.pwn_gadget.py\" \u003e\u003e ~/.gdbinit\n```\n\n## Installation from PyPi\nInstalls pwn_gadget package for use in pwntools scripts, will not setup gdb command\n(also may be somewhat outdated)\n```\npip install pwn-gadget\n```\n\n\n# How does this work?\npwn_gadget parses the constraints generated by [one_gadget](https://github.com/david942j/one_gadget) in python into a format that can be evaluated by a gdb `print` command.\n\nLeveraging the gdb python api, accessed by a gdb plugin or through pwntools' gdb module, it executes those commands parsed from the one_gadget constraints.\n\nPerforms all of the boolean operations in the one_gadget constraints on the results from the commands run in gdb.\n\nSearches for a gadget where every boolean operation returned True, returning either that offset or None.\n\nRegardless of if a satisfiable gadget is found or not, color coded information on the succeeding and failing constraints for each gadget will be printed.\n\n# Usage\n## As a gdb plugin\n```\n(gdb) pwn_gadget ./libc.so.6\n```\n\n## In a pwntools script\n```python\nfrom pwn import *\nimport pwn_gadget\n\np = process(\"chal\")\nlibc = p.libc\n\n# attach and break at the target address\n_, gdb_api = gdb.attach(p, gdbscript=\"b *(vuln+180)\", api=True)\n# call pwn_gadget function to look for satisfied gadgets\ngadget = pwn_gadget.find_gadget(gdb_api, libc.path)\n\n# use found address in payload\npayload = b\"A\"*32 + p64(gadget+libc.address)\np.sendline(payload)\n\np.interactive()\n```\n\n# Example Output\n## Success\n![Successful discovery of satisfied one gadget](static/success.png)\n## Failure\n![Failed discovery of satisfied one gadget](static/failure.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzolutal%2Fpwn_gadget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzolutal%2Fpwn_gadget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzolutal%2Fpwn_gadget/lists"}