def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' font10 = "-family {DejaVu Sans Mono} -size 12 -weight normal " \ "-slant roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("750x500+218+86") top.title("Select Backup") top.configure(highlightcolor="black") cmadir = open('cmadir.txt', 'r') CMA = cmadir.read() a = 0 self.Label1 = Label(top) self.Label1.place(relx=0.02, rely=0.02, height=18, width=96) self.Label1.configure(text='''Patch: ''') self.Label1.configure(width=96) self.backupList = ScrolledListBox(top) self.backupList.place(relx=0.01, rely=0.06, relheight=0.87, relwidth=0.97) self.backupList.configure(background="white") self.backupList.configure(font=font10) self.backupList.configure(highlightcolor="#d9d9d9") self.backupList.configure(selectbackground="#c4c4c4") self.backupList.configure(width=10) print("Looking For Backups In: " + CMA + "/PGAME/" + defs.getAid(account)) for root, dir, files in os.walk(CMA + "/PGAME/" + defs.getAid(account)): for items in fnmatch.filter(dir, "*"): a += 1 if defs.isEncryptedApp(CMA + "/PGAME/" + defs.getAid(account) + "/" + items): title = sfoParser.main(CMA + "/PGAME/" + defs.getAid(account) + "/" + items + "/sce_sys/param.sfo") self.backupList.insert(a, title + " (" + items + ")") self.Button1 = Button(top) self.Button1.place(relx=0.83, rely=0.94, height=26, width=117) self.Button1.configure(activebackground="#d9d9d9") self.Button1.configure(command=lambda: patch( defs.getTitleID(self.backupList.get(ACTIVE)))) self.Button1.configure(text='''Patch W VHBL''')
def __init__(self, top = None): """This class configures and populates the toplevel window. top is the toplevel containing window.""" _bgcolor = '#d9d9d9' _fgcolor = '#000000' _compcolor = '#d9d9d9' _ana1color = '#d9d9d9' _ana2color = '#d9d9d9' font10 = '-family {DejaVu Sans Mono} -size 12 -weight normal -slant roman -underline 0 -overstrike 0' self.style = ttk.Style() if sys.platform == 'win32': self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry('750x500+218+86') top.title('Unsign Backup') top.configure(highlightcolor='black') cmadir = open('cmadir.txt', 'r') CMA = cmadir.read() a = 0 self.Label1 = Label(top) self.Label1.place(relx=0.02, rely=0.02, height=18, width=96) self.Label1.configure(text='What Backup?') self.Label1.configure(width=96) self.backupList = ScrolledListBox(top) self.backupList.place(relx=0.01, rely=0.06, relheight=0.87, relwidth=0.97) self.backupList.configure(background='white') self.backupList.configure(font=font10) self.backupList.configure(highlightcolor='#d9d9d9') self.backupList.configure(selectbackground='#c4c4c4') self.backupList.configure(width=10) print 'Looking For Backups In: ' + CMA + '/' + unsign_support.getLoad() + '/' + defs.getAid(unsign_support.getAccount()) for root, dir, files in defs.walklevel(CMA + '/' + unsign_support.getLoad() + '/' + defs.getAid(unsign_support.getAccount()),0): for items in fnmatch.filter(dir, '*'): a += 1 if defs.isEncryptedApp(CMA + '/' + unsign_support.getLoad() + '/' + defs.getAid(unsign_support.getAccount()) + '/' + items): title = sfoParser.main(CMA + '/' + unsign_support.getLoad() + '/' + defs.getAid(unsign_support.getAccount()) + '/' + items + '/sce_sys/param.sfo') if pfs.isKeyKnown(items): self.backupList.insert(a, title + ' [PFS] (' + items + ')') else: self.backupList.insert(a, title + ' (' + items + ')') elif unsign_support.getLoad() == 'SYSTEM' and defs.isBackup(CMA + '/' + unsign_support.getLoad() + '/' + defs.getAid(unsign_support.getAccount()) + '/' + items + '/' + items): self.backupList.insert(a, items) self.Button1 = Button(top) self.Button1.place(relx=0.83, rely=0.94, height=26, width=117) self.Button1.configure(activebackground='#d9d9d9') if unsign_support.getLoad() != "SYSTEM": self.Button1.configure(command=lambda: unsign_support.goUnsign(defs.getTitleID(self.backupList.get(ACTIVE)), CMA, False,unsign_support.getLoad(), unsign_support.getAccount())) else: self.Button1.configure(command=lambda: unsign_support.goUnsign(self.backupList.get(ACTIVE), CMA, False,unsign_support.getLoad(), unsign_support.getAccount())) self.Button1.configure(text='Unsign & Extract') if unsign_support.getResign() == False: self.Button2 = Button(top) self.Button2.place(relx=0.01, rely=0.94, height=26, width=120) self.Button2.configure(activebackground='#d9d9d9') self.Button2.configure(command=lambda: unsign_support.goUnsign(defs.getTitleID(self.backupList.get(ACTIVE)), CMA, True,unsign_support.getLoad(), unsign_support.getAccount())) self.Button2.configure(text='Create .cmbackup')
def __init__(self, top=None): """This class configures and populates the toplevel window. top is the toplevel containing window.""" _bgcolor = '#d9d9d9' _fgcolor = '#000000' _compcolor = '#d9d9d9' _ana1color = '#d9d9d9' _ana2color = '#d9d9d9' font10 = '-family {DejaVu Sans Mono} -size 12 -weight normal -slant roman -underline 0 -overstrike 0' self.style = ttk.Style() if sys.platform == 'win32': self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry('750x500+183+54') top.title('Sign Backup') top.configure(highlightcolor='black') cmadir = open('cmadir.txt', 'r') CMA = cmadir.read() self.Button2 = Button(top) self.Button2.place(relx=0.13, rely=0.94, height=26, width=107) self.Button2.configure(activebackground='#d9d9d9') if sign_support.getLoad() != "SYSTEM": self.Button2.configure(command=lambda: sign_support.delBkup( defs.getTitleID(self.backupList.get(ACTIVE)))) elif sign_support.getLoad() == "SYSTEM": self.Button2.configure(command=lambda: sign_support.delBkup( self.backupList.get(ACTIVE))) self.Button2.configure(text='Delete Backup') self.Button2.configure(width=107) self.Button3 = Button(top) self.Button3.place(relx=0.87, rely=0.94, height=26, width=87) self.Button3.configure(activebackground='#d9d9d9') if sign_support.getLoad() != "SYSTEM": self.Button3.configure(command=lambda: sign_support.sign( defs.getTitleID(self.backupList.get(ACTIVE)))) elif sign_support.getLoad() == "SYSTEM": self.Button3.configure( command=lambda: sign_support.sign(self.backupList.get(ACTIVE))) self.Button3.configure(text='Sign & Pack') self.Button3.configure(width=87) a = 0 self.backupList = ScrolledListBox(top) self.backupList.place(relx=0.01, rely=0.02, relheight=0.91, relwidth=0.97) self.backupList.configure(background='white') self.backupList.configure(font=font10) self.backupList.configure(highlightcolor='#d9d9d9') self.backupList.configure(selectbackground='#c4c4c4') self.backupList.configure(width=10) print 'Looking For Backups In: ' + CMA + '/EXTRACTED/' + sign_support.getLoad( ) for root, dir, files in defs.walklevel( CMA + '/EXTRACTED/' + sign_support.getLoad(), 0): for items in fnmatch.filter(dir, '*'): a += 1 if sign_support.getLoad() != 'SYSTEM' and defs.isApp( CMA + '/EXTRACTED/' + sign_support.getLoad() + '/' + items): title = sfoParser.main(CMA + '/EXTRACTED/' + sign_support.getLoad() + '/' + items + '/sce_sys/param.sfo') if pfs.isKeyKnown(items): self.backupList.insert( a, title + ' [PFS] (' + items + ')') else: self.backupList.insert(a, title + ' (' + items + ')') elif sign_support.getLoad() == 'SYSTEM' and defs.isBackup( CMA + '/EXTRACTED/' + sign_support.getLoad() + '/' + items): self.backupList.insert(a, items) self.Button4 = Button(top) self.Button4.place(relx=0.01, rely=0.94, height=26, width=87) self.Button4.configure(activebackground='#d9d9d9') if sign_support.getLoad() != "SYSTEM": self.Button4.configure(command=lambda: sign_support.expBkup( defs.getTitleID(self.backupList.get(ACTIVE)))) elif sign_support.getLoad() == 'SYSTEM': self.Button4.configure(command=lambda: sign_support.expBkup( self.backupList.get(ACTIVE))) self.Button4.configure(text='Edit Backup') self.Button4.configure(width=87) self.Button9 = Button(top) self.Button9.place(relx=0.28, rely=0.94, height=26, width=115) self.Button9.configure(activebackground='#d9d9d9') self.Button9.configure(command=sign_support.cmbackup) self.Button9.configure(text='Install .cmbackup') self.Button9.configure(width=107) if sign_support.getLoad() == "APP": self.pfsDecryptButton = Button(top) self.pfsDecryptButton.place(relx=0.75, rely=0.94, height=26, width=87) self.pfsDecryptButton.configure(activebackground='#d9d9d9') self.pfsDecryptButton.configure(command=lambda: pfdecrypt( defs.getTitleID(self.backupList.get(ACTIVE)))) self.pfsDecryptButton.configure(text='PFS Decrypt') self.pfsDecryptButton.configure(width=87)
def goUnsign(cmaBackup, CMA=defs.getCmaDir(), cmbackup=False, load="", account="", resign=False): if cmbackup == True: title = sfoParser.main(CMA + '/' + load + '/' + defs.getAid(account) + '/' + cmaBackup + '/sce_sys/param.sfo') try: location = tkFileDialog.asksaveasfilename( title='Select location', filetypes=[('Unsigned CMA Backup File', '*.cmbackup')], initialfile=title) except: location = tkFileDialog.asksaveasfilename( title='Select location', filetypes=[('Unsigned CMA Backup File', '*.cmbackup')], initialfile=cmaBackup) try: print 'location: ' + location except TypeError: tkMessageBox.showerror( title="Error 302", message= "ERROR: You did not select a location to create the .cmbackup!" ) import sys sys.exit() print "Checking if allready extracted backup exists..." if os.path.exists(CMA + '/EXTRACTED/' + load + '/' + cmaBackup): print 'Backup Found! Removing...' shutil.rmtree(CMA + '/EXTRACTED/' + load + '/' + cmaBackup) print 'Extracting backup..' else: print 'Nope! Extracting backup..' global am global foldParams import unsign unsign.close_window(root) key = open('keys/' + account, 'r') cmaKey = key.read() aid = open('accounts/' + account, 'r') cmaAID = aid.read() import sys if load != 'SYSTEM': if load == 'PGAME': foldParams = ['game', 'license'] am = 1 elif load == 'APP': foldParams = [ 'app', 'patch', 'addcont', 'appmeta', 'license', 'savedata' ] am = 5 elif load == 'PSGAME': foldParams = ['game', 'license'] am = 1 elif load == 'PSM': foldParams = ['game', 'license', 'patch', 'savedata'] am = 3 if not os.path.exists(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/'): os.makedirs(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/') while am != -1: if os.path.exists(CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[am] + '/'): if not os.path.exists(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am]): os.makedirs(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am]) am -= 1 if load == 'PGAME': foldParams = ['game', 'license'] am = 1 elif load == 'APP': foldParams = [ 'app', 'patch', 'addcont', 'appmeta', 'license', 'savedata' ] am = 5 elif load == 'PSGAME': foldParams = ['game', 'license'] am = 1 elif load == 'PSM': foldParams = ['app'] am = 0 while am != -1: if sys.platform.__contains__('linux') or sys.platform.__contains__( 'darwin'): print 'Executing: ./psvimg-extract -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[ am] + '/' + foldParams[ am] + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[ am] + '"' os.system('./psvimg-extract -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[am] + '/' + foldParams[am] + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am] + '"') print 'Executing: ./psvmd-decrypt -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[ am] + '/' + foldParams[ am] + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[ am] + '.psvmd-dec"' os.system('./psvmd-decrypt -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[am] + '/' + foldParams[am] + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am] + '.psvmd-dec"') am -= 1 if sys.platform.__contains__( 'win') and not sys.platform.__contains__("darwin"): print 'Executing: psvimg-extract.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[ am] + '/' + foldParams[ am] + '.psvimg ' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[ am] os.system('psvimg-extract.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[am] + '/' + foldParams[am] + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am] + '"') print 'Executing: psvmd-decrypt.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[ am] + '/' + foldParams[ am] + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[ am] + '.psvmd-dec"' os.system('psvmd-decrypt.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + foldParams[am] + '/' + foldParams[am] + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/' + foldParams[am] + '.psvmd-dec"') am -= 1 if not os.path.exists(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/sce_sys'): print 'Copying Folder: ' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/sce_sys' + ' To: ' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/sce_sys' shutil.copytree( CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/sce_sys', CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/sce_sys') elif load == 'SYSTEM': if sys.platform.__contains__('linux') or sys.platform.__contains__( 'darwin'): print 'Executing: ./psvimg-extract -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '"' os.system('./psvimg-extract -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '"') print 'Executing: ./psvmd-decrypt -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvmd-dec"' os.system('./psvmd-decrypt -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvmd-dec"') if sys.platform.__contains__( 'win') and not sys.platform.__contains__("darwin"): print 'Executing: psvimg-extract.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '"' os.system('psvimg-extract.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvimg" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '"') print 'Executing: psvmd-decrypt.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvmd-dec"' os.system('psvmd-decrypt.exe -K ' + cmaKey + ' "' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvmd" "' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvmd-dec"') print 'Copying File: ' + CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvinf' + ' To: ' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvinf' if os.path.exists(CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvinf'): shutil.copy( CMA + '/' + load + '/' + cmaAID + '/' + cmaBackup + '/' + cmaBackup + '.psvinf', CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '.psvinf') if resign == False and cmbackup == False: tkMessageBox.showinfo(title='Extract', message='Extraction Complete!') if pfs.isKeyKnown(cmaBackup): if tkMessageBox.askyesno( title="PFS", message= "The PFS Key for this application is known\nWould you like to decrypt PFS as well?" ): pfs.decrypt(cmaBackup) tkMessageBox.showinfo(title="PFS", message="PFS Decrypted for " + cmaBackup) import unsign unsign.vp_start_gui() elif resign == True: loaad = load accSelect_support.resignVars(cmaBackup, load) backupType_support.action('resign2') accSelect.vp_start_gui() elif cmbackup == True: print 'Creating .cmbackup' print 'Writing load.txt' loadtext = open( CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/load.txt', 'w') loadtext.write(load) loadtext.close() print 'Writing TitleID.txt' loadtext = open( CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/TitleID.txt', 'w') loadtext.write(cmaBackup) loadtext.close() print 'Checking for savedata..' if os.path.exists(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/savedata'): savedata = tkMessageBox.askyesno( title="Savedata", message= "This Backup Contains Savedata, Would you like to pack that into the .CMBACKUP File?\nSavedata could potentailly contain personal infomation!!" ) if savedata == False: shutil.rmtree(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/savedata') os.remove(CMA + '/EXTRACTED/' + load + '/' + cmaBackup + '/savedata.psvmd-dec') print 'Writing .cmbackup file..' defs.zip(src=CMA + '/EXTRACTED/' + load + '/' + cmaBackup, dst=location) print "Removing: " + CMA + '/EXTRACTED/' + load + '/' + cmaBackup shutil.rmtree(CMA + '/EXTRACTED/' + load + '/' + cmaBackup) print "Done! CMBackup Created!" tkMessageBox.showinfo(title='CMBACKUP', message='.cmbackup Created.') sys.stdout.flush()