Skip to content

Instantly share code, notes, and snippets.

@atmb4u
Created November 25, 2011 18:46
Show Gist options
  • Save atmb4u/1394169 to your computer and use it in GitHub Desktop.
Save atmb4u/1394169 to your computer and use it in GitHub Desktop.
Another self modifying system which gets modified each timw someone accesses ut
import re
f = open("choice.py","r+")
i = 1###########This Number will get replaced
print "%s times" % (i)
f.seek(41)
c = f.readline()
m = re.match('\d+',c)
f.seek(41)
f.write(str(int(m.group())+1))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment