Exemple #1
0
def decryptAndExtractAPICloudApkResources(resourcePath,saveTo,printLog=False):
    if not os.path.isdir(resourcePath):
        print(determineSavePath(resourcePath,saveTo))
        return {resourcePath:uzm_util.decryptAllResourcesInApkParallel(resourcePath,determineSavePath(resourcePath,saveTo),printLog)} 

    msgQueue = multiprocessing.Manager().Queue(0)
    procPool = multiprocessing.Pool(processes=max(2, multiprocessing.cpu_count() ) ) 
    
    startTime = time.time()
    apkInfoMap = _scanAPICloudApks(procPool,msgQueue,resourcePath,False,printLog=printLog)
    scanCost = time.time()-startTime
    if not apkInfoMap:
        if printLog:
            print('no apicloud apk found')
        return {}
    
    if printLog:
        print('{} seconds elapsed.  {} apks found'.format(scanCost,len(apkInfoMap)))
    
    if len(apkInfoMap)<2:
        apkFile = list(apkInfoMap.keys())[0]
        decryptMap = {apkFile:(determineSavePath(apkFile,saveTo),uzm_util.decryptAllResourcesInApkParallel(apkFile,saveTo,printLog,procPool,msgQueue))} 
    else:
        decryptMap = _decryptAPICloudApks(procPool,msgQueue,apkInfoMap,saveTo,printLog)

    try:
        procPool.close()
        procPool.join()
    except:pass

    return decryptMap
def _decryptAPICloudApkResourcesParallel(apkFilePath,
                                         saveTo,
                                         procPool=None,
                                         msgQueue=None,
                                         printLog=False):
    decMap = uzm_util.decryptAllResourcesInApkParallel(apkFilePath,
                                                       saveTo,
                                                       printLog,
                                                       procPool=procPool)
    if msgQueue:
        msgQueue.put_nowait((apkFilePath, saveTo, decMap))
    return apkFilePath, saveTo, decMap
Exemple #3
0
def _decryptAPICloudApks(procPool,msgQueue,apkInfoMap,saveTo,printLog=False):
 
    totalApks = len(apkInfoMap)
    decApkMap = {}
    for apkPath,apkInfo in apkInfoMap.items():
        if printLog:
            print(apkPath)
        saveApkPath = determineSavePath(apkPath,saveTo)
        decMap = uzm_util.decryptAllResourcesInApkParallel(apkPath,saveApkPath,printLog,procPool=procPool,msgQueue=msgQueue)
        decApkMap[apkPath] = (saveApkPath,decMap)
        if printLog:
            print('\t=>{}'.format(saveApkPath))
            print('\t{} files decrypted.'.format(len(decMap)))
            print('\n')
    return decApkMap