Ejemplo n.º 1
0
        private void Btn_CheckProtect(object sender, EventArgs e)
        {
            var text = this.open_path.Text;

            if (!File.Exists(text) || Path.GetExtension(text) != ".apk")
            {
                MessageBox.Show(Resources.no_find_apk, Resources.info);
                return;
            }

            //var cmd = Util.GetPackage(text);
            const string sel = @"classes.dex";

            new Thread(() =>
            {
                var zip  = new ZipFile(text);
                var file = zip.SelectEntries(sel, @"\");

                if (file.Count <= 0)
                {
                    return;
                }
                //这个文件存在!
                Stream decompressedStream = new MemoryStream();
                //解压文件 也可以直接使用上面的 file 来操作
                zip[sel].Extract(decompressedStream);
                decompressedStream.Position = 0;
                var reader = new StreamReader(decompressedStream);
                var dex    = reader.ReadToEnd();
                MessageBox.Show(CheckProtect.checkProtect(dex), Resources.info);
            }).Start();
        }
Ejemplo n.º 2
0
        private void Btn_CheckProtect(object sender, EventArgs e)
        {
            var text = this.textBox_path.Text;

            if (!File.Exists(text) || Path.GetExtension(text) != ".apk")
            {
                MessageBox.Show(Resources.no_find_apk, Resources.info);
                return;
            }
            var result = "未知";
            //var cmd = Util.GetPackage(text);
            var sel = @"classes.dex";

            new Thread(() =>
            {
                // result = CheckProtect.Start(text);
                //  Excute(ExcuteCmd, cmd, false);
                var zip  = new ZipFile(text);
                var file = zip.SelectEntries(sel, @"\");

                if (file.Count > 0)
                {
                    //这个文件存在!
                    Stream decompressedStream = new MemoryStream();
                    //解压文件 也可以直接使用上面的 file 来操作
                    zip[sel].Extract(decompressedStream);
                    decompressedStream.Position = 0;
                    var reader = new StreamReader(decompressedStream);
                    var dex    = reader.ReadToEnd();
                    MessageBox.Show(CheckProtect.checkProtect(dex), "提示");


                    //myfile.txt为取出的文件文本
                }


                //  MessageBox.Show(result);
            }).Start();
        }