14: Hints for Patching EXEs with Ollydbg
Making Python Run on Windows
To make Python run from any directory,
open an Administrator Command Prompt and
execute these commands:
cd c:\Windows
mklink /H python.exe c:\python27\python.exe
Hint 1: Patch Better
Don't settle for the patched file
from the instructions. Modify it
more so you don't even have to guess the
launch code at all.
Hint 2: Automatic Patching with Python
Suppose I have a file containing eight bytes
like this:
![](pDC14e.png)
And I want to change one byte to 10 like this:
![](pDC14f.png)
This Python script does that job:
![](pDC14h.png)
Here's how to run it:
![](pDC14i.png)
Hint 3: Automating Execution with Python
Here's a Python script that runs the
command line command whoami
and appends the output to a file named
"out.txt".
![](pDC14l.png)
![](pDC14j.png)
![](pDC14k.png)
Hint 4: Processing All Files in a Directory
Here's a Python script that
prints all the filenames in a directory.
![](pDC14p.png)
![](pDC14q.png)
Modified 7-12-17 6:36 am
Mklink added 10-19-21