Exemplo n.º 1
0
        private async Task Decode_Manifest()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetBundleToolPath(),
                Arguments = "dump manifest --bundle=\"" + targetFilePath.OriginalString + "\""
            };

            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            while (!processResult.StartsWith("<"))
            {
                if (string.IsNullOrEmpty(processResult))
                {
                    break;
                }
                var lines = processResult.Split(new string[] { "\r\n" }, StringSplitOptions.None).Skip(1);
                processResult = string.Join(Environment.NewLine, lines.ToArray());
            }
            processResult = processResult.Trim();
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), result=" + processResult);

            dataModel.RawDumpBadging = processResult;
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), start read manifest");
            DesktopCMDAABUtil.ReadManifest(dataModel, dataModel.RawDumpBadging);
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), end read manifest");
        }
Exemplo n.º 2
0
        private async Task Decode_AppIconEntry()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetBundleToolPath(),
                Arguments = "dump resources --bundle=\"" + targetFilePath.OriginalString
                            + "\" --resource=\"" + dataModel.AppIconResourceEntry + "\" --values=true"
            };

            Debug.WriteLine("DefaultAABDecoder.Decode_AppIconEntry(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            while (!processResult.StartsWith("Package"))
            {
                if (string.IsNullOrEmpty(processResult))
                {
                    break;
                }
                var lines = processResult.Split(new[] { "\r\n" }, StringSplitOptions.None).Skip(1);
                processResult = string.Join(Environment.NewLine, lines.ToArray());
            }
            processResult = processResult.Trim();
            Debug.WriteLine("DefaultAABDecoder.Decode_AppIconEntry(), result=" + processResult);

            DesktopCMDAABUtil.ReadAppIconEntry(dataModel, processResult);
        }
Exemplo n.º 3
0
        private async Task Decode_Badging()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetAAPTPath(),
                Arguments = " d badging \"" + targetFilePath.OriginalString + "\""
            };

            Debug.WriteLine("DefaultAPKDecoder.Decode_Badging(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            dataModel.RawDumpBadging = processResult;
            DesktopCMDAAPTUtil.ReadBadging(dataModel, dataModel.RawDumpBadging);
        }
Exemplo n.º 4
0
        public async Task InstallApk(Uri fileUri)
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetADBPath(),
                Arguments = " install -r \"" + fileUri.OriginalString + "\""
            };
            string processResult = await ProcessExecuter.ExecuteProcess(psi, true);

            string[] resultArray = processResult?.Split(
                new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            if (resultArray != null)
            {
                processResult = resultArray[resultArray.Length - 1];
            }

            installFinishedEvent?.Invoke(true, processResult);
        }
Exemplo n.º 5
0
        public static async Task TestJavaExist()
        {
            string processResult = string.Empty;

            if (!javaTested)
            {
                // java -jar apksigner.jar verify --verbose --print-certs FDroid.apk
                // java -version

                ProcessStartInfo psiJavaVersion = new ProcessStartInfo()
                {
                    FileName  = "cmd.exe",
                    Arguments = "/c java -version"
                };
                processResult = await ProcessExecuter.ExecuteProcess(psiJavaVersion, true);

                SetJavaExist(processResult);
            }
        }
Exemplo n.º 6
0
        private async Task Decode_Signature()
        {
            await DesktopJavaUtil.TestJavaExist();

            if (!DesktopJavaUtil.javaExist)
            {
                dataModel.Signature = LocalizationCenter.currentDataModel.Msg_JavaNotFound_APKSignFail;
                return;
            }

            ProcessStartInfo psiAPKSigner = new ProcessStartInfo
            {
                FileName  = "java",
                Arguments = "-jar " + pathProvider.GetAPKSignerPath() +
                            " verify --verbose --print-certs" +
                            " \"" + targetFilePath.OriginalString + "\"",
            };
            string processResult = await ProcessExecuter.ExecuteProcess(psiAPKSigner, false, false);

            dataModel.RawDumpSignature = processResult;
            DesktopCMDAPKSignerUtil.ReadAPKSignature(dataModel, processResult);
        }