Subversion Repositories freemyipod

Rev

Rev 788 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 788 Rev 793
Line 117... Line 117...
117
    data = emcore.read(addr, 0x50) + data + cert.ljust((len(cert) + 0xf) & ~0xf, b"\0")
117
    data = emcore.read(addr, 0x50) + data + cert.ljust((len(cert) + 0xf) & ~0xf, b"\0")
118
    emcore.free(addr)
118
    emcore.free(addr)
119
    return data
119
    return data
120
 
120
 
121
 
121
 
-
 
122
def s5l8702genpwnage800(data):
-
 
123
    cert = open(os.path.dirname(__file__) + "/libipodcrypto/s5l8702pwnage.cer", "rb").read()
-
 
124
    data = data.ljust(max(0x90, (len(data) + 0xf) & ~0xf), b"\0")
-
 
125
    header = (b"87021.0\x03\0\0\0\0" + struct.pack("<IIII", len(data) - 0x80, len(data) + 0x2ba, len(data), 0x2ba)).ljust(0x40, b"\0")
-
 
126
    emcore = libemcore.Emcore()
-
 
127
    addr = emcore.memalign(0x10, len(data))
-
 
128
    emcore.write(addr, header + hashlib.sha1(header).digest()[:0x10])
-
 
129
    emcore.aesencrypt(addr + 0x40, 0x10, 1)
-
 
130
    data = emcore.read(addr, 0x50).ljust(0x800, b"\0") + data + cert.ljust((len(cert) + 0xf) & ~0xf, b"\0")
-
 
131
    emcore.free(addr)
-
 
132
    return data
-
 
133
 
-
 
134
 
122
def s5l8720genpwnage(data):
135
def s5l8720genpwnage(data):
123
    cert = open(os.path.dirname(__file__) + "/libipodcrypto/s5l8720pwnage.cer", "rb").read()
136
    cert = open(os.path.dirname(__file__) + "/libipodcrypto/s5l8720pwnage.cer", "rb").read()
124
    data = data.ljust(max(0x640, (len(data) + 0xf) & ~0xf), b"\0")
137
    data = data.ljust(max(0x640, (len(data) + 0xf) & ~0xf), b"\0")
125
    header = (b"87202.0\x03\0\0\0\0" + struct.pack("<IIII", len(data) - 0x630, len(data) - 0x2f2, len(data) - 0x5b0, 0x2be)).ljust(0x40, b"\0")
138
    header = (b"87202.0\x03\0\0\0\0" + struct.pack("<IIII", len(data) - 0x630, len(data) - 0x2f2, len(data) - 0x5b0, 0x2be)).ljust(0x40, b"\0")
126
    emcore = libemcore.Emcore()
139
    emcore = libemcore.Emcore()
Line 186... Line 199...
186
    outfile.write(s5l8702genpwnage(infile.read()))
199
    outfile.write(s5l8702genpwnage(infile.read()))
187
    infile.close()
200
    infile.close()
188
    outfile.close()
201
    outfile.close()
189
 
202
 
190
 
203
 
-
 
204
def s5l8702genpwnagefile800(infile, outfile):
-
 
205
    infile = open(infile, "rb")
-
 
206
    outfile = open(outfile, "wb")
-
 
207
    outfile.write(s5l8702genpwnage800(infile.read()))
-
 
208
    infile.close()
-
 
209
    outfile.close()
-
 
210
 
-
 
211
 
191
def s5l8720genpwnagefile(infile, outfile):
212
def s5l8720genpwnagefile(infile, outfile):
192
    infile = open(infile, "rb")
213
    infile = open(infile, "rb")
193
    outfile = open(outfile, "wb")
214
    outfile = open(outfile, "wb")
194
    outfile.write(s5l8720genpwnage(infile.read()))
215
    outfile.write(s5l8720genpwnage(infile.read()))
195
    infile.close()
216
    infile.close()