Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import os
- import time
- filename = 'test.exe'
- new_filename = '{0}.backup.{1}'.format(filename, int(time.time()))
- pattern = b'GCC: .*?\x00'
- f = open(filename, 'rb')
- data = f.read()
- f.close()
- matches = re.findall(pattern, data)
- matches = set(matches)
- for match in matches:
- # replacement = b"X" * (len(match)-1) + b'\x00'
- replacement = b"\x00" * (len(match))
- data = data.replace(match, replacement)
- print("Renaming {0} to {1}".format(filename, new_filename))
- os.rename(filename, new_filename)
- f = open(filename, 'wb')
- f.write(data)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement