Exemple #1
0
def pass_command(args):
    c = 0
    if not args.findfile:
        items = listmanager.counter(args.text_file)
        process = list()
        while items != 0:
            if c == 0:
                c += 1
            else:
                print("")
            listmanager.printcurrent(args.text_file)
            arguments, nonevar = getargs(args, separate_list=False)
            # print(arguments)
            process.append(subprocess.Popen(arguments))
            for p in process:
                p.wait()
                # print(str(p.poll()))
                while p.poll() == None:
                    if p.poll() != None:
                        p.terminate()
            listmanager.striplines(args.text_file, number=1, counter=True)
            items -= 1
        return items
    else:
        arguments, nonevar = getargs(args, separate_list=False)
        # print(arguments)
        process = list()
        process.append(subprocess.Popen(arguments))
        for p in process:
            p.wait()
            # print(str(p.poll()))
            while p.poll() == None:
                if p.poll() != None:
                    p.terminate()
        return 0
Exemple #2
0
def loop_transfer(tfile):
    if not os.path.exists(tfile):
        sys.exit(f"Couldn't find {tfile}")
    destiny = pick_transfer_folder()
    file_list = listmanager.read_lines_to_list(tfile, all=True)
    for item in file_list:
        transfer(filepath=item, destiny=destiny)
        print("")
        listmanager.striplines(tfile, counter=True)
Exemple #3
0
def loop_xci_transfer(tfile,destiny=False,verification=True,outfolder=None,patch_keygen=False,mode="single"):
	if destiny==False or destiny=="pick" or destiny=="":
		destiny=pick_transfer_folder()	
	if not os.path.exists(tfile):
		sys.exit(f"Couldn't find {tfile}")	
	file_list=listmanager.read_lines_to_list(tfile,all=True)
	for item in file_list:
		if mode=="single":
			generate_xci_and_transfer(filepath=item,destiny=destiny,verification=verification,outfolder=outfolder,kgpatch=patch_keygen)
			print("")
			listmanager.striplines(tfile,counter=True)
		elif mode=="multi":
			continue
Exemple #4
0
def rename_nsx(fp):
    if fp.endswith('.txt'):
        filelist = listmanager.read_lines_to_list(fp, all=True)
        for file in filelist:
            if file[0] == '"':
                file = file[1:]
            if file[-1] == '"':
                file = file[:-1]
            file = os.path.abspath(file)
            test_ifnsx(file)
            listmanager.striplines(fp, number=1, counter=True)
    else:
        test_ifnsx(fp)
    try:
        os.remove(fp)
    except:
        pass
def loop_install(tfile,destiny="SD",outfolder=None,ch_medium=True,check_fw=True,patch_keygen=False,ch_base=False,ch_other=False,truecopy=True,checked=False):	
	check_connection()
	if not os.path.exists(tfile):
		sys.exit(f"Couldn't find {tfile}")	
	from mtpinstaller import retrieve_installed,parsedinstalled
	installed=[]
	if ch_base==True or ch_other==True:
		if checked==False:		
			print("Content check activated")			
			retrieve_installed()
			installed=parsedinstalled()		
		elif checked==True:
			print("Content check activated. Games are preparsed")		
			installed=parsedinstalled()		
	file_list=listmanager.read_lines_to_list(tfile,all=True)	
	for item in file_list:
		if item.startswith('https://1fichier.com'):
			print("Item is 1fichier link. Redirecting...")
			fichier_install(item,destiny,ch_medium,ch_base=ch_base,ch_other=ch_other,installed_list=installed)			
		elif item.startswith('https://drive.google.com'):
			print("Item is google drive public link. Redirecting...")
			public_gdrive_install(item,destiny,outfolder=outfolder,ch_medium=ch_medium,check_fw=check_fw,patch_keygen=patch_keygen,ch_base=ch_base,ch_other=ch_other,checked=checked,truecopy=truecopy,installed_list=installed)			
		elif os.path.exists(item):
			print("Item is a local link. Skipping...")	
		else:
			try:
				test=item.split('|')
				if len(test)<2:
					item=test[0]
					lib,TD,libpath=get_library_from_path(remote_lib_file,item)			
					if lib!=None:
						print("Item is a remote library link. Redirecting...")
						gdrive_install(item,destiny,outfolder=outfolder,ch_medium=ch_medium,check_fw=check_fw,patch_keygen=patch_keygen,ch_base=ch_base,ch_other=ch_other,checked=checked,installed_list=installed)
					else:
						print("Couldn't find file. Skipping...")					
				else:	
					gdrive_install(item,destiny,outfolder=outfolder,ch_medium=ch_medium,check_fw=check_fw,patch_keygen=patch_keygen,ch_base=ch_base,ch_other=ch_other,checked=checked,installed_list=installed)	
			except BaseException as e:
				Print.error('Exception: ' + str(e))
				print(f"Couldn't find {test[0]}. Skipping...")
		print("")					
		listmanager.striplines(tfile,1,True)						
Exemple #6
0
def loop_install(tfile,destiny="SD",verification=True,outfolder=None,ch_medium=True,check_fw=True,patch_keygen=False,ch_base=False,ch_other=False,install_mode="spec1",st_crypto=False,checked=False):
	check_connection()		
	if not os.path.exists(tfile):
		sys.exit(f"Couldn't find {tfile}")		
	if ch_base==True or ch_other==True:
		if checked==False:		
			print("Content check activated")			
			retrieve_installed()
			installed=parsedinstalled()
		elif checked==True:	
			print("Content check activated. Games are preparsed")		
			installed=parsedinstalled()	
	file_list=listmanager.read_lines_to_list(tfile,all=True)
	for item in file_list:
		try:
			if ch_base==True or ch_other==True:
				fileid,fileversion,cctag,nG,nU,nD,baseid=listmanager.parsetags(item)
				if fileid.endswith('000') and fileversion==0 and fileid in installed.keys() and ch_base==True:
					print("Base game already installed. Skipping...")
					listmanager.striplines(tfile,counter=True)
					continue
				elif fileid.endswith('000') and fileid in installed.keys() and ch_other==True:
					updid=fileid[:-3]+'800'
					if fileversion>((installed[fileid])[2]):
						print("Asking DBI to delete previous content")
						process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])	
						while process.poll()==None:
							if process.poll()!=None:
								process.terminate();					
						process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",updid])		
						while process.poll()==None:
							if process.poll()!=None:
								process.terminate();					
					else:
						print("The update is a previous version than the installed on device.Skipping..")
						listmanager.striplines(tfile,counter=True)
						continue				
				elif ch_other==True	and fileid in installed.keys():
					if fileversion>((installed[fileid])[2]):
						print("Asking DBI to delete previous update")
						process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])					
						while process.poll()==None:
							if process.poll()!=None:
								process.terminate();
					else:
						print("The update is a previous version than the installed on device.Skipping..")
						listmanager.striplines(tfile,counter=True)
						continue	
		except:pass				
		install(filepath=item,destiny=destiny,verification=verification,outfolder=outfolder,ch_medium=ch_medium,check_fw=check_fw,patch_keygen=patch_keygen,install_mode=install_mode,st_crypto=st_crypto)
		print("")
		listmanager.striplines(tfile,counter=True)
Exemple #7
0
def check_xci_certs(ifolder, tfile, tfile2):
    from listmanager import folder_to_list, striplines, read_lines_to_list
    from Fs import Xci
    import os
    if not os.path.exists(tfile):
        xci_files = folder_to_list(ifolder, ['xci'])
        with open(tfile, "w", encoding='utf8') as t:
            for file in xci_files:
                t.write(file + '\n')
    else:
        xci_files = read_lines_to_list(tfile, all=True)
    counter = len(xci_files)
    for file in xci_files:
        try:
            xci = Xci(file)
            if not xci.gamecardCert.Cert_is_fake:
                print(f"{file} has personalized certificate")
                with open(tfile2, "a", encoding='utf8') as t:
                    t.write(file + '\n')
            else:
                print(f"{file} has a wiped certificate")
            xci.close()
            counter -= 1
            striplines(tfile, 1, True)
        except:
            try:
                with open(tfile2, "a", encoding='utf8') as t:
                    t.write("Error:" + file + '\n')
            except:
                pass
            counter -= 1
            striplines(tfile, 1, True)
    try:
        os.remove(tfile)
    except:
        pass
Exemple #8
0
def pararell(args, workers):
    from subprocess import call
    from time import sleep
    c = 0
    workers = int(workers)
    tfile = args.text_file
    args0 = args
    f = False
    filelist = listmanager.read_lines_to_list(tfile, all=True)
    if not args.findfile:
        items = listmanager.counter(args.text_file)
        index = 0
        process = list()
        while items != 0:
            if c == 0:
                c += 1
            else:
                #print("")
                pass

            from colorama import Fore
            colors = Fore.__dict__
            p = 0
            for r in range(workers):
                if index != items:
                    k = 0
                    l = p
                    for col in colors:
                        if l > len(colors):
                            l = l - len(colors)
                        color = colors[col]
                        if k == (l + 1):
                            break
                        else:
                            k += 1
                    #listmanager.printcurrent(tfile)
                    try:
                        f = filelist[index]
                    except:
                        break
                    tq = tqdm(leave=False, position=0)
                    #tq = tqdm(leave=False,position=0,bar_format="{l_bar}%s{bar}%s{r_bar}" % (color, color))
                    tq.write('Opening thread for ' + f)
                    tq.close()
                    tq = tqdm(total=1,
                              unit='|',
                              leave=True,
                              position=0,
                              bar_format="{l_bar}%s{bar}%s{r_bar}" %
                              (color, Fore.RESET))
                    tq.update(1)
                    tq.close()
                    opworkers = workers
                    if items < workers:
                        opworkers = items
                    arguments, nonevar = getargs(args,
                                                 separate_list=False,
                                                 current=f,
                                                 pos=p,
                                                 tothreads=opworkers)
                    #print(arguments)
                    f = False
                    args = args0
                    #print(arguments)
                    process.append(subprocess.Popen(arguments))
                    index += 1
                    p += 1

            for pr in process:
                #pr.wait()
                #call('clear' if os.name =='posix' else 'cls')
                # print(str(p.poll()))
                while pr.poll() == None:
                    sleep(3)
                    if os.name == 'posix':
                        call('clear')  #linux
                    else:
                        try:
                            call('cls')  #macos
                        except:
                            print("\n" * 100)
                            os.system('cls')  #windows
                    listmanager.counter(tfile, doprint=True)
                    p = 0
                    index2 = index - workers
                    for r in range(workers):
                        if index2 != items:
                            k = 0
                            l = p
                            for col in colors:
                                if l > len(colors):
                                    l = l - len(colors)
                                color = colors[col]
                                if k == (l + 1):
                                    break
                                else:
                                    k += 1
                            #listmanager.printcurrent(tfile)
                            try:
                                f = filelist[index2]
                            except:
                                break
                            tq = tqdm(leave=False, position=0)
                            # tq = tqdm(leave=False,position=0,bar_format="{l_bar}%s{bar}%s{r_bar}" % (color, color))
                            tq.write('Opening thread for ' + f)
                            tq.close()
                            tq = tqdm(total=1,
                                      unit='|',
                                      leave=True,
                                      position=0,
                                      bar_format="{l_bar}%s{bar}%s{r_bar}" %
                                      (color, Fore.RESET))
                            tq.update(1)
                            tq.close()
                            index2 += 1
                            p += 1
                    if pr.poll() != None:
                        pr.terminate()
            if os.name == 'posix':
                call('clear')  #linux
            else:
                try:
                    call('cls')  #macos
                except:
                    os.system('cls')  #windows
            listmanager.striplines(tfile, number=workers, counter=False)
            items -= workers
            if items < 0:
                items = 0
        return items
Exemple #9
0
def route(args, workers):
    arguments, tfile = getargs(args)
    #print(arguments)
    # print(tfile)
    if tfile == False:
        process = subprocess.Popen(arguments)
        while process.poll() == None and process2.poll() == None:
            if process.poll() != None:
                process.terminate()
            if process2.poll() != None:
                process2.terminate()
        #op,oe=process.communicate();#print (op);print (oe)
        #process.terminate();process2.terminate()
    else:
        filelist = listmanager.read_lines_to_list(tfile, number=workers)
        commands = list()
        i = 0
        #print(filelist)
        for allw in allowedlist:
            if allw in arguments:
                ind = arguments.index(allw)
                ind += 1
                break
        ind2 = False
        try:
            ind2 = arguments.index('--db_file')
            ind2 += 1
            sub_r = arguments[ind2]
        except:
            pass
        process = list()
        sub_r = arguments[ind2]
        c = 0
        if ind2 != False:
            if not os.path.isdir(sub_r) and not str(sub_r).endswith(
                    'all_DB.txt'):
                folder = os.path.dirname(os.path.abspath(sub_r))
                ruta = os.path.abspath(os.path.join(folder, "temp"))
            else:
                folder = os.path.dirname(os.path.abspath(sub_r))
                ruta = os.path.abspath(os.path.join(folder, "temp"))
            if not os.path.exists(ruta):
                os.makedirs(ruta)
        for f in filelist:
            arguments[ind] = f
            #print (arguments)
            if ind2 != False:
                if not os.path.isdir(sub_r) and not str(sub_r).endswith(
                        'all_DB.txt'):
                    fi = str(os.path.basename(
                        os.path.abspath(sub_r))) + '_' + str(c)
                    ruta2 = os.path.abspath(os.path.join(ruta, fi))
                    arguments[ind2] = ruta2
                    #print(ruta2)
                else:
                    ruta2 = os.path.abspath(os.path.join(ruta, str(c)))
                    if not os.path.exists(ruta2):
                        os.makedirs(ruta2)
                    fi = os.path.join(ruta2, 'all_DB.txt')
                    arguments[ind2] = fi
                    #print(arguments)
                c += 1
            process.append(subprocess.Popen(arguments))
            #print(process)
            #print(f)
        #print(len(process))
        for p in process:
            p.wait()
            # print(str(p.poll()))
            while p.poll() == None:
                if p.poll() != None:
                    p.terminate()

        if ind2 != False:
            if not os.path.isdir(sub_r) and not str(sub_r).endswith(
                    'all_DB.txt'):
                for i in range(int(workers - 1)):
                    fi = str(os.path.basename(
                        os.path.abspath(sub_r))) + '_' + str(i)
                    t = os.path.join(ruta, fi)
                    if os.path.exists(t):
                        with open(t, "r+", encoding='utf8') as filelist:
                            if not os.path.exists(sub_r):
                                with open(sub_r, "w", encoding='utf8') as dbt:
                                    for line in filelist:
                                        dbt.write(line)
                            else:
                                c = 0
                                with open(sub_r, "a", encoding='utf8') as dbt:
                                    for line in filelist:
                                        if not c == 0:
                                            dbt.write(line)
                                        c += 1
                    i += 1
                try:
                    os.remove(ruta)
                except BaseException as e:
                    Print.error('Exception: ' + str(e))
                    pass
            else:
                include = [
                    'extended_DB.txt', 'nutdb_DB.txt', 'keyless_DB.txt',
                    'simple_DB.txt'
                ]
                for i in range(int(workers - 1)):
                    for input in include:
                        ruta2 = os.path.abspath(os.path.join(ruta, str(i)))
                        t = os.path.join(ruta2, input)
                        t2 = os.path.join(folder, input)
                        # print(t)
                        # print(t2)
                        if os.path.exists(t):
                            with open(t, "r+", encoding='utf8') as filelist:
                                if not os.path.exists(t2):
                                    with open(t2, "w", encoding='utf8') as dbt:
                                        for line in filelist:
                                            dbt.write(line)
                                else:
                                    c = 0
                                    with open(t2, "a", encoding='utf8') as dbt:
                                        for line in filelist:
                                            if not c == 0:
                                                dbt.write(line)
                                            c += 1
                        i += 1
                    try:
                        os.remove(t)
                    except:
                        pass
                    try:
                        os.remove(ruta2)
                    except:
                        pass
        try:
            os.remove(ruta)
        except:
            pass

        listmanager.striplines(tfile, number=workers, counter=True)
def fichier_install(url,destiny="SD",ch_medium=True,ch_base=False,ch_other=False,installed_list=False):
	check_connection()
	if not os.path.exists(_1fichier_token):
		sys.exit("No 1fichier token setup")
	with open(_1fichier_token,'rt',encoding='utf8') as tfile:
		token=(tfile.readline().strip())
	if token==None:
		sys.exit("Missing 1fichier token")		
	APIkey=token
	auth={'Authorization':f'Bearer {APIkey}','Content-Type':'application/json'}
	session = requests.session()
	download_params = {
		'url' : url,
		'inline' : 0,
		'cdn' : 0,
		'restrict_ip':  0,
		'no_ssl' : 0,
	}			
	info_params={
		'url' : url	
	}
	r=session.post('https://api.1fichier.com/v1/file/info.cgi',json=info_params,headers=auth)
	info_dict=r.json()
	# print(info_dict)
	sz=info_dict['size']
	name=info_dict['filename']
	r=session.post('https://api.1fichier.com/v1/download/get_token.cgi',json=download_params,headers=auth)
	dict_=r.json()
	# print(dict_)
	ext=name.split('.')
	ext=ext[-1]
	if not name.endswith('nsp') and not name.endswith('nsz'):
		sys.exit(f"Extension not supported for direct instalation {ext} in {name}")			
	if not dict_['status']=="OK":
		sys.exit(f"API call returned {dict_['status']}")			
	URL=dict_['url']
	print("- Retrieving Space on device")
	SD_ds,SD_fs,NAND_ds,NAND_fs,FW,device=get_storage_info()
	print("- Calculating Installed size")	
	filesize=int(sz)
	if destiny=="SD":
		print(f"  * SD free space: {SD_fs} ({sq_tools.getSize(SD_fs)})")	
		print(f"  * File size: {filesize} ({sq_tools.getSize(filesize)})")		
		if filesize>SD_fs:
			if filesize<NAND_fs and ch_medium==True:
				print("  Not enough space on SD. Changing target to EMMC")
				print(f"  * EMMC free space: {NAND_fs} ({sq_tools.getSize(NAND_fs)})")						
				destiny="NAND"
			elif  ch_medium==False:	
				sys.exit("   NOT ENOUGH SPACE SD STORAGE")				
			else:
				sys.exit("   NOT ENOUGH SPACE ON DEVICE")				
	else:
		print(f"  * EMMC free space: {NAND_fs} ({sq_tools.getSize(NAND_fs)})")	
		print(f"  * File size: {filesize} ({sq_tools.getSize(filesize)})")		
		if filesize>NAND_fs:		
			if filesize<SD_fs and ch_medium==True:
				print("  Not enough space on EMMC. Changing target to SD")			
				print(f"  * SD free space: {SD_fs} ({sq_tools.getSize(SD_fs)})")					
				destiny="SD"
			elif  ch_medium==False:	
				sys.exit("   NOT ENOUGH SPACE EMMC STORAGE")							
			else:
				sys.exit("   NOT ENOUGH SPACE ON DEVICE")			
	if installed_list!=False:
		try:
			fileid,fileversion,cctag,nG,nU,nD,baseid=listmanager.parsetags(name)
			fileversion=int(fileversion)
			if fileid.endswith('000') and fileversion==0 and fileid in installed_list.keys() and ch_base==True:
				print("Base game already installed. Skipping...")
				return False	
			elif fileid.endswith('000') and fileid in installed_list.keys() and ch_other==True:
				updid=fileid[:-3]+'800'
				if fileversion>((installed_list[fileid])[2]):
					print("Asking DBI to delete previous content")
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])	
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();					
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",updid])		
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();					
				else:
					print("The update is a previous version than the installed on device.Skipping..")
					listmanager.striplines(tfile,counter=True)
					return False		
			elif ch_other==True	and fileid in installed_list.keys():
				if fileversion>((installed_list[fileid])[2]):
					print("Asking DBI to delete previous update")
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])					
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();
				else:
					print("The update is a previous version than the installed on device.Skipping..")
					listmanager.striplines(tfile,counter=True)
					return False	
		except:pass				
	process=subprocess.Popen([nscb_mtp,"fichierInstall","-ori",URL,"-dst",destiny,"-name",name,"-size",str(sz)])
	while process.poll()==None:
		if process.poll()!=None:
			process.terminate();		
def public_gdrive_install(filepath,destiny="SD",truecopy=True,outfolder=None,ch_medium=True,check_fw=True,patch_keygen=False,ch_base=False,ch_other=False,installed_list=False):
	check_connection()
	lib,TD,libpath=get_cache_lib()
	if lib==None:
		sys.exit(f"Google Drive Public Links are only supported via cache folder")	
	filename=addtodrive(filepath,truecopy=truecopy)
	ID,name,type,size,md5,remote=DrivePrivate.get_Data(filename,TD=TD,Print=False)	
	token=remote.access_token
	name=remote.name
	sz=remote.size
	URL='https://www.googleapis.com/drive/v3/files/'+remote.ID+'?alt=media'	
	ext=name.split('.')
	ext=ext[-1]
	if not name.endswith('nsp') and not name.endswith('nsz') and not  name.endswith('xci') and not name.endswith('xcz'):
		print(f"Extension not supported for direct instalation {ext} in {name}")
		return False
	print("- Retrieving Space on device")
	SD_ds,SD_fs,NAND_ds,NAND_fs,FW,device=get_storage_info()
	print("- Calculating Installed size")	
	filesize=int(sz)
	if destiny=="SD":
		print(f"  * SD free space: {SD_fs} ({sq_tools.getSize(SD_fs)})")	
		print(f"  * File size: {filesize} ({sq_tools.getSize(filesize)})")		
		if filesize>SD_fs:
			if filesize<NAND_fs and ch_medium==True:
				print("  Not enough space on SD. Changing target to EMMC")
				print(f"  * EMMC free space: {NAND_fs} ({sq_tools.getSize(NAND_fs)})")						
				destiny="NAND"
			elif  ch_medium==False:	
				sys.exit("   NOT ENOUGH SPACE SD STORAGE")				
			else:
				sys.exit("   NOT ENOUGH SPACE ON DEVICE")				
	else:
		print(f"  * EMMC free space: {NAND_fs} ({sq_tools.getSize(NAND_fs)})")	
		print(f"  * File size: {filesize} ({sq_tools.getSize(filesize)})")		
		if filesize>NAND_fs:		
			if filesize<SD_fs and ch_medium==True:
				print("  Not enough space on EMMC. Changing target to SD")			
				print(f"  * SD free space: {SD_fs} ({sq_tools.getSize(SD_fs)})")					
				destiny="SD"
			elif  ch_medium==False:	
				sys.exit("   NOT ENOUGH SPACE EMMC STORAGE")							
			else:
				sys.exit("   NOT ENOUGH SPACE ON DEVICE")
	kgwarning=False						
	if check_fw==True:	
		try:
			cnmtdata,files_list,remote=DriveTools.get_cnmt_data(file=remote)		
			keygeneration=int(cnmtdata['keygeneration'])
			if FW!='unknown':	
				try:
					FW_RSV,RRSV=sq_tools.transform_fw_string(FW)
					FW_kg=sq_tools.kg_by_RSV(FW_RSV)
				except BaseException as e:
					Print.error('Exception: ' + str(e))
					FW='unknown'
					FW_kg='unknown'
					pass
			if FW!='unknown' and FW_kg!='unknown':			
				if int(keygeneration)>int(FW_kg):
					kgwarning=True
					tgkg=int(FW_kg)
				else:
					tgkg=keygeneration
			else:
				tgkg=keygeneration
			print(f"- Console Firmware: {FW} ({FW_RSV}) - keygen {FW_kg})")		
			print(f"- File keygeneration: {keygeneration}")				
			if kgwarning==True:
				print("File requires a higher firmware. Skipping...")
				return False
		except:	
			print("Error getting cnmtdata from file")		
	if installed_list!=False:
		try:
			fileid,fileversion,cctag,nG,nU,nD,baseid=listmanager.parsetags(name)
			fileversion=int(fileversion)
			if fileid.endswith('000') and fileversion==0 and fileid in installed_list.keys() and ch_base==True:
				print("Base game already installed. Skipping...")
				return False	
			elif fileid.endswith('000') and fileid in installed_list.keys() and ch_other==True:
				updid=fileid[:-3]+'800'
				if fileversion>((installed_list[fileid])[2]):
					print("Asking DBI to delete previous content")
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])	
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();					
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",updid])		
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();					
				else:
					print("The update is a previous version than the installed on device.Skipping..")
					listmanager.striplines(tfile,counter=True)
					return False		
			elif ch_other==True	and fileid in installed_list.keys():
				if fileversion>((installed_list[fileid])[2]):
					print("Asking DBI to delete previous update")
					process=subprocess.Popen([nscb_mtp,"DeleteID","-ID",fileid])					
					while process.poll()==None:
						if process.poll()!=None:
							process.terminate();
				else:
					print("The update is a previous version than the installed on device.Skipping..")
					listmanager.striplines(tfile,counter=True)
					return False	
		except:pass			
	if name.endswith('xci') or name.endswith('xcz'):
		from mtpxci_remote import install_xci_csv
		install_xci_csv(remote=remote,destiny=destiny,cachefolder=outfolder)
	else:			
		process=subprocess.Popen([nscb_mtp,"DriveInstall","-ori",URL,"-dst",destiny,"-name",name,"-size",sz,"-tk",token])
		while process.poll()==None:
			if process.poll()!=None:
				process.terminate();