This commit is contained in:
Yutousama 2020-06-03 09:41:10 +08:00
parent 9c41ab000b
commit afe1407825
8 changed files with 328 additions and 264 deletions

View File

@ -7,12 +7,14 @@
"<service android:name=\"com.qq.e.comm.DownloadService\" android:exported=\"false\" />",
"<activity android:name=\"com.qq.e.ads.ADActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
"<activity android:name=\"com.qq.e.ads.PortraitADActivity\" android:screenOrientation=\"portrait\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
"<activity android:name=\"com.qq.e.ads.LandscapeADActivity\" android:screenOrientation=\"landscape\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />"
"<activity android:name=\"com.qq.e.ads.LandscapeADActivity\" android:screenOrientation=\"landscape\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
"<activity android:name=\"com.qq.e.ads.RewardvideoPortraitADActivity\" android:screenOrientation=\"landscape\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />"
],
"class": [
"com.qq.e.ads.ADActivity",
"com.qq.e.ads.PortraitADActivity",
"com.qq.e.ads.LandscapeADActivity",
"com.qq.e.ads.RewardvideoPortraitADActivity",
"com.qq.e.comm.DownloadService"
],
"random": [
@ -24,6 +26,7 @@
"ADActivity": "Activity",
"PortraitADActivity": "PortraitActivity",
"LandscapeADActivity": "LandscapeActivity",
"RewardvideoPortraitADActivity": "RPDActivity",
"DownloadService": "DownloadService"
},
"isAllPackage": false,
@ -133,11 +136,7 @@
"class": [
"com.qy.sdk.views.MyActivity",
"com.qy.sdk_rx.listeners.QyReceiver",
"com.qy.sdk.TMProvider",
"com.qy.sdk.rds.BannerView",
"com.qy.sdk.rds.NativeUnifiedsView",
"com.qy.sdk.rds.RewardView",
"com.qy.sdk.rds.SplashView"
"com.qy.sdk.TMProvider"
],
"random": [
"com",
@ -145,12 +144,9 @@
"bh"
],
"rename": {
"MyActivity": "{>+}Activity",
"MyActivity": "{>+}MActivity",
"QyReceiver": "{>+}Receiver",
"BannerView": "{>+}BView",
"NativeUnifiedsView": "{>+}NUView",
"RewardView": "{>+}RView",
"SplashView": "{>+}OpenView"
"TMProvider":"{>+}TProvider"
},
"isAllPackage": true,
@ -212,8 +208,8 @@
],
"random":[
"com",
"nusqu",
"gzxem"
"riboq",
"qazrj"
],
"isAllPackage":false,
"isReName":true,

View File

@ -41,5 +41,6 @@
]
}
},
"sdkPath":"D:\\AndroidStudio_Data\\ADSDK_v5"
"sdkPath":"D:\\AndroidStudio_Data\\ADSDK_v5",
"csjPackageName":"com.riboq.qazrj"
}

View File

@ -80,15 +80,15 @@ public class AppMain extends JFrame {
private void initAdbData() {
adbMap = new HashMap<>(9);
adbMap.put("开屏", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"open\"");
adbMap.put("插屏", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"inter\"");
adbMap.put("banner", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"banner\"");
adbMap.put("视频", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"video\"");
adbMap.put("激励视频", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"reward\"");
adbMap.put("SDK信息", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"systemTest\"");
adbMap.put("重载网络", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"reloadApi\"");
adbMap.put("获取广告参数", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"adBean\"");
adbMap.put("查看日志", "adb shell am broadcast -a com.sdk.debug --es package \"[packname]\" --es type \"logcat\"");
adbMap.put("开屏", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"open\"");
adbMap.put("插屏", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"inter\"");
adbMap.put("banner", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"banner\"");
adbMap.put("视频", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"video\"");
adbMap.put("激励视频", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"reward\"");
adbMap.put("SDK信息", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"systemTest\"");
adbMap.put("重载网络", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"reloadApi\"");
adbMap.put("获取广告参数", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"adBean\"");
adbMap.put("查看日志", "adb shell am broadcast -a com.android.model.debug --es package \"[packname]\" --es type \"logcat\"");
}
private void initPhonePackageList() {
@ -536,7 +536,8 @@ public class AppMain extends JFrame {
new EditToDalog("提示", "请输入版本号", "", path -> {
if (!Tools.stringIsNull(path)) {
version = path;
new EditToDalog("提示", "请输入包名", "com.prujwk.jdyphn", path1 -> {
packageName="com."+Tools.getRandomString(5).toLowerCase()+"."+ Tools.getRandomString(5).toLowerCase();
new EditToDalog("提示", "请输入包名", packageName, path1 -> {
if (!Tools.stringIsNull(path1)) {
packageName = path1;
autoPackageSdk();

View File

@ -15,18 +15,30 @@ public class AutoPackageSDK {
private AutoRandomAdSDK randomAdSDK;
private String version;
private String packageName;
File gdtsdk, uniplaysdk, qysdk;
private SmaliApkToolsPath inter;
File gdtsdk, uniplaysdk, qysdk,baiduSdk;
private AutoPackageSDK() {
}
public AutoPackageSDK(SmaliApkToolsPath inter, String version, String packageName) {
this.version = version;
this.packageName = packageName;
private void encryptSDK() {
AutoPackageSDKMust.start(Tools.getRandomString(16), new SmaliApkToolsPath() {
@Override
public void smaliPath(String path) {
if (path != null) {
Tools.copyFile(path, new File("input" + File.separator + "qySDK").getAbsolutePath(), true);
}
init();
}
});
}
private void init() {
File gdtPath = new File("input" + File.separator + "gdtSDK" + File.separator);
File unplayPath = new File("input" + File.separator + "uniplaySDK" + File.separator);
File qysdkPath = new File("input" + File.separator + "qySDK" + File.separator);
File baiduPath = new File("input" + File.separator + "baiduSDK" + File.separator);
if (!gdtPath.exists() || Objects.requireNonNull(gdtPath.listFiles()).length == 0) {
inter.smaliPath("广点通SDK不存在请放置到input" + File.separator + "gdtSDK文件夹中");
return;
@ -43,6 +55,12 @@ public class AutoPackageSDK {
}
qysdk = Objects.requireNonNull(qysdkPath.listFiles())[0];
if (!baiduPath.exists() || Objects.requireNonNull(baiduPath.listFiles()).length == 0) {
inter.smaliPath("百青藤SDK不存在请放置到input" + File.separator + "baiduSDK文件夹中");
return;
}
baiduSdk= Objects.requireNonNull(baiduPath.listFiles())[0];
JSONArray array = new JSONArray();
JSONObject gdt = new JSONObject();
@ -61,6 +79,14 @@ public class AutoPackageSDK {
unplay.put("packageName", packageName + ".up");
array.put(unplay);
JSONObject baidu = new JSONObject();
baidu.put("file", baiduSdk.getAbsolutePath());
baidu.put("version", version);
baidu.put("type", "2");
baidu.put("packageName", packageName + ".bsb");
baidu.put("index", 5);
array.put(baidu);
JSONObject qy = new JSONObject();
qy.put("file", qysdk.getAbsolutePath());
qy.put("version", version);
@ -102,8 +128,13 @@ public class AutoPackageSDK {
}
}
});
}
public AutoPackageSDK(SmaliApkToolsPath inter, String version, String packageName) {
this.version = version;
this.packageName = packageName;
this.inter=inter;
encryptSDK();
}
private void outAssetsQY(int index, String type) {

View File

@ -4,6 +4,7 @@ import com.qy.Interfaces.SmaliApkToolsPath;
import org.json.JSONObject;
import java.io.*;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -66,7 +67,7 @@ public class AutoPackageSDKMust {
}
private void loadFile(File path) {
for (File file : path.listFiles()) {
for (File file : Objects.requireNonNull(path.listFiles())) {
if (file.isDirectory()) {
loadFile(file);
} else if (file.getName().endsWith(".java")) {

View File

@ -1,6 +1,7 @@
package com.qy.utils;
import com.qy.Interfaces.SmaliApkToolsPath;
import com.qy.ui.EditToDalog;
import org.json.JSONArray;
import org.json.JSONObject;
@ -100,7 +101,11 @@ public class CsjTools {
reader.close();
return getXMLValue("package", tmp);
} else {
return "com.prujwk.jdyphn";
if (packageName == null) {
return Tools.loadConfig(new File("config.cfg")).getString("csjPackageName");
} else {
return packageName;
}
}
} catch (Exception e) {
e.printStackTrace();
@ -128,6 +133,7 @@ public class CsjTools {
writer.write(manifest);
writer.flush();
writer.close();
reader.close();
} catch (Exception e) {
e.printStackTrace();
@ -254,6 +260,7 @@ public class CsjTools {
public void smaliPath(String path) {
_log.smaliPath("已出包" + csjRes.getAbsolutePath());
_log.smaliPath("耗时:" + (System.currentTimeMillis() - time) / 1000 + "");
System.gc();
}
});
@ -346,16 +353,30 @@ public class CsjTools {
//还有最后一个问题穿山甲的Activity没改
public static void main(String[] args) {
new CsjTools("C:\\Users\\58381\\Documents\\WeChat Files\\z583819556\\FileStorage\\File\\2020-04\\CasualGame-release.apk"
, "E:\\idea\\android_sdk_tools\\input\\csjDemo\\demo_2.9.0.0.apk"
, "com.abc.test"
, "5700"
, new SmaliApkToolsPath() {
CsjTools tools = new CsjTools();
tools.build("D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2.apk",
"D:\\IdeaProjects\\android_sdk_tools\\app-release.apk",
new SmaliApkToolsPath() {
@Override
public void smaliPath(String log) {
System.out.println(log);
if (log.startsWith("已出包")) {
System.out.println("打包完成");
new EditToDalog("成功", "打包完成,请输入版本号", "5600", new SmaliApkToolsPath() {
@Override
public void smaliPath(String path) {
System.out.println("打包完成:"+path);
System.out.println(">>" + path);
tools.out(log.replace("已出包", ""),
new File("csj").getAbsolutePath() + File.separator + "csc",
Integer.parseInt(path));
}
});
}
}
});
// tools.outManifest();
// tools.start();
}
}

View File

@ -19,20 +19,23 @@ public class SmaliUtils {
public String mainPath = null;
private int mix = 1000;
// private String mainPath = "D:\\反编译\\APK\\rx.jar.out\\smali";
private Map<String, String> clazzList = new HashMap<>();
private Map<String, String> clazzList;
private List<File> files = new ArrayList<>();
public static void main(String[] args) {
new SmaliUtils();
}
public SmaliUtils() {
clazzList = new HashMap<>();
}
public void setPath(String uPath) {
mainPath = uPath;
}
private SmaliApkToolsPath inter;
public void start(SmaliApkToolsPath inter) {
this.inter = inter;
list = new ArrayList<>();
@ -52,13 +55,16 @@ public class SmaliUtils {
e.printStackTrace();
}
}
private int writerIndex = 0;
private void test() {
writerIndex++;
if (files.size() == writerIndex) {
inter.smaliPath("ok");
}
}
private void recursive(File file) {
String packname = null;
if (file.isFile()) {
@ -181,6 +187,7 @@ public class SmaliUtils {
}
int i = 1;
private String changeLine(String old) {
Set<String> keySet = clazzList.keySet();
for (String clazz : keySet) {
@ -190,7 +197,9 @@ public class SmaliUtils {
}
return old;
}
private boolean isEncryption = true;
public void unPack(String jarPath, SmaliApkToolsPath smaliApkToolsPath) {
File path = new File(jarPath + ".out");
if (path.exists() && path.isDirectory()) {
@ -221,9 +230,11 @@ public class SmaliUtils {
e.printStackTrace();
}
}
public void bale(String path, String smaliPath) {
bale(path, smaliPath, null);
}
public void bale(String smaliPath, String path, SmaliApkToolsPath inter) {
String[] args = new String[]{"b", "-f", smaliPath, "-o", path};
for (String string : args) {
@ -242,7 +253,9 @@ public class SmaliUtils {
}
}
}
List<String> list;
public void setFilter(List<String> list) {
this.list = list;
}

View File

@ -55,7 +55,7 @@ public class Tools {
File srcFile = new File(srcFileName);
// 判断源文件是否存在
if (!srcFile.exists()) {
System.err.println("源文件不存在:"+srcFile.getAbsolutePath());
System.err.println("源文件不存在:"+srcFile.getAbsolutePath()+" > "+destFileName);
return false;
} else if (!srcFile.isFile()) {
System.err.println("源文件是目录:"+srcFile.getAbsolutePath());