I am writing a python program to modify the compilation time of PE files. Based on my research, the compilation time is stored in the file header under the TimeDateStamp field. However, I only managed to find ways to read the TimeDateStamp value.
For example,
import pe
filename = "C:/Users/User/Desktop/test.exe"
pe = pefile.PE(filename)
print("TimeDateStamp: "+hex(pe.FILE_HEADER.TimeDateStamp))
How can I edit the TimeDateStamp field in the PE file header instead?
I have found the way to modify the timedatestamp field in PE file header by slightly modifying the code from getPETimeStamp.py created by @geudrik.
Python 3
Using the code above, the timeDateStamp field will be changed to 5c4570dd.