import hashlib

wii.loadkeys()


def getcerts(signed, certs):
    data = b''
    for certname in signed.issuer[::-1]:
        if certname == "Root":
            continue
        cert = certs[certname]
        data += cert.data
    return data


wad = wii.WiiWad(sys.argv[1])

print("Going to import boot2 version", wad.tmd.title_version)

tmd = wad.tmd.data
tik = wad.tik.data
wad.showinfo()
tikcerts = getcerts(wad.tik, wad.certs)
tmdcerts = getcerts(wad.tmd, wad.certs)
content = wad.getcontent(0, encrypted=True)
content += b"\x00" * 0
content2 = wad.getcontent(0)

wii.chexdump(wad.tmd.get_content_records()[0].sha)
wii.chexdump(hashlib.sha1(content2))
Beispiel #2
0
#!/usr/bin/env python2

import sys, os, os.path
import pywii as wii

args = sys.argv[1:]

if args[0] == "-dpki":
    wii.loadkeys_dpki()
    args.pop(0)
else:
    wii.loadkeys()

wadfile = args.pop(0)
outdir = args.pop(0)
wad = wii.WiiWad(wadfile)
wad.showinfo()

if not os.path.isdir(outdir):
    os.mkdir(outdir)

for ct in wad.tmd.get_content_records():
    data = wad.getcontent(ct.index)
    f = open(os.path.join(outdir, "%08X" % ct.cid), "wb")
    f.write(data)
    f.close()

f = open(os.path.join(outdir, "cetk"), "wb")
f.write(wad.tik.data)
f.close()