Skip to content

Commit

Permalink
pr-no-enc-dlc
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Oct 21, 2023
1 parent 7dd4b2c commit 4f9f38c
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions py-test/lib/VerifyTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,47 +264,41 @@ def pr_noenc_check(self, file = None, mode = 'rb'):
"""

def pr_noenc_check_dlc(self):
print('[:WARN:] NOT IMPLEMENTED!')
return False
"""
crypto1=self.header.getCryptoType()
crypto2=self.header.getCryptoType2()
crypto1 = self.header.getCryptoType()
crypto2 = self.header.getCryptoType2()
if crypto1 == 2:
if crypto1 > crypto2:
masterKeyRev=crypto1
else:
masterKeyRev=crypto2
if crypto1 > crypto2:
masterKeyRev = crypto1
else:
masterKeyRev = crypto2
else:
masterKeyRev=crypto2
masterKeyRev = crypto2

decKey = Keys.decryptTitleKey(self.header.titleKeyDec, Keys.getMasterKeyIndex(masterKeyRev))
for f in self.sectionFilesystems:
#print(f.fsType);print(f.cryptoType)
if f.fsType == Type.Fs.ROMFS and f.cryptoType == Type.Crypto.CTR:
ncaHeader = NcaHeader()
if f.fsType == Fs.Type.Fs.ROMFS and f.cryptoType == Fs.Type.Crypto.CTR:
ncaHeader = Fs.Nca.NcaHeader()
self.header.rewind()
ncaHeader = self.header.read(0x400)
#Hex.dump(ncaHeader)
pfs0=f
#Hex.dump(pfs0.read())

pfs0 = f
sectionHeaderBlock = f.buffer

levelOffset = int.from_bytes(sectionHeaderBlock[0x18:0x20], byteorder='little', signed=False)
levelSize = int.from_bytes(sectionHeaderBlock[0x20:0x28], byteorder='little', signed=False)
levelOffset = int.from_bytes(sectionHeaderBlock[0x18:0x20], byteorder = 'little', signed = False)
levelSize = int.from_bytes(sectionHeaderBlock[0x20:0x28], byteorder = 'little', signed = False)

pfs0Header = pfs0.read(levelSize)

if sectionHeaderBlock[8:12] == b'IVFC':
data = pfs0Header;
#Hex.dump(pfs0Header)
data = pfs0Header
if hx(sectionHeaderBlock[0xc8:0xc8+0x20]).decode('utf-8') == str(sha256(data).hexdigest()):
return True
else:
return False
else:
data = pfs0Header;
#Hex.dump(pfs0Header)
data = pfs0Header
magic = pfs0Header[0:4]
if magic != b'PFS0':
return False
else:
return True
"""

0 comments on commit 4f9f38c

Please sign in to comment.