def chooseAccount(account):
    if backupType_support.getImportType() == "unsign":
        unsign_support.pushVars(account, load, False)
        unsign.vp_start_gui()
    elif backupType_support.getImportType() == "sign":
        sign_support.goSign(account, load, backup, False)
    if backupType_support.getImportType() == "resign":
        unsign_support.pushVars(account, load, True)
        unsign.vp_start_gui()
    if backupType_support.getImportType() == "resign2":
        sign_support.goSign(account, loaad, bkupz, True)
        tkMessageBox.showinfo(title="Resign",
                              message="Re-Sign Complete! (Refresh QCMA)")
Example #2
0
def goUnsign(cmaBackup, CMA,cmbackup=False):
    if cmbackup == True:
            location = tkFileDialog.asksaveasfilename(title='Select location',filetypes=[('Unsigned CMA Backup File', '*.cmbackup')])
            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()



    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 = 4
        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 = ['game', 'license']
            am = 1
        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.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!')
        print 'Opening Folder: ' + CMA + '/EXTRACTED/' + load + '/' + cmaBackup
        openFolder(CMA + '/EXTRACTED/' + load + '/' + 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)
        tkMessageBox.showinfo(title='CMBACKUP', message='.cmbackup Created.')
    sys.stdout.flush()
Example #3
0
            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)
        tkMessageBox.showinfo(title='CMBACKUP', message='.cmbackup Created.')
    sys.stdout.flush()


def init(top, gui, *args, **kwargs):
    global root
    global w
    global top_level
    w = gui
    top_level = top
    root = top


def destroy_window():
    global top_level
    top_level.destroy()
    top_level = None


if __name__ == '__main__':
    import unsign
    unsign.vp_start_gui()

def getAccount():
    return account