I have the python code which generates the hash value of two files. The first file is located in c:\windows\system32\wscript.exe and another file which is the clone of the first file which is located in d:\clone.exe.
python code
import os
strcommand ='certutil -hashfile c:\windows\system32\wscript.exe md2'
p=os.popen(strcommand ).read()
print(str(p).split('\n')[1])
strcommand1='certutil -hashfile d:\clone.exe md2'
p=os.popen(strcommand1 ).read()
print(str(p).split('\n')[1])
The output is
D:\pythonprogram>python clonefinder.py
4cef03889db08179b57035e4463a84d5
db1cefe474ce12678ea4d6c61dc42291
But when I use the command which is used in python in command prompt the hash values of the two files are same
Command prompt
D:\pythonprogram>certutil -hashfile c:\windows\system32\wscript.exe md2
MD2 hash of c:\windows\system32\wscript.exe:
db1cefe474ce12678ea4d6c61dc42291
CertUtil: -hashfile command completed successfully.
D:\pythonprogram>certutil -hashfile d:\clone.exe md2
MD2 hash of d:\clone.exe:
db1cefe474ce12678ea4d6c61dc42291
CertUtil: -hashfile command completed successfully.
I want the hash values to be the same if I am executing the python program
any help with this?