Created
December 27, 2016 02:33
-
-
Save nattybear/20135179a3d0f4ff83f7c98254dffaf6 to your computer and use it in GitHub Desktop.
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
from sys import argv, exit | |
from binascii import unhexlify | |
if len(argv) != 2: | |
print 'Usage:', 'unicodify.exe', '<txt>' | |
exit() | |
txt = argv[1] | |
new = 'unicode_' + txt | |
fp1 = open(txt, 'rb') | |
fp2 = open(new, 'wb') | |
buf1 = fp1.read() | |
buf2 = '' | |
mylist = buf1.split(b'\x0d\x0a') | |
for i in mylist: | |
if len(i) == 0: | |
buf2 = buf2 + b'\x00\x0d\x00\x0a' | |
else: | |
i = i.replace(' ', '') | |
i = unhexlify(i) | |
buf2 = buf2 + i + b'\x00\x0d\x00\x0a' | |
buf2 = b'\xfe\xff' + buf2 | |
fp2.write(buf2) | |
print '[*]', new, 'saved' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment