Last active
June 17, 2019 16:54
-
-
Save larsenv/e342c548dd2b5b8562613ca1c2b7a61a to your computer and use it in GitHub Desktop.
Find Wiimmfi game name and secrets from an executable
This file contains 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
import subprocess | |
import sys | |
if len(sys.argv) != 3: | |
exit("Usage: name_secrets.py <DOL or ARM binary> <Wii or DS>") | |
if sys.argv[2] != "wii" and sys.argv[2] != "ds": | |
exit("Platform must be specified as Wii or DS.\nUsage: name_secrets.py <DOL or ARM binary> <Wii or DS>") | |
string = subprocess.Popen(["strings", sys.argv[1]], stdout=subprocess.PIPE) | |
out = string.stdout.readlines() | |
punctuation = [b'!', b'@', b'#', b'$', b'%', b'^', b'&', b'*', b'(', b')', b'{', b'}', b'[', b']', b'|', b'<', b'>', b'?', b',', b'.', b'/', b'\\', b'~', b'`', b'-', b'_', b'+', b'=', b':', b';', b' ', b'"', b'str', b'print', b'mem', b'UU', b'88', b'00'] | |
print("Possible Game Names:\n") | |
for line in out: | |
if sys.argv[2] == "wii": | |
platform = b'wii' | |
elif sys.argv[2] == "ds": | |
platform = b'ds' | |
if platform in line: | |
if len(line) < 30: | |
has_punctuation = False | |
for p in punctuation: | |
if p in line: | |
has_punctuation = True | |
if not has_punctuation: | |
print(line.decode("utf-8")) | |
print("\n") | |
found = [] | |
dupes = [] | |
print("Possible Secrets:\n") | |
for line in out: | |
if len(line) != 7: | |
continue | |
has_punctuation = False | |
for p in punctuation: | |
if p in line: | |
has_punctuation = True | |
if not has_punctuation: | |
if line != line.lower(): | |
secret = line.decode("utf-8") | |
if secret in found: | |
found.remove(secret) | |
dupes.append(secret) | |
elif secret in dupes: | |
pass | |
else: | |
found.append(secret) | |
for s in sorted(found): | |
print(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment