Created
November 25, 2011 03:03
-
-
Save atmb4u/1392738 to your computer and use it in GitHub Desktop.
Basic self modifying code - puts the md5 of parent and last modified time. More info @ http://en.wikipedia.org/wiki/Self-modifying_code
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
import md5 | |
f = open("newmd5.py","r+") | |
b = md5.md5(f.read()) | |
# MD5 of the parent: 54062bcee8cdff7b3c3124421f5c5018 Last Modified:2011-11-21 23:28:46.974856 | |
f.seek(60) | |
import datetime | |
digest = b.hexdigest() | |
f.writelines("# MD5 of the parent: "+digest+" Last Modified:"+str(datetime.datetime.now())) | |
print digest | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basic self modifying code written in Python. Save the file with name newmd5.py and run it. Each time, it will self modify the code and get the latest md5 digest, with time
Just a simple idea to start with serious self modifying code.