Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
import argparse
# Using to find the badbytes with unicode:
# !mona cmp -r $REG -f c:\all_chars_unicode.bin
# then use 'xxd -s $offset all_chars.bin' to find the actual byte matching the offset.
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--unicode', '-u', action='store_true')
args = parser.parse_args()
all_chars = ''
bad_chars = [0x00]
for i in range(0x00, 0xFF+1):
if i not in bad_chars:
all_chars += chr(i)
if args.unicode:
print('[*] Writing all_chars_unicode.bin')
with open("all_chars_unicode.bin", "w", encoding='utf-16le') as f:
print('[*] Writing all_chars.bin')
with open("all_chars.bin", "wb") as f:
f.write(bytes(all_chars, 'charmap'))
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment