{"id":27168318,"url":"https://github.com/theflash2k/flashlib","last_synced_at":"2025-09-01T12:44:44.358Z","repository":{"id":285678316,"uuid":"958532985","full_name":"TheFlash2k/flashlib","owner":"TheFlash2k","description":"A wrapper around pwntools but also with a few of the functions that I use on a daily basis.","archived":false,"fork":false,"pushed_at":"2025-05-19T01:24:32.000Z","size":1948,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-04T14:19:50.619Z","etag":null,"topics":[],"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/TheFlash2k.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,"zenodo":null}},"created_at":"2025-04-01T10:57:57.000Z","updated_at":"2025-05-19T01:24:36.000Z","dependencies_parsed_at":"2025-05-16T04:30:09.191Z","dependency_job_id":"0a4dc6c4-8a73-4c05-9d42-086b1f171d51","html_url":"https://github.com/TheFlash2k/flashlib","commit_stats":null,"previous_names":["theflash2k/flashlib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheFlash2k/flashlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheFlash2k%2Fflashlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheFlash2k%2Fflashlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheFlash2k%2Fflashlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheFlash2k%2Fflashlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheFlash2k","download_url":"https://codeload.github.com/TheFlash2k/flashlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheFlash2k%2Fflashlib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261782345,"owners_count":23208902,"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":[],"created_at":"2025-04-09T05:29:57.230Z","updated_at":"2025-06-25T00:32:02.393Z","avatar_url":"https://github.com/TheFlash2k.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flashlib\n\nA wrapper around pwntools but also with a few of the functions that I use on a daily basis.\n\n---\n\nTo install, run:\n\n```bash\npip3 install pwn-flashlib\n```\n\n## Basic usage:\n\n```py\nfrom flashlib import *\n\n# This will setup everything for you, elf, libc\ninit(\"./test\")\n\n# =\u003e io is in the global namespace\n# \u003cdo your exploitation part here\u003e\n\nio.interactive()\n```\n\n## Calculating offsets by `recvafter`\n\n```py\n#!/usr/bin/env python3\n\nfrom flashlib import *\n\n# Just init and io, libc and elf will be in the global space\ninit(\"./test\")\n\nmain = hexleak(io.recvafter(b\": \"))\nelf.address = main - elf.sym.main\nlogleak(elf.address)\n\nio.interactive()\n```\n\n## Attaching GDB:\n\nWhen running the exploit, run it as: `python3 exploit.py GDB` and use the attach method to attach a gdb to the current process.\n\n\u003e The context.terminal is set to `tmux`, you can override to your liking.\n\n```py\n#!/usr/bin/env python3\n\nfrom flashlib import *\n\ngdbscript = \"\"\"\n\tb *main+40\n\"\"\"\n\ninit(\"./test\")\nattach(gdbscript) # this will attach the gdb session\n\nio.interactive()\n```\n\n### REMOTE:\n\nLet's consider a scenario where you have setup a remote gdb session, you need to just pass `REMOTE` and `GDB` and in attach, just pass `remote=(\"127.0.0.1\", GDBPORT)` and you'll be prompted to attach gdb? i.e. attach the gdbserver to the process.\n\n```py\n#!/usr/bin/env python3\n\nfrom flashlib import *\n\ngdbscript = \"\"\"\n\tb *main+40\n\"\"\"\n\ninit(\"./test\")\nattach(gdbscript, remote=(\"127.0.0.1\", 1234))\n```\n\n### CUSTOM IO:\n\nAnother scenario where you have both a local and a remote connection, you can pass custom pwnlib.tubes process to attach the gdb session to.\n\n```py\n#!/usr/bin/env python3\n\nfrom flashlib import *\n\ngdbscript = \"\"\"\n\tb *main+40\n\"\"\"\n\nlocal, elf, libc = init(\"./test\")\nio = remote(\"127.0.0.1\", 31337)\n\n# This will now \nattach(gdbscript, _io=local)\n```\n\n## Proof-of-Work\n\nSince my pwn-chal container now supports proof-of-work which is quite similar to `pwn.red/jail`, I just had a function lying around to solve the proof-of-work:\n\n```py\n#!/usr/bin/env python3\n\ninit(\"./test\")\n\n# just invoke the function and it will solve pow\n# no need to pass anything else.\n# Handles pow for:\n# 1. pwn-chal\n# 2. pwn.red/jail\npow_solve()\n```\n\n---\n\nThere's a lot more stuff which I'll keep updating as well.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheflash2k%2Fflashlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheflash2k%2Fflashlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheflash2k%2Fflashlib/lists"}