diff --git a/ad_config.cfg b/ad_config.cfg new file mode 100644 index 0000000..95bbccf --- /dev/null +++ b/ad_config.cfg @@ -0,0 +1,124 @@ +{ + "array": [ + {}, + {}, + {}, + {}, + { + "title": "穿山甲", + "ltName": "open_ad_sdk.jar", + "manifest": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "", + + "", + "", + " ", + "", + "", + "", + "", + "", + + ], + "class":[ + "com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity", + "com.bytedance.sdk.openadsdk.activity.TTPlayableLandingPageActivity", + "com.bytedance.sdk.openadsdk.activity.TTVideoLandingPageActivity", + "com.bytedance.sdk.openadsdk.activity.TTRewardVideoActivity", + "com.bytedance.sdk.openadsdk.activity.TTRewardExpressVideoActivity", + "com.bytedance.sdk.openadsdk.activity.TTFullScreenVideoActivity", + "com.bytedance.sdk.openadsdk.activity.TTFullScreenExpressVideoActivity", + "com.bytedance.sdk.openadsdk.activity.TTDelegateActivity", + "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.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", + "nusqu", + "gzxem" + ], + "isAllPackage":false, + "isReName":true, + "isJarLib":true, + "packagerlimit":3, + "isManual":true, + "outManifest":false, + "manual":[ + { + "class":"com.bytedance.sdk.openadsdk.downloadnew.a.d", + "find":" const-string v1, \".TTFileProvider\"", + "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, \"ttb\"\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, \"ees\"\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, \"ees\"\n", + "end":"invoke-static {p0, p1}, Lcom/pgl/a/b/e;->a(Landroid/content/Context;Ljava/lang/String;)Z" + } + ], + "rename":{ + "TTLandingPageActivity":"{>+/activity}TTLandingPageActivity", + "TTPlayableLandingPageActivity":"{>+/activity}TTPlayableLandingPageActivity", + "TTVideoLandingPageActivity":"{>+/activity}TTVideoLandingPageActivity", + "TTRewardVideoActivity":"{>+/activity}TTRewardVideoActivity", + "TTRewardExpressVideoActivity":"{>+/activity}TTRewardExpressVideoActivity", + "TTFullScreenVideoActivity":"{>+/activity}TTFullScreenVideoActivity", + "TTFullScreenExpressVideoActivity":"{>+/activity}TTFullScreenExpressVideoActivity", + "TTDelegateActivity":"{>+/activity}TTDelegateActivity", + "TTBaseVideoActivity":"{>+/activity}TTBaseVideoActivity", + "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", + "com.xandroid", + "com.google", + "com.android", + "com.androidx" + ] + + } + ] +} \ No newline at end of file diff --git a/config.cfg b/config.cfg new file mode 100644 index 0000000..9f22613 --- /dev/null +++ b/config.cfg @@ -0,0 +1,34 @@ +{ + "csjConfig": { + "xml": { + "data": [ + { + "command": "remove", + "name": "${demoRoot}/res/values/public.xml", + "data": [ + { + "title": "type", + "value": "raw" + }, + { + "title": "type", + "value": "xml" + } + ] + } + ] + }, + "file": { + "data": [ + { + "command": "delete", + "name": "${demoRoot}/res/raw/*" + }, + { + "command": "delete", + "name": "${demoRoot}/lib/*" + } + ] + } + } +} \ No newline at end of file diff --git a/csj/demo.apk b/csj/demo.apk new file mode 100644 index 0000000..ee906db Binary files /dev/null and b/csj/demo.apk differ diff --git a/libs/android_sdk_tools.jar b/libs/android_sdk_tools.jar new file mode 100644 index 0000000..9322f86 Binary files /dev/null and b/libs/android_sdk_tools.jar differ diff --git a/libs/apktool_2.4.1.jar b/libs/apktool_2.4.1.jar new file mode 100644 index 0000000..2eca808 Binary files /dev/null and b/libs/apktool_2.4.1.jar differ diff --git a/pom.xml b/pom.xml index bd11301..bb36b08 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.yutou tools - 1.0.7.1 + 1.0.7.2 tools Demo project for Spring Boot @@ -86,7 +86,20 @@ aliyun-sdk-oss 3.8.0 - + + android_sdk_tools + android_sdk_tools + 1.0 + system + ${project.basedir}/libs/android_sdk_tools.jar + + + apktool + apktool + 2.4.1 + system + ${project.basedir}/libs/apktool_2.4.1.jar + @@ -96,6 +109,15 @@ spring-boot-maven-plugin + + + libs + /BOOT-INF/lib/ + + **/*.jar + + + diff --git a/src/main/java/com/yutou/tools/home/nas/BotTools.java b/src/main/java/com/yutou/tools/home/nas/BotTools.java index e93abbe..95c500d 100644 --- a/src/main/java/com/yutou/tools/home/nas/BotTools.java +++ b/src/main/java/com/yutou/tools/home/nas/BotTools.java @@ -17,29 +17,32 @@ public class BotTools { String _json = new String(Base64.getDecoder().decode(msg)); JSONObject json = JSONObject.parseObject(_json); String url = json.getString("url"); - Tools.download(url, new DownloadInterface() { - @Override - public void onDownload(String file) { - super.onDownload(file); - if (file.endsWith(".apk")) { - String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); - Jedis redisTools = RedisTools.getRedis(); - redisTools.select(1); - redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file); - redisTools.close(); - RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" + - "\n1)生成穿山甲资源包 (回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + ")" + - "\n2)不处理 (360s后自动取消)" + - "\n$downloadApk_" + uuid); + if(url.endsWith(".apk")){ + Tools.download(url, new DownloadInterface() { + @Override + public void onDownload(String file) { + super.onDownload(file); + if (file.endsWith(".apk")) { + String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); + Jedis redisTools = RedisTools.getRedis(); + redisTools.select(1); + redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file); + redisTools.close(); + RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" + + "\n1)生成穿山甲资源包 (回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + ")" + + "\n2)不处理 (360s后自动取消)" + + "\n$downloadApk_" + uuid); + } } - } - @Override - public void onError(Exception e) { - super.onError(e); + @Override + public void onError(Exception e) { + super.onError(e); + + } + }); + } - } - }); return "ok"; } @@ -68,6 +71,8 @@ public class BotTools { list.clear(); for (JSONObject jsonObject : tmp) { isRun=true; + long startTime=System.currentTimeMillis(); + File apk=new File(jsonObject.getString("file")); new CsjTools(jsonObject.getString("file") , new File("csj" + File.separator + "demo.apk").getAbsolutePath() , jsonObject.getString("packagename") @@ -80,13 +85,29 @@ public class BotTools { @Override public void onDownload(String file) { super.onDownload(file); - File apk=new File(s); + long nowTime=System.currentTimeMillis()-startTime; RedisTools.set(1,"msg_"+System.currentTimeMillis(),apk.getName() +"已处理完成,下载地址" + "\n"+file + - "\n请在十分钟内下载,超时将自动删除"); + "\n请在十分钟内下载,超时将自动删除" + + "\n耗时:"+nowTime+"ms"); path = file.replace("https://yutou-oss-test.oss-cn-hangzhou.aliyuncs.com/", ""); isRun=false; + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(100); + if (list.size() > 0) { + RedisTools.set(1, "msg_" + System.currentTimeMillis(), "开始下一个队列"); + csj(); + } + + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }).start(); new Thread(new Runnable() { @Override public void run() { @@ -104,20 +125,7 @@ public class BotTools { }); } } - new Thread(new Runnable() { - @Override - public void run() { - try { - Thread.sleep(100); - if (list.size() > 0) { - csj(); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }).start(); } }