Ejemplo n.º 1
0
        public AppInfoBean addWQAd(string folder, AppInfoBean appInfo)
        {
            string fromDirRes = Path.Combine(wqFolder, "drawable");
            string fromDirCom = Path.Combine(wqFolder, "com");

            string toDirBin = Path.Combine(folder, "res\\drawable");
            string toDirCom = Path.Combine(folder, "smali\\com");
            FileUtil.CopyDir(fromDirRes, toDirBin);
            FileUtil.CopyDir(fromDirCom, toDirCom);

            string xmlFile = Path.Combine(folder, "AndroidManifest.xml");

            if (File.Exists(xmlFile))
            {
                addToXml(xmlFile);
            }
            else
            {
                MessageBox.Show("文件不存在:" + xmlFile);
                return null;
            }

            //添加public中的drawableValue
            string publicXmlFile = Path.Combine(folder, "res\\values\\public.xml");

            if (File.Exists(publicXmlFile))
            {
                imageId = addToPublicXml(publicXmlFile);
            }
            else
            {
                MessageBox.Show("文件不存在:" + publicXmlFile);
                return null;
            }

            // 添加OpenWall.smali

            addOpenWallSmali(appInfo, wqFolder, folder);

            // 修改入口smali
            string subFolderStr = Path.Combine("smali", appInfo.Activity.Replace(".", "\\") + ".smali");
            string smaliFile = Path.Combine(folder, subFolderStr);
            string activityStr = appInfo.Activity.Replace(".", "/");

            if (File.Exists(smaliFile))
            {
                addToSmali(smaliFile, activityStr);
                FileUtil.replaceString(smaliFile, "com/java/test/TestActivity", activityStr);
            }
            else
            {
                MessageBox.Show("文件不存在:" + smaliFile);
                return null;
            }

            return appInfo;
        }
Ejemplo n.º 2
0
        public AppInfoBean addVGaoAd(string folder, AppInfoBean appInfo)
        {
            string fromDirAssets = Path.Combine(vgaoFolder, "assets");
            string fromDirCom = Path.Combine(vgaoFolder, "com");

            string toDirBin = Path.Combine(folder, "assets");
            string toDirCom = Path.Combine(folder, "smali\\com");
            FileUtil.CopyDir(fromDirAssets, toDirBin);
            FileUtil.CopyDir(fromDirCom, toDirCom);

            string xmlFile = Path.Combine(folder, "AndroidManifest.xml");

            if (File.Exists(xmlFile))
            {
                addToXml(xmlFile);
            }
            else
            {
                MessageBox.Show("文件不存在:" + xmlFile);
                return null;
            }
            string subFolderStr = Path.Combine("smali", appInfo.Activity.Replace(".", "\\") + ".smali");
            string smaliFile = Path.Combine(folder, subFolderStr);
            string activityStr = appInfo.Activity.Replace(".", "/");

            if (File.Exists(smaliFile))
            {
                addToSmali(smaliFile, activityStr);
            }
            else
            {
                MessageBox.Show("文件不存在:" + smaliFile);
                return null;
            }

            return appInfo;
        }
Ejemplo n.º 3
0
        private void addOpenWallSmali(AppInfoBean appInfo, string wqFolder, string folder)
        {
            string activity = appInfo.Activity;

            string smaliFolder = Path.Combine("smali", activity.Substring(0, activity.LastIndexOf(".") + 1).Replace(".", "\\"));
            string fromFile = Path.Combine(wqFolder, "TestActivity$OpenWall.smali");
            string toFileFolder = Path.Combine(folder, smaliFolder);

            string toFile = Path.Combine(toFileFolder, appInfo.EntryName + "$OpenWall.smali");

            File.Copy(fromFile, toFile);

            FileUtil.replaceString(toFile, "TestActivity", appInfo.EntryName);

            string activityStr = appInfo.Activity.Replace(".", "/");
            FileUtil.replaceString(toFile, "com/java/test/" + appInfo.EntryName, activityStr);
        }
Ejemplo n.º 4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            workPath = tbFolder.Text;
            workingApk = Path.Combine(workPath, "Working_APK");

            unpackApp();

            DirectoryInfo theFolder = new DirectoryInfo(workingApk);
            foreach (DirectoryInfo NextFolder in theFolder.GetDirectories())
            {
                string xmlFile = Path.Combine(NextFolder.FullName, "AndroidManifest.xml");
                AppInfoBean appInfo = new AppInfoBean(xmlFile);
                if (appInfo.Activity == null || appInfo.Activity.Equals(""))
                {
                    MessageBox.Show("无法获取APP信息。");
                    return;
                }
                // 添加V告
                if (cbVGaoAdd.Checked)
                {
                    VGaoAd vgao = new VGaoAd(workPath);
                    vgao.addVGaoAd(NextFolder.FullName, appInfo);
                }
                // 添加酷果
                if (cbKuGuoAdd.Checked)
                {
                    KuGuoAd kuguo = new KuGuoAd(workPath);
                    kuguo.addKuGuoAd(NextFolder.FullName, appInfo);
                }
                // 添加帷千
                if (cbWQAdd.Checked)
                {
                    WQAd wq = new WQAd(workPath);
                    wq.addWQAd(NextFolder.FullName, appInfo);
                }

                // 替换V告包名
                if (cbReVGao.Checked)
                {
                    replacePackageName(NextFolder.FullName, "com.va.", tbVGaoTargStr.Text);
                }
                // 替换酷果包名
                if (cbReKuguo.Checked)
                {
                    replacePackageName(NextFolder.FullName, "com.kuguo.demo.ChildOfMain", tbKuguoTargStr.Text);
                }
                //// 替换帷千包名
                //if (cbReWQ.Checked)
                //{
                //    replacePackageName(NextFolder.FullName, "com.wqmobile.", tbWqTargStr.Text);
                //}
                // 替换游戏包名
                if (cbReGame.Checked)
                {
                    string oldPackage = appInfo.Package;
                    string[] packageStrArray = oldPackage.Split('.');

                    packageStrArray[1] = tbPackageAddStr.Text;

                    string newPackage = String.Join(".", packageStrArray);
                    replacePackageName(NextFolder.FullName, oldPackage, newPackage);
                }
            }

            repackApp();

            //MessageBox.Show("任务已完成,测试你的游戏吧。");
        }
Ejemplo n.º 5
0
        private void btnReplaceID_Click(object sender, EventArgs e)
        {
            workPath = tbFolder.Text;
            workingApk = Path.Combine(workPath, "Working_APK");
            string apkFolder = Path.Combine(workingApk, "_" + tbApkName.Text);

            string xmlFile = Path.Combine(apkFolder, "AndroidManifest.xml");

            string oldVID = "0123456789abcdef";
            string oldCooId = "f946b3d4086249a6968aabec7c752027";

            if (!File.Exists(xmlFile))
            {
                MessageBox.Show("文件不存在:" + xmlFile);
                return;
            }

            FileUtil.replaceString(xmlFile, oldVID, tbVGaoID.Text);

            FileUtil.replaceString(xmlFile, oldCooId, tbKuguoID.Text);

            AppInfoBean appInfo = new AppInfoBean(xmlFile);
            if (appInfo.Activity == null || appInfo.Activity.Equals(""))
            {
                MessageBox.Show("无法获取APP信息。");
                return;
            }

            string smaliFolder = Path.Combine(apkFolder,"smali");
            DirectoryInfo smaliDir = new DirectoryInfo(smaliFolder);
            FileInfo[] smaliFiles = smaliDir.GetFiles(appInfo.EntryName + ".smali", SearchOption.AllDirectories);

            foreach (FileInfo file in smaliFiles)
            {
                string smaliFile = file.FullName;

                FileUtil.replaceString(smaliFile, oldVID, tbVGaoID.Text);

                FileUtil.replaceString(smaliFile, oldCooId, tbKuguoID.Text);
            }

            repackApp();
        }