{"id":13501680,"url":"https://github.com/n1nj4sec/memorpy","last_synced_at":"2025-08-21T04:31:05.701Z","repository":{"id":32553675,"uuid":"36136047","full_name":"n1nj4sec/memorpy","owner":"n1nj4sec","description":"Python library using ctypes to search/edit windows / linux / macOS / SunOS programs memory","archived":false,"fork":false,"pushed_at":"2022-10-07T13:07:05.000Z","size":75,"stargazers_count":776,"open_issues_count":12,"forks_count":140,"subscribers_count":52,"default_branch":"master","last_synced_at":"2024-11-25T18:22:44.694Z","etag":null,"topics":["ctypes","hack","linux","macosx","memory","ptrace","python-library","solaris","sunos","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n1nj4sec.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}},"created_at":"2015-05-23T18:11:22.000Z","updated_at":"2024-10-22T04:04:44.000Z","dependencies_parsed_at":"2023-01-14T21:34:38.530Z","dependency_job_id":null,"html_url":"https://github.com/n1nj4sec/memorpy","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/n1nj4sec%2Fmemorpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1nj4sec%2Fmemorpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1nj4sec%2Fmemorpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1nj4sec%2Fmemorpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n1nj4sec","download_url":"https://codeload.github.com/n1nj4sec/memorpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230487844,"owners_count":18233865,"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":["ctypes","hack","linux","macosx","memory","ptrace","python-library","solaris","sunos","windows"],"created_at":"2024-07-31T22:01:46.148Z","updated_at":"2024-12-19T19:08:54.686Z","avatar_url":"https://github.com/n1nj4sec.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# memorpy\nPython library using ctypes to search/edit windows/linux/OSX/SunOS programs memory.\n\n# install\n```\npip install https://github.com/n1nj4sec/memorpy/archive/master.zip\n```\n# usage examples :\nIn this example open a notepad.exe and type in some text we will edit from memory !\n```python\n\u003e\u003e\u003e from memorpy import *\n\u003e\u003e\u003e mw=MemWorker(pid=3856) #you can also select a process by its name with the kwarg name=\n\u003e\u003e\u003e l=[x for x in mw.umem_search(\"hello\")]\n\u003e\u003e\u003e l\n[('', \u003cAddr: 0x003287B0\u003e)]\n\u003e\u003e\u003e a=l[0][1]\n\u003e\u003e\u003e a\n\u003cAddr: 0x003287B0\u003e\n\u003e\u003e\u003e a+4\n\u003cAddr: 0x003287B4\u003e\n\u003e\u003e\u003e print a\n\u003cAddr: 0x003287B0 : \"h\\x00e\\x00l\\x00l\\x00o\\x00 \\x00t\\x00h\\x00i\\x00s\\x00 \\x00i\\x00s\\x00 \\x00a\\x00 \\x00m\\x00e\\x00s\\x00s\\x00a\\x00g\\x00e\\x00 \\x00I\\x00\" (bytes)\u003e\n\u003e\u003e\u003e a.dump()\n00328790: 46 00 72 00 61 00 6E 00 63 00 65 00 29 00 00 00  F.r.a.n.c.e.)...\n003287A0: 00 00 00 00 00 00 00 00 F3 8F 57 0C 7F 6A 00 10  ..........W..j..\n003287B0: 63 00 6F 00 75 00 63 00 6F 00 75 00 20 00 74 00  c.o.u.c.o.u. .t.\n003287C0: 68 00 69 00 73 00 20 00 69 00 73 00 20 00 61 00  h.i.s. .i.s. .a.\n003287D0: 20 00 6D 00 65 00 73 00 73 00 61 00 67 00 65 00   .m.e.s.s.a.g.e.\n003287E0: 20 00 49 00 20 00 74 00 79 00 70 00 65 00 64 00   .I. .t.y.p.e.d.\n003287F0: 20 00 69 00 6E 00 20 00 6E 00 6F 00 74 00 65 00   .i.n. .n.o.t.e.\n00328800: 70 00 61 00 64 00 2E 00 65 00 78 00 65 00 20 00  p.a.d...e.x.e. .\n00328810: 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  !...............\n00328820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00328830: 00 00 00 00 04 00 27 00 F7 8F 74 2B 6A 6A 00 00  ......'...t+jj..\n00328840: 30 7A 32 00 C0 8B 32 00 00 00 00 00 00 00 00 00  0z2...2.........\n00328850: 01 00 01 00 01 01 00 00 00 00 00 00 00 00 00 00  ................\n00328860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00328870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00328880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00328890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n003288A0: 01 00 00 01 00 00 01 00 00 00 00 01 00 00 00 00  ................\n003288B0: 07 00 00 07 59 6A 00 00 B8 79 32 00 E8 35 32 00  ....Yj...y2..52.\n003288C0: 50 54 9D ED E6 EB 55 42 82 89 F8 A3 1E 68 72 28  PT....UB.....hr(\n003288D0: 03 00 00 03 7F 6A 00 00 C0 8B 32 00 E8 35 32 00  .....j....2..52.\n003288E0: AA BA 43 9F 5C 80 8F 67 E2 8F 75 3F 6E 6A 00 0C  ..C.\\..g..u?nj..\n003288F0: F0 FE 30 00 70 FE 30 00 F0 FD 30 00 1D 17 ED 00  ..0.p.0...0.....\n00328900: B6 8F 75 6B 7B 6A 00 08 00 00 00 00 00 00 00 00  ..uk{j..........\n00328910: 11 10 0A 61 00 00 00 00 00 00 00 00 A0 00 00 00  ...a............\n00328920: 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00328930: 00 00 80 41 00 00 80 41 00 00 80 3D 00 00 80 3D  ...A...A...=...=\n00328940: 00 00 D0 00 00 00 30 00 1E FF 20 1F 00 00 00 00  ......0... .....\n00328950: 71 80 0E 00 30 00 30 00 30 00 30 00 30 00 30 00  q...0.0.0.0.0.0.\n00328960: 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00  0.0.0.0.0.0.0.0.\n00328970: 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00  0.0.0.0.0.0.0.0.\n00328980: 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 0.0.0.0.0.0.0.0.\n\u003e\u003e\u003e a.read(100).decode(\"utf-16-le\")\nu'hello this is a message I typed in notepad.exe !\\x00\\x00'\n\u003e\u003e\u003e a.write(\"pwned\".encode(\"utf-16-le\"))\n1\n\u003e\u003e\u003e a.read(100).decode(\"utf-16-le\")\nu'pwned this is a message I typed in notepad.exe !\\x00\\x00'\n```\nLook back at your notepad and the text should be changed ! :)\nA quicker way to do this could be :\n```python\n\u003e\u003e\u003e mw.umem_replace(\"hello\",\"pwned\")\n```\n\nSome other interesting features like searching for different values types in memory and monitor their changes are also implemented through the Locator class. For example if you are looking to cheat in a game and you start with 200 ammo, you could do something like :\n\n```python\n\u003e\u003e\u003e lo=Locator(mw)\n\u003e\u003e\u003e lo.feed(200)\n...\n\u003cAddr: 0x0018FDE2\u003e,\n\u003cAddr: 0x0018FDE4\u003e,\n\u003cAddr: 0x0018FDE6\u003e,\n...]}\n```\nUse some ammo and \"refeed\" the locator (do this a couple of times until there is one result left)\n```python\n\u003e\u003e\u003e lo.feed(199)\n{'double': [],\n 'float': [],\n 'int': [\u003cAddr: 0x0019FAF0\u003e],\n 'long': [],\n 'short': [],\n 'uint': [],\n 'ulong': [],\n 'ushort': []}\n\u003e\u003e\u003e a=_[\"int\"][0]\n\u003e\u003e\u003e a.read()\n199\n\u003e\u003e\u003ea.write(999999)\n1\n```\nNow you have infinite ammo :o)\n\n\nI hope this code will be useful to someone.\n\nHave fun !\n## Other examples\nHave a look at [mimipy](https://github.com/n1nj4sec/mimipy) that dumps passwords from various processes memory\n\n## Contact\nby mail: contact@n1nj4.eu  \non Twitter: [Follow me on twitter](https://twitter.com/n1nj4sec)  \n\nIf some of you want to participate or send me a feedback, don't hesitate :-)  \n  \nThis project is a personal development, please respect its philosophy don't use it for evil purpose !\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1nj4sec%2Fmemorpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn1nj4sec%2Fmemorpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1nj4sec%2Fmemorpy/lists"}