Skip to content

Instantly share code, notes, and snippets.

@mrexodia
Created September 9, 2016 15:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mrexodia/ccf9544f1fb4e473c8404d0788074637 to your computer and use it in GitHub Desktop.
Save mrexodia/ccf9544f1fb4e473c8404d0788074637 to your computer and use it in GitHub Desktop.
Unpacking UPX with x64dbgpy
from x64dbgpy.pluginsdk import *
import sys
cip = register.GetCIP()
if memory.ReadByte(cip) != 0x60:
gui.Message("Start at UPX entry point (1:[CIP]==0x60)")
exit(0)
x64dbg.DbgCmdExecDirect("bc")
x64dbg.DbgCmdExecDirect("bphwc")
found = pattern.FindMem(cip, 0x1000, "83 EC ?? E9");
if found == 0:
gui.Message("Could not find pattern!");
exit(0)
debug.SetBreakpoint(found + 3)
debug.Run()
debug.StepIn()
cip = register.GetCIP()
comment.Set(cip, "OEP Found by Python!")
gui.Message("Reached OEP. Use Scylla to dump and restore imports!")
x64dbg.DbgCmdExec("scylla")
@Mafhoom
Copy link

Mafhoom commented Dec 2, 2020

would you please update this for the last UPX?
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment