From 6637bfe422e0e8950830e32779c97a9ea9126815 Mon Sep 17 00:00:00 2001
From: Yutousama <583819556@qq.com>
Date: Wed, 18 Mar 2020 17:10:43 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=87=AA=E5=8A=A8=E6=89=93?=
=?UTF-8?q?=E5=8C=85=E7=A8=8B=E5=BA=8F=EF=BC=88=E5=9F=BA=E6=9C=AC=E6=AD=A3?=
=?UTF-8?q?=E5=B8=B8=EF=BC=89=EF=BC=8C=E7=BC=BA=E5=B0=91UI=E7=95=8C?=
=?UTF-8?q?=E9=9D=A2=20=E7=A9=BF=E5=B1=B1=E7=94=B2=E6=89=93=E5=8C=85?=
=?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=96=B0=E5=A2=9E=E9=80=89=E6=8B=A9=E6=98=AF?=
=?UTF-8?q?=E5=90=A6=E7=94=A8=E5=BA=94=E7=94=A8=E5=8C=85=E5=90=8D=E9=80=89?=
=?UTF-8?q?=E9=A1=B9=20=E7=A9=BF=E5=B1=B1=E7=94=B2=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E5=90=8C=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ad_config.cfg | 56 +++++++++++++++++++++++----
src/com/qy/ui/ChuanShanJiaUi.form | 9 +++++
src/com/qy/ui/ChuanShanJiaUi.java | 2 +
src/com/qy/utils/AutoPackageSDK.java | 32 ++++++++-------
src/com/qy/utils/AutoRandomAdSDK.java | 44 ++++++++++++---------
src/com/qy/utils/CsjTools.java | 28 +++++++++-----
src/com/qy/utils/Tools.java | 8 ++--
7 files changed, 125 insertions(+), 54 deletions(-)
diff --git a/ad_config.cfg b/ad_config.cfg
index 47f43a8..55841b0 100644
--- a/ad_config.cfg
+++ b/ad_config.cfg
@@ -160,8 +160,18 @@
" ",
" ",
" ",
- " ",
- ""
+ " ",
+ "",
+
+ "",
+ "",
+ " ",
+ "",
+ "",
+ "",
+ "",
+ "",
+
],
"class":[
"com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity",
@@ -175,13 +185,20 @@
"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService",
"com.bytedance.embedapplog.collector.Collector",
"com.bytedance.tea.crash.upload.CrashUploadService",
- "com.bytedance.sdk.openadsdk.activity.TTBaseVideoActivity"
+ "com.bytedance.sdk.openadsdk.activity.TTBaseVideoActivity",
+ "com.ss.android.socialbase.downloader.notification.DownloadNotificationService",
+ "com.ss.android.socialbase.downloader.downloader.DownloadService",
+ "com.ss.android.socialbase.downloader.downloader.IndependentProcessDownloadService",
+ "com.ss.android.socialbase.downloader.impls.DownloadHandleService",
+ "com.ss.android.socialbase.appdownloader.DownloadHandlerService",
+ "com.ss.android.socialbase.appdownloader.view.DownloadSizeLimitActivity",
+ "com.ss.android.socialbase.appdownloader.view.DownloadTaskDeleteActivity",
+ "com.ss.android.downloadlib.activity.TTDelegateActivity"
],
"random":[
"com",
"ww",
"za",
- "csc"
],
"isAllPackage":false,
"isReName":true,
@@ -196,6 +213,21 @@
"data":" const-string v1, \".fileprovider\"\n",
"end":" invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;",
"msg":"把TTFileProvider改成fileprovider"
+ },{
+ "class":"com.bytedance.embedapplog.util.TTEncryptUtils",
+ "find":"const-string v0, \"tobEmbedEncrypt\"",
+ "data":"const-string v0, \"tob\"\n",
+ "end":"invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V"
+ },{
+ "class":"com.pgl.sys.ces.a",
+ "find":"const-string v0, \"nms\"",
+ "data":"const-string v0, \"hms\"\n",
+ "end":"invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V"
+ },{
+ "class":"com.pgl.sys.ces.b",
+ "find":"const-string p1, \"nms\"",
+ "data":"const-string p1, \"hms\"\n",
+ "end":"invoke-static {p0, p1}, Lcom/pgl/a/b/e;->a(Landroid/content/Context;Ljava/lang/String;)Z"
}
],
"rename":{
@@ -208,9 +240,19 @@
"TTFullScreenExpressVideoActivity":"{>+/activity}TTFullScreenExpressVideoActivity",
"TTDelegateActivity":"{>+/activity}TTDelegateActivity",
"TTBaseVideoActivity":"{>+/activity}TTBaseVideoActivity",
- "BinderPoolService":"BinderPoolService",
- "Collector":"Collector",
- "CrashUploadService":"CrashUploadService"
+ "BinderPoolService":"{>+/multipro/aidl}BinderPoolService",
+ "Collector":"{>+/cc/collector}Collector",
+ "CrashUploadService":"{>+/cc/crash/upload}CrashUploadService",
+ "com.ss.android.downloadlib.activity.TTDelegateActivity":"{>+/dl/activity}TTDelegateActivity",
+ "DownloadNotificationService":"{>+/sb/downloader/notification}DownloadNotificationService",
+ "DownloadService":"{>+/sb/downloader/downloader}DownloadService",
+ "IndependentProcessDownloadService":"{>+/sb/downloader/downloader}IndependentProcessDownloadService",
+ "DownloadHandleService":"{>+/sb/downloader/impls}DownloadHandleService",
+ "DownloadHandlerService":"{>+/sb/appdownloader}DownloadHandlerService",
+ "DownloadSizeLimitActivity":"{>+/sb/appdownloader/view}DownloadSizeLimitActivity",
+ "DownloadTaskDeleteActivity":"{>+/sb/appdownloader/view}DownloadTaskDeleteActivity",
+ "DownloadReceiver":"{>+/dl/core/download}DownloadReceiver",
+
},
"filter":[
"com.android",
diff --git a/src/com/qy/ui/ChuanShanJiaUi.form b/src/com/qy/ui/ChuanShanJiaUi.form
index b00764a..a9faeea 100644
--- a/src/com/qy/ui/ChuanShanJiaUi.form
+++ b/src/com/qy/ui/ChuanShanJiaUi.form
@@ -103,6 +103,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/com/qy/ui/ChuanShanJiaUi.java b/src/com/qy/ui/ChuanShanJiaUi.java
index b67238d..70ebef3 100644
--- a/src/com/qy/ui/ChuanShanJiaUi.java
+++ b/src/com/qy/ui/ChuanShanJiaUi.java
@@ -14,6 +14,7 @@ public class ChuanShanJiaUi {
private JPanel mainPanel;
private JButton selectButton;
private JTextArea log;
+ private JCheckBox useAppPackageName;
public ChuanShanJiaUi() {
selectButton.addActionListener(new ActionListener() {
@@ -38,6 +39,7 @@ public class ChuanShanJiaUi {
@Override
public void run() {
CsjTools tools=new CsjTools();
+ tools.setUserPackageName(useAppPackageName.isSelected());
tools.build(csjDemo.getAbsolutePath(), apkFile.getAbsolutePath(), new SmaliApkToolsPath() {
@Override
public void smaliPath(String path) {
diff --git a/src/com/qy/utils/AutoPackageSDK.java b/src/com/qy/utils/AutoPackageSDK.java
index c408a52..db0bf78 100644
--- a/src/com/qy/utils/AutoPackageSDK.java
+++ b/src/com/qy/utils/AutoPackageSDK.java
@@ -72,6 +72,9 @@ public class AutoPackageSDK {
}
+ outAssetsQY(0, "0");
+ outAssetsQY(1, "4");
+ outRes();
new AutoRandomAdSDK(array, new SmaliApkToolsPath() {
@Override
public void smaliPath(String path) {
@@ -79,11 +82,7 @@ public class AutoPackageSDK {
delete(gdtPath,gdtsdk);
delete(unplayPath,uniplaysdk);
delete(qysdkPath,qysdk);
-
outAssetsADS(path);
- outAssetsQY(0, "0");
- outAssetsQY(1, "4");
- outRes();
copy();
zip();
System.out.println("制作SDK完成");
@@ -97,6 +96,7 @@ public class AutoPackageSDK {
}
});
+
}
private void outAssetsQY(int index, String type) {
@@ -183,21 +183,22 @@ public class AutoPackageSDK {
e.printStackTrace();
}
}
- private void zip(File file,OutputStream stream) throws Exception {
+ private void zip(File file) throws Exception {
+ String cd = "cd " + new File("packageSDK").getAbsolutePath();
File sdk = new File("packageSDK" + File.separator + "sdk.aar");
File files=new File("packageSDK");
String aapt=new File("aapt.exe").exists()?new File("aapt.exe").getAbsolutePath():"aapt";
for (File listFile : file.listFiles()) {
if(listFile.isDirectory()){
- zip(listFile,stream);
+ zip(listFile);
}else if(!listFile.getName().equals("sdk.aar")){
String path=listFile.getAbsolutePath().replace(files.getAbsolutePath(),"");
String exec=aapt+" r "+sdk.getAbsolutePath()+" "+path.substring(1)+"\n";
- stream.write(exec.getBytes());
- stream.flush();
+ Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
+ Thread.sleep(100);
exec =aapt+ " a " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
- stream.write(exec.getBytes());
- stream.flush();
+ Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
+ Thread.sleep(100);
}
}
@@ -206,17 +207,20 @@ public class AutoPackageSDK {
try {
Tools.copyFile(new File("input" + File.separator + "Documents" + File.separator + "sdk.aar").getAbsolutePath(),
new File("packageSDK").getAbsolutePath(), true);
- String cd = "cd " + new File("packageSDK").getAbsolutePath() + "\n";
+ String cd = "cd " + new File("packageSDK").getAbsolutePath() + "\n\r";
Process process=Runtime.getRuntime().exec(new String[]{"cmd"});
OutputStream stream =process.getOutputStream();
stream.write(cd.getBytes());
stream.flush();
- zip(new File("packageSDK"),stream);
+ stream.close();
+ process.destroy();
+ zip(new File("packageSDK"));
File copy=new File("packageSDK"+File.separator+"copy");
if(copy.exists()){
- zip(copy,stream);
+ zip(copy);
}
stream.close();
+ process.destroy();
} catch (Exception e) {
e.printStackTrace();
}
@@ -238,6 +242,6 @@ public class AutoPackageSDK {
public void smaliPath(String path) {
//com.tanggttaxc.langtt.mi
}
- }, "5700", a==0?"com.luckyboy.mmxing":"danxian.popstar");
+ }, "5700", a==0?"com.luckyboy.mmxing":"com.prujwk.jdyphn");
}
}
diff --git a/src/com/qy/utils/AutoRandomAdSDK.java b/src/com/qy/utils/AutoRandomAdSDK.java
index addee25..aa82341 100644
--- a/src/com/qy/utils/AutoRandomAdSDK.java
+++ b/src/com/qy/utils/AutoRandomAdSDK.java
@@ -212,7 +212,6 @@ public class AutoRandomAdSDK {
for (String str : packagename.split("\\.")) {
array.put(str);
}
- array.put("csc");
config.put("random", array);
rootPath = path;
sdktype = "13";
@@ -255,7 +254,6 @@ public class AutoRandomAdSDK {
array.put(manifest.getString(i).replace(key, newManifest.replace(".smali", "")));
} catch (Exception e) {
// TODO: handle exception
- e.printStackTrace();
//System.out.println("-------->" + adClass.size());
for (String keys : adClass.keySet()) {
//System.out.println(keys + " " + adClass.get(keys));
@@ -276,7 +274,7 @@ public class AutoRandomAdSDK {
writer.flush();
}
writer.close();
- } catch (FileNotFoundException e) {
+ } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -380,7 +378,7 @@ public class AutoRandomAdSDK {
writer.write(buffer.toString());
writer.flush();
writer.close();
- out();
+
reader.close();
// Desktop.getDesktop().open(file);
} catch (IOException e) {
@@ -404,6 +402,7 @@ public class AutoRandomAdSDK {
}
}
+ out();
}
private void show(File file) {
@@ -503,9 +502,9 @@ public class AutoRandomAdSDK {
}
- for (String key : nowAdClass.keySet()) {
+ /* for (String key : nowAdClass.keySet()) {
System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
- }
+ }*/
for (String key : adClass.keySet()) {
File file = new File(adClass.get(key).getAbsolutePath());
String fileName = file.getName().replace(".smali", "");
@@ -513,8 +512,8 @@ public class AutoRandomAdSDK {
if (!config.getBoolean("isAllPackage")) {
filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
}
- System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
- // System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
+ //System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
+ //System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
if (filePath.listFiles() == null) {
//System.out.println("filePath为空:" + filePath.getAbsolutePath());
//System.out.println(file.getAbsolutePath());
@@ -529,10 +528,10 @@ public class AutoRandomAdSDK {
continue;
}
- String nName = getNewName(fs.getName());
- if (fs.getName().startsWith(fileName + "$")) {
- if (getNewName(fs.getName()).endsWith("[notmover]")) {
- Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
+ String nName = getNewName(fs.getAbsolutePath());
+ if (fs.getName().startsWith(fileName.split("\\$")[0] + "$")) {
+ if (getNewName(fs.getAbsolutePath()).endsWith("[notmover]")) {
+ Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
.getName().replace(fs.getName().split("\\$")[0], nName), true);
} else {
moveFile(fs, key, fs.getName().replace(fs.getName().split("\\$")[0], nName), false);
@@ -543,9 +542,9 @@ public class AutoRandomAdSDK {
if (getNewNameForSrc(file.getName()).endsWith("[notmover]")) {
nowAdFile.put(key, file.getAbsolutePath());
Tools.copyFileToName(file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), ""),
- getNewName(file.getName()) + ".smali", true);
+ getNewName(file.getAbsolutePath()) + ".smali", true);
} else {
- moveFile(file, key, getNewName(file.getName()) + ".smali", true);
+ moveFile(file, key, getNewName(file.getAbsolutePath()) + ".smali", true);
}
file.delete();
@@ -561,10 +560,10 @@ public class AutoRandomAdSDK {
moveFile(file, key);
} else {
if (file.getName().startsWith("TMProvider")) {
- //System.out.println("移动文件:" + file.getName() + " -> " + getNewName(file.getName()) + " | " + fileName);
+ //System.out.println("移动文件:" + file.getName() + " -> " + getNewName(file.getAbsolutePath()) + " | " + fileName);
}
// //System.out.println("移动文件:"+path.getName()+" -> "+getNewName(path.getName()));
- moveFile(file, key, getNewName(path.getName()) + ".smali", false);
+ moveFile(file, key, getNewName(path.getAbsolutePath()) + ".smali", false);
}
}
}
@@ -597,7 +596,7 @@ public class AutoRandomAdSDK {
boolean t = Tools.copyFileToName(file.getAbsolutePath(), path,
nName, true);
file.delete();
- ////System.out.println("移动文件:" + file.getAbsolutePath() + " 到" + path + " 重命名为:" + nName + " 结果" + t);
+ //System.err.println("移动文件:" + file.getAbsolutePath() + " 到" + path + " 重命名为:" + nName + " 结果" + t);
}
private void allpackage(File file, String packge) {
@@ -612,7 +611,7 @@ public class AutoRandomAdSDK {
}
}
- //穿山甲视频会闪退
+
private void movesdk(File path, String toPath) {
for (File file : path.listFiles()) {
if (file.getName().equals("BuildConfig.smali")) {
@@ -670,10 +669,16 @@ public class AutoRandomAdSDK {
}
private String getNewName(String name) {
- String nName = getNewNameForSrc(name);
+ File file=new File(name);
+ String packageName=file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator,"").replace(file.getName(),"");
+ String nName = getNewNameForSrc(packageName.replace(File.separator,".")+file.getName());
+ if(nName.equals(packageName.replace(File.separator,".")+file.getName().replace(".smali",""))){
+ nName=getNewNameForSrc(file.getName());
+ }
if (nName.endsWith("[notmover]")) {
nName = nName.replace("[notmover]", "");
}
+
return nName;
}
@@ -685,6 +690,7 @@ public class AutoRandomAdSDK {
String tmpName;
String wName = null;
name = name.replace(".smali", "");
+
if (name.contains("$")) {
tmpName = name.split("$")[0];
for (String t : name.split("$")) {
diff --git a/src/com/qy/utils/CsjTools.java b/src/com/qy/utils/CsjTools.java
index cb17050..f0ed9e8 100644
--- a/src/com/qy/utils/CsjTools.java
+++ b/src/com/qy/utils/CsjTools.java
@@ -66,14 +66,21 @@ public class CsjTools {
}
return null;
}
-
+ private boolean isAppPackageName =false;
+ public void setUserPackageName(boolean isAppPackageName){
+ this.isAppPackageName=isAppPackageName;
+ }
private String getPackageName() {
try {
- File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
- BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
- String tmp = reader.readLine();
- reader.close();
- return getXMLValue("package", tmp);
+ if(isAppPackageName) {
+ File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
+ BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
+ String tmp = reader.readLine();
+ reader.close();
+ return getXMLValue("package", tmp);
+ }else{
+ return "com.prujwk.jdyphn";
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -240,15 +247,18 @@ public class CsjTools {
_log = log;
unPackageCSJ = false;
File csjFile = new File(csjPath);
- if (new File(csjFile.getName().replace(".apk", "")).exists()) {
+ //由于改成动态SDK,所以每个应用都要单独打包
+ /*if (new File(csjFile.getName().replace(".apk", "")).exists()) {
System.out.println(">?>>" + new File(csjFile.getName().replace(".apk", "")).getAbsolutePath());
unPackageCSJ = true;
csj_Path = new File(csjFile.getName().replace(".apk", "")).getAbsolutePath();
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
- }
+ }*/
SmaliUtils utils = new SmaliUtils();
- // Tools.deleteFiles(new File("").getAbsolutePath() + File.separator + new File(csjPath).getName().replace(".apk", File.separator));
+ Tools.deleteFiles(new File("").getAbsolutePath() + File.separator + new File(csjPath).getName().replace(".apk", File.separator));
Tools.deleteFiles(new File("").getAbsolutePath() + File.separator + new File(apkPath).getName().replace(".apk", File.separator));
+
+
new Thread(new Runnable() {
@Override
public void run() {
diff --git a/src/com/qy/utils/Tools.java b/src/com/qy/utils/Tools.java
index 2415a35..0b7e625 100755
--- a/src/com/qy/utils/Tools.java
+++ b/src/com/qy/utils/Tools.java
@@ -55,9 +55,10 @@ public class Tools {
File srcFile = new File(srcFileName);
// 判断源文件是否存在
if (!srcFile.exists()) {
-
+ System.err.println("源文件不存在:"+srcFile.getAbsolutePath());
return false;
} else if (!srcFile.isFile()) {
+ System.err.println("源文件是目录:"+srcFile.getAbsolutePath());
return false;
}
@@ -66,12 +67,9 @@ public class Tools {
// 如果目标文件所在目录不存在,则创建目录
if (!destFile.exists()) {
// 目标文件所在目录不存在
- boolean t=destFile.mkdirs();
- if(srcFileName.equals("Activity.smali")){
- System.out.println("创建文件夹:"+destFileName+" "+t);
- }
if (!destFile.mkdirs()) {
// 复制文件失败:创建目标文件所在目录失败
+ System.err.println("创建文件夹失败");
return false;
}