Forked from trietptm/Process32First_Process32Next.py
Created
August 17, 2016 17:35
-
-
Save spnow/30850b206a1385b4da21d5e930aa1122 to your computer and use it in GitHub Desktop.
Process32First_Process32Next.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from immlib import * | |
| from immutils import * | |
| import getopt | |
| import pefile | |
| imm = Debugger() | |
| def main(args): | |
| if args: | |
| usage() | |
| return "!patch, no args, just !patch" | |
| debugged_name = imm.getDebuggedName() | |
| debuggee = imm.getModule(debugged_name) | |
| base_address = debuggee.getBaseAddress() | |
| process32first = imm.getAddress("kernel32.Process32FirstW") | |
| process32next = imm.getAddress("kernel32.Process32NextW") | |
| function_list = [process32first, process32next] | |
| patch_bytes = imm.assemble("SUB EAX, EAX\nRET") | |
| for address in function_list: | |
| opcode = imm.disasmForward(address, nlines = 10) | |
| imm.writeMemory(opcode.address, patch_bytes) | |
| result = debugged_name | |
| return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment