Created
April 26, 2017 17:20
-
-
Save nopslider/f9ba790dc2f4a0050e2e430a2de081fd to your computer and use it in GitHub Desktop.
Replace a beacon in a Word file (.doc)
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
#python3 wordmagicmarker.py test.doc [email protected] > test1.doc | |
import sys | |
import hashlib | |
marker = "A"*32 | |
marker8 = bytes(marker,'utf-8') | |
marker16 = bytes(marker,'utf-16-be') | |
email = sys.argv[2].encode('utf-8') | |
ehash = hashlib.md5(email).hexdigest() | |
ehash8 = bytes(ehash,'utf-8') | |
ehash16 = bytes(ehash,'utf-16-be') | |
file = open(sys.argv[1], 'rb').read() | |
file = file.replace(marker8,ehash8) | |
file = file.replace(marker16,ehash16) | |
sys.stdout.buffer.write(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment