Exemplo n.º 1
0
    def printInfo(self, maxDepth=3, indent=0):
        tabs = '\t' * indent

        rightsId = format(self.getRightsId(), 'X').zfill(32)
        titleId = rightsId[0:16]
        titleKey = format(self.getTitleKeyBlock(), 'X').zfill(32)

        Print.info('\n%sTicket\n' % (tabs))
        super(Ticket, self).printInfo(maxDepth, indent)
        Print.info(tabs + 'signatureType = ' + str(self.signatureType))
        Print.info(tabs + 'keyType = ' + str(self.keyType))
        Print.info(tabs + 'masterKeyRev = ' + str(self.masterKeyRevision))
        Print.info(tabs + 'ticketId = ' + str(self.ticketId))
        Print.info(tabs + 'deviceId = ' + str(self.deviceId))
        Print.info(tabs + 'rightsId = ' + rightsId)
        Print.info(tabs + 'accountId = ' + str(self.accountId))
        Print.info(tabs + 'titleId = ' + titleId)
        Print.info(tabs + 'titleKey = ' + titleKey)
        Print.info(tabs + 'titleKeyDec = ' + str(
            hx(
                Keys.decryptTitleKey(
                    (self.getTitleKey()), self.masterKeyRevision))))

        try:
            if blockchain.verifyKey(titleId, titleKey):
                tkeyStatus = 'VERIFIED'
            else:
                tkeyStatus = 'BAD KEY'
        except BaseException as e:
            tkeyStatus = 'UNKNOWN - ' + str(e)
            raise

        Print.info(tabs + 'titleKeyStatus = ' + tkeyStatus)
Exemplo n.º 2
0
def unlockAll():
	initTitles()
	initFiles()

	for k,f in Nsps.files.items():
		if f.isUnlockable():
			try:
				if f.title().isBase() and not blockchain.verifyKey(f.titleId, f.title().key):
					raise IOError('Could not verify title key! %s / %s - %s' % (f.titleId, f.title().key, f.title().name))
					continue
				Print.info('unlocking ' + f.path)
				f.open(f.path, 'r+b')
				f.unlock()
				f.close()
			except BaseException as e:
				Print.info('error unlocking: ' + str(e))
Exemplo n.º 3
0
def submitKeys():
	for id, t in Titles.items():
		if t.key and t.isBase() and len(t.getFiles()) > 0:
			try:
				#blockchain.blockchain.suggest(t.id, t.key)
				if not blockchain.verifyKey(t.id, t.key):
					Print.error('Key verification failed for %s / %s' % (str(t.id), str(t.key)))
					for f in t.getFiles():
						f.hasValidTicket = False
						f.move()
			except LookupError as e:
				Print.info(str(e))
			except OSError as e:
				Print.info(str(e))
			except BaseException as e:
				Print.info(str(e))
				raise
Exemplo n.º 4
0
			initTitles()
			initFiles()
			for fileName in args.remove_title_rights:
				try:
					f = Fs.Nsp(fileName, 'r+b')
					f.removeTitleRights()
					f.flush()
					f.close()
				except BaseException as e:
					Print.error('Exception: ' + str(e))

		if args.nca_deltas:
			logNcaDeltas(args.nca_deltas)

		if args.verify:
			if blockchain.verifyKey(args.verify[0], args.verify[1]):
				Print.info('Title key is valid')
			else:
				Print.info('Title key is INVALID %s - %s' % (args.verify[0], args.verify[1]))

		if args.info:
			initTitles()
			initFiles()
			if re.search(r'^[A-Fa-f0-9]+$', args.info.strip(), re.I | re.M | re.S):
				Print.info('%s version = %s' % (args.info.upper(), CDNSP.get_version(args.info.lower())))
			else:
				print('reading')
				f = Fs.factory(args.info)
				f.open(args.info, 'r+b')
				f.printInfo(args.depth+1)
				'''