完善了穿山甲资源包生成的初始版本
This commit is contained in:
parent
9fa2eb3a02
commit
e9e5ba609b
357
ad_config.cfg
357
ad_config.cfg
@ -1,150 +1,215 @@
|
||||
{
|
||||
"array": [
|
||||
{
|
||||
"title": "广点通",
|
||||
"ltName": "GDTUnionSDK_QY.lt",
|
||||
"manifest": [
|
||||
"<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\" />"
|
||||
],
|
||||
"class": [
|
||||
"com.qq.e.ads.ADActivity",
|
||||
"com.qq.e.ads.PortraitADActivity",
|
||||
"com.qq.e.ads.LandscapeADActivity",
|
||||
"com.qq.e.comm.DownloadService"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"dt"
|
||||
],
|
||||
"rename": {
|
||||
"ADActivity": "Activity",
|
||||
"PortraitADActivity": "PortraitActivity",
|
||||
"LandscapeADActivity": "LandscapeActivity",
|
||||
"DownloadService": "DownloadService"
|
||||
},
|
||||
"isAllPackage":false,
|
||||
"isReName": true,
|
||||
"isJarLib":false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": false,
|
||||
"manual": [
|
||||
"array": [
|
||||
{
|
||||
"class": "com.qq.e.comm.a",
|
||||
"find": "com/qq/e/ads/ADActivity"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "聚量",
|
||||
"ltName": "jla",
|
||||
"manifest": [
|
||||
"<activity android:name=\"com.uniplay.adsdk.AdActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\">/>",
|
||||
"<activity android:name=\"com.uniplay.adsdk.InterstitialAdActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" android:theme=\"@android:style/Theme.Translucent\"/>",
|
||||
"<activity android:name=\"com.uniplay.adsdk.NetworkChangeActivity\" android:screenOrientation=\"portrait\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
|
||||
"<activity android:name=\"com.joomob.activity.AdVideoActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
|
||||
"<service android:name=\"com.uniplay.adsdk.DownloadService\"/>"
|
||||
],
|
||||
"class": [
|
||||
"com.uniplay.adsdk.AdActivity",
|
||||
"com.uniplay.adsdk.InterstitialAdActivity",
|
||||
"com.uniplay.adsdk.NetworkChangeActivity",
|
||||
"com.joomob.activity.AdVideoActivity",
|
||||
"com.uniplay.adsdk.DownloadService"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"ut"
|
||||
],
|
||||
"rename": {
|
||||
"AdActivity": "Activity",
|
||||
"InterstitialAdActivity": "InterstitialActivity",
|
||||
"NetworkChangeActivity": "NetworkChangeActivity",
|
||||
"AdVideoActivity": "VideoActivity",
|
||||
"DownloadService": "DownloadService"
|
||||
},
|
||||
"isAllPackage":false,
|
||||
"isReName": true,
|
||||
"isJarLib":false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": true,
|
||||
"manual": [
|
||||
{
|
||||
"class":"com.uniplay.adsdk.basic.RuleManage",
|
||||
"find":".method public configRight",
|
||||
"msg":"仅保留const-string v0, \"\" return-object v0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "万维",
|
||||
"ltName": "OnewaySDK_QY.lt",
|
||||
"manifest": [
|
||||
"<activity android:name=\"mobi.oneway.export.AdShowActivity\" android:configChanges=\"fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen\" android:hardwareAccelerated=\"true\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\" />",
|
||||
],
|
||||
"class": [
|
||||
"mobi.oneway.sdk.AdShowActivity"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"wt"
|
||||
],
|
||||
"rename": {
|
||||
"AdShowActivity": "ShowActivity"
|
||||
},
|
||||
"isAllPackage":false,
|
||||
"isReName": true,
|
||||
"isJarLib":false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": true,
|
||||
"manual": [
|
||||
{
|
||||
"class":"mobi.oneway.sdk.port.Unit",
|
||||
"find":"const-string v0, \"mobi.oneway.export.AdShowActivity\""
|
||||
},
|
||||
{
|
||||
"class":"mobi.oneway.sdk.b.c",
|
||||
"find":"const-string v1, \"mobi.oneway.export.OWProvider\""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "趣赢SDK",
|
||||
"ltName": "qysdk.jar",
|
||||
"manifest": [
|
||||
"<activity android:name=\"com.qy.sdk.views.MyActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" />",
|
||||
"<receiver android:name=\"com.qy.sdk_rx.listeners.QyReceiver\"> <intent-filter> <action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\" /></intent-filter> <intent-filter><action android:name=\"android.intent.action.PACKAGE_ADDED\" /><data android:scheme=\"package\" /></intent-filter><intent-filter><action android:name=\"android.intent.action.DOWNLOAD_COMPLETE\" /></intent-filter></receiver>",
|
||||
"<provider android:name=\"com.qy.sdk.TMProvider\" android:authorities=\"${applicationId}.TTMultProvider\" android:exported=\"false\" android:grantUriPermissions=\"true\"> <meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/file_paths\" /></provider>"
|
||||
],
|
||||
"class": [
|
||||
"com.qy.sdk.views.MyActivity",
|
||||
"com.qy.sdk_rx.listeners.QyReceiver",
|
||||
"com.qy.sdk.TMProvider"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"wq",
|
||||
"rx"
|
||||
],
|
||||
"rename": {
|
||||
"MyActivity": "Activity",
|
||||
"QyReceiver":"Receiver",
|
||||
"TMProvider":"TProvider"
|
||||
},
|
||||
"isAllPackage":true,
|
||||
"isReName": true,
|
||||
"isJarLib":true,
|
||||
"packagerlimit": 3,
|
||||
"isManual": false,
|
||||
"manual": [
|
||||
"title": "广点通",
|
||||
"ltName": "GDTUnionSDK_QY.lt",
|
||||
"manifest": [
|
||||
"<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\" />"
|
||||
],
|
||||
"class": [
|
||||
"com.qq.e.ads.ADActivity",
|
||||
"com.qq.e.ads.PortraitADActivity",
|
||||
"com.qq.e.ads.LandscapeADActivity",
|
||||
"com.qq.e.comm.DownloadService"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"dt"
|
||||
],
|
||||
"rename": {
|
||||
"ADActivity": "Activity",
|
||||
"PortraitADActivity": "PortraitActivity",
|
||||
"LandscapeADActivity": "LandscapeActivity",
|
||||
"DownloadService": "DownloadService"
|
||||
},
|
||||
"isAllPackage": false,
|
||||
"isReName": true,
|
||||
"isJarLib": false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": false,
|
||||
"manual": [
|
||||
{
|
||||
"class": "com.qq.e.comm.a",
|
||||
"find": "com/qq/e/ads/ADActivity"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "聚量",
|
||||
"ltName": "jla",
|
||||
"manifest": [
|
||||
"<activity android:name=\"com.uniplay.adsdk.AdActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\">/>",
|
||||
"<activity android:name=\"com.uniplay.adsdk.InterstitialAdActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" android:theme=\"@android:style/Theme.Translucent\"/>",
|
||||
"<activity android:name=\"com.uniplay.adsdk.NetworkChangeActivity\" android:screenOrientation=\"portrait\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
|
||||
"<activity android:name=\"com.joomob.activity.AdVideoActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" />",
|
||||
"<service android:name=\"com.uniplay.adsdk.DownloadService\"/>"
|
||||
],
|
||||
"class": [
|
||||
"com.uniplay.adsdk.AdActivity",
|
||||
"com.uniplay.adsdk.InterstitialAdActivity",
|
||||
"com.uniplay.adsdk.NetworkChangeActivity",
|
||||
"com.joomob.activity.AdVideoActivity",
|
||||
"com.uniplay.adsdk.DownloadService"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"ut"
|
||||
],
|
||||
"rename": {
|
||||
"AdActivity": "Activity",
|
||||
"InterstitialAdActivity": "InterstitialActivity",
|
||||
"NetworkChangeActivity": "NetworkChangeActivity",
|
||||
"AdVideoActivity": "VideoActivity",
|
||||
"DownloadService": "DownloadService"
|
||||
},
|
||||
"isAllPackage": false,
|
||||
"isReName": true,
|
||||
"isJarLib": false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": true,
|
||||
"manual": [
|
||||
{
|
||||
"class": "com.uniplay.adsdk.basic.RuleManage",
|
||||
"find": ".method public configRight",
|
||||
"msg": "仅保留const-string v0, \"\" return-object v0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "万维",
|
||||
"ltName": "OnewaySDK_QY.lt",
|
||||
"manifest": [
|
||||
"<activity android:name=\"mobi.oneway.export.AdShowActivity\" android:configChanges=\"fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen\" android:hardwareAccelerated=\"true\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\" />"
|
||||
],
|
||||
"class": [
|
||||
"mobi.oneway.sdk.AdShowActivity"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"ww",
|
||||
"wt"
|
||||
],
|
||||
"rename": {
|
||||
"AdShowActivity": "ShowActivity"
|
||||
},
|
||||
"isAllPackage": false,
|
||||
"isReName": true,
|
||||
"isJarLib": false,
|
||||
"packagerlimit": 3,
|
||||
"isManual": true,
|
||||
"manual": [
|
||||
{
|
||||
"class": "mobi.oneway.sdk.port.Unit",
|
||||
"find": "const-string v0, \"mobi.oneway.export.AdShowActivity\""
|
||||
},
|
||||
{
|
||||
"class": "mobi.oneway.sdk.b.c",
|
||||
"find": "const-string v1, \"mobi.oneway.export.OWProvider\""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "趣赢SDK",
|
||||
"ltName": "qysdk.jar",
|
||||
"manifest": [
|
||||
"<activity android:name=\"com.qy.sdk.views.MyActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" />",
|
||||
"<receiver android:name=\"com.qy.sdk_rx.listeners.QyReceiver\"> <intent-filter> <action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\" /></intent-filter> <intent-filter><action android:name=\"android.intent.action.PACKAGE_ADDED\" /><data android:scheme=\"package\" /></intent-filter><intent-filter><action android:name=\"android.intent.action.DOWNLOAD_COMPLETE\" /></intent-filter></receiver>",
|
||||
"<provider android:name=\"com.qy.sdk.TMProvider\" android:authorities=\"${applicationId}.TTMultProvider\" android:exported=\"false\" android:grantUriPermissions=\"true\"> <meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/file_paths\" /></provider>"
|
||||
],
|
||||
"class": [
|
||||
"com.qy.sdk.views.MyActivity",
|
||||
"com.qy.sdk_rx.listeners.QyReceiver",
|
||||
"com.qy.sdk.TMProvider"
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"wq",
|
||||
"rx"
|
||||
],
|
||||
"rename": {
|
||||
"MyActivity": "Activity",
|
||||
"QyReceiver": "Receiver",
|
||||
"TMProvider": "TProvider"
|
||||
},
|
||||
"isAllPackage": true,
|
||||
"isReName": true,
|
||||
"isJarLib": true,
|
||||
"packagerlimit": 3,
|
||||
"isManual": false,
|
||||
"manual": [],
|
||||
"dex2jar": "D:\\反编译\\dex2jar-2.0\\_d2j-dex2jar.bat"
|
||||
},
|
||||
{
|
||||
"title": "穿山甲",
|
||||
"ltName": "open_ad_sdk.jar",
|
||||
"manifest": [
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTPlayableLandingPageActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTVideoLandingPageActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTRewardVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTRewardExpressVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTFullScreenVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTFullScreenExpressVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTDelegateActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" /> ",
|
||||
"<service android:name=\"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService\" /> ",
|
||||
"<receiver android:name=\"com.bytedance.embedapplog.collector.Collector\" android:enabled=\"true\" android:exported=\"true\" /> ",
|
||||
"<service android:name=\"com.bytedance.tea.crash.upload.CrashUploadService\" android:process=\":npth\" />"
|
||||
],
|
||||
"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"
|
||||
],
|
||||
"random":[
|
||||
"com",
|
||||
"ww",
|
||||
"za"
|
||||
],
|
||||
"isAllPackage":false,
|
||||
"isReName":true,
|
||||
"isJarLib":true,
|
||||
"packagerlimit":3,
|
||||
"isManual":false,
|
||||
"outManifest":false,
|
||||
"manual":[
|
||||
|
||||
],
|
||||
"dex2jar":"/media/yutou/_dde_data/反编译/dex2jar-2.0/_d2j-dex2jar.sh"
|
||||
}
|
||||
]
|
||||
],
|
||||
"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":"BinderPoolService",
|
||||
"Collector":"Collector",
|
||||
"CrashUploadService":"CrashUploadService"
|
||||
},
|
||||
"filter":[
|
||||
"com.android",
|
||||
"com.xandroid",
|
||||
"com.google",
|
||||
"com.android",
|
||||
"com.androidx"
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
}
|
68
config.cfg
68
config.cfg
@ -1,20 +1,52 @@
|
||||
{
|
||||
"switch":"1",
|
||||
"1":"/home/yutou/AndroidStudioProjects/ADSDK_v5/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"2":"/home/yutou/AndroidStudioProjects/ADSDK_v5/qyadsdk/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"3":"F:/AndroidStudio_Data/GameSDK/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"4":"/home/yutou/AndroidStudioProjects/ADSDK_v5/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"5":"/home/yutou/AndroidStudioProjects/ADSDK_v5/qyadsdk/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"6":"/home/yutou/AndroidStudioProjects/ADSDK_v5/Test/build/intermediates/javac/debug/classes/com/",
|
||||
"input":"/media/yutou/_dde_data/AndroidStudio_Data/buildTools/com.zip",
|
||||
"out":"/media/yutou/_dde_data/AndroidStudio_Data/buildTools/",
|
||||
"dx":"/media/yutou/_dde_data/AndroidStudio_Data/buildTools/dx.jar",
|
||||
"array":[
|
||||
"rd_rx",
|
||||
"qy_rx",
|
||||
"rx",
|
||||
"rd_rx",
|
||||
"qy_rx",
|
||||
"atest"
|
||||
]
|
||||
"1": "/home/yutou/AndroidStudioProjects/ADSDK_v5/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"2": "/home/yutou/AndroidStudioProjects/ADSDK_v5/qyadsdk/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"3": "F:/AndroidStudio_Data/GameSDK/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"4": "/home/yutou/AndroidStudioProjects/ADSDK_v5/sdk_rx/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"5": "/home/yutou/AndroidStudioProjects/ADSDK_v5/qyadsdk/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/",
|
||||
"6": "/home/yutou/AndroidStudioProjects/ADSDK_v5/Test/build/intermediates/javac/debug/classes/com/",
|
||||
"switch": "1",
|
||||
"input": "/media/yutou/_dde_data/AndroidStudio_Data/buildTools/com.zip",
|
||||
"out": "/media/yutou/_dde_data/AndroidStudio_Data/buildTools/",
|
||||
"dx": "/media/yutou/_dde_data/AndroidStudio_Data/buildTools/dx.jar",
|
||||
"array": [
|
||||
"rd_rx",
|
||||
"qy_rx",
|
||||
"rx",
|
||||
"rd_rx",
|
||||
"qy_rx",
|
||||
"atest"
|
||||
],
|
||||
"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/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.Permission;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.Vector;
|
||||
@ -29,6 +30,7 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import com.sun.javaws.exceptions.ExitException;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -66,10 +68,12 @@ public class AppMain extends JFrame {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
new AppMain();
|
||||
}
|
||||
|
||||
public AppMain() {
|
||||
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
json = Tools.loadConfig(new File("config.cfg"));
|
||||
|
@ -7,6 +7,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.SQLOutput;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -34,8 +35,9 @@ import com.qy.Interfaces.DalogAbs;
|
||||
],
|
||||
"rename": {//修改类名
|
||||
"MyActivity": "Activity",//指定类名
|
||||
"TMProvider":"TProvider[notmover]",//指定包名,但不移动路径
|
||||
"TMProvider":"TProvider[notmover]",//指定类名,但不移动路径
|
||||
"BannerView":"[random]"//随机类名(2~6)
|
||||
"BannerView":"{+/activity}BannerView"//指定路径 [+表示在random的基础上]
|
||||
},
|
||||
"isAllPackage":true,//修改所有包名,false的话只修改class指定的包名
|
||||
"isReName": true,//重命名类名
|
||||
@ -52,380 +54,475 @@ import com.qy.Interfaces.SmaliApkToolsPath;
|
||||
import com.qy.ui.TextToDalog;
|
||||
|
||||
public class AutoRandomAdSDK {
|
||||
private File sdk;
|
||||
private JSONObject config;
|
||||
private SmaliUtils smalitools;
|
||||
private Map<String, File> adClass;
|
||||
private Map<String, File> nowAdClass;
|
||||
private Map<String, String> nowAdFile;
|
||||
private String rootPath;
|
||||
private String dxPath;
|
||||
private String version;
|
||||
private String sdktype;
|
||||
private SmaliApkToolsPath inter;
|
||||
private boolean isDev = false;
|
||||
private File sdk;
|
||||
private JSONObject config;
|
||||
private SmaliUtils smalitools;
|
||||
private Map<String, File> adClass;
|
||||
private Map<String, File> nowAdClass;
|
||||
private Map<String, String> nowAdFile;
|
||||
private String rootPath;
|
||||
private String dxPath;
|
||||
private String version;
|
||||
private String sdktype;
|
||||
private SmaliApkToolsPath inter;
|
||||
private boolean isDev = false;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600","5",1,null);
|
||||
// new AutoRandomAdSDK(new File("GDTSDK.unionNormal.4.100.970.jar"), 0, null);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600", "5", 1, null);
|
||||
// new AutoRandomAdSDK(new File("GDTSDK.unionNormal.4.100.970.jar"), 0, null);
|
||||
}
|
||||
|
||||
public AutoRandomAdSDK(File sdk,String version,String type, int cfgIndex, SmaliApkToolsPath inster) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.inter = inster;
|
||||
this.version=version;
|
||||
this.sdktype=type;
|
||||
JSONObject cfg = Tools.loadConfig(new File("ad_config.cfg"));
|
||||
if (cfg == null) {
|
||||
throw new NullPointerException("没有广告配置文件");
|
||||
}
|
||||
this.sdk = sdk;
|
||||
config = cfg.getJSONArray("array").getJSONObject(cfgIndex);
|
||||
start();
|
||||
}
|
||||
public AutoRandomAdSDK() {
|
||||
|
||||
public void start() {
|
||||
adClass = new HashMap<String, File>();
|
||||
nowAdClass = new HashMap<String, File>();
|
||||
nowAdFile = new HashMap<String, String>();
|
||||
smalitools = new SmaliUtils();
|
||||
File tmpSdk = new File(sdk.getAbsolutePath().replace(sdk.getName(), "new_" + sdk.getName()));
|
||||
if (isDev) {
|
||||
dxPath="/media/yutou/_dde_data/AndroidStudio_Data/buildTools/dx.jar";
|
||||
sdktype="3";
|
||||
version="1000";
|
||||
} else {
|
||||
JSONObject json = Tools.loadConfig(new File("config.cfg"));
|
||||
dxPath=json.getString("dx");
|
||||
}
|
||||
JarToAJar.toAJar(dxPath, sdk.getAbsolutePath(),
|
||||
tmpSdk.getAbsolutePath());
|
||||
sdk = new File(tmpSdk.getAbsolutePath());
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
smalitools.unPack(sdk.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
// TODO Auto-generated method stub
|
||||
rootPath = path;
|
||||
alter();
|
||||
}
|
||||
});
|
||||
}
|
||||
public AutoRandomAdSDK(File sdk, String version, String type, int cfgIndex, SmaliApkToolsPath inster) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.inter = inster;
|
||||
this.version = version;
|
||||
this.sdktype = type;
|
||||
JSONObject cfg = Tools.loadConfig(new File("ad_config.cfg"));
|
||||
if (cfg == null) {
|
||||
throw new NullPointerException("没有广告配置文件");
|
||||
}
|
||||
this.sdk = sdk;
|
||||
config = cfg.getJSONArray("array").getJSONObject(cfgIndex);
|
||||
start();
|
||||
}
|
||||
|
||||
private void alter() {
|
||||
JSONArray clazzs = config.getJSONArray("class");
|
||||
for (int i = 0; i < clazzs.length(); i++) {
|
||||
File clz = new File(rootPath + File.separator + "smali" + File.separator
|
||||
+ clazzs.getString(i).replaceAll("\\.", File.separator) + ".smali");
|
||||
if (clz.exists()) {
|
||||
adClass.put(clazzs.getString(i), clz);
|
||||
}
|
||||
}
|
||||
for (String key : adClass.keySet()) {
|
||||
System.out.println("注入的值:" + key);
|
||||
}
|
||||
mkdirs();
|
||||
update();
|
||||
change();
|
||||
public void start() {
|
||||
adClass = new HashMap<String, File>();
|
||||
nowAdClass = new HashMap<String, File>();
|
||||
nowAdFile = new HashMap<String, String>();
|
||||
smalitools = new SmaliUtils();
|
||||
File tmpSdk = new File(sdk.getAbsolutePath().replace(sdk.getName(), "new_" + sdk.getName()));
|
||||
if (isDev) {
|
||||
dxPath = "/media/yutou/_dde_data/AndroidStudio_Data/buildTools/dx.jar";
|
||||
sdktype = "3";
|
||||
version = "1000";
|
||||
} else {
|
||||
JSONObject json = Tools.loadConfig(new File("config.cfg"));
|
||||
dxPath = json.getString("dx");
|
||||
}
|
||||
JarToAJar.toAJar(dxPath, sdk.getAbsolutePath(),
|
||||
tmpSdk.getAbsolutePath());
|
||||
sdk = new File(tmpSdk.getAbsolutePath());
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
smalitools.unPack(sdk.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
// TODO Auto-generated method stub
|
||||
rootPath = path;
|
||||
alter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void outManifest() {
|
||||
JSONArray array = new JSONArray();
|
||||
for (String key : nowAdClass.keySet()) {
|
||||
JSONArray manifest = config.getJSONArray("manifest");
|
||||
for (int i = 0; i < manifest.length(); i++) {
|
||||
if (manifest.getString(i).contains(key)) {
|
||||
String path = nowAdClass.get(key).getAbsolutePath();
|
||||
String newManifest = path
|
||||
.replace(sdk.getAbsolutePath() + ".out" + File.separator + "smali" + File.separator, "");
|
||||
try {
|
||||
newManifest = newManifest.replaceAll(File.separator, ".") + "." + adClass.get(key).getName();
|
||||
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));
|
||||
}
|
||||
}
|
||||
boolean isPackage = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
File manifest = new File(sdk.getAbsolutePath() + ".out" + File.separator + "manifest.xml");
|
||||
PrintWriter writer;
|
||||
try {
|
||||
writer = new PrintWriter(manifest);
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
writer.write(array.getString(i).toString() + "\n");
|
||||
writer.flush();
|
||||
}
|
||||
writer.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void startNotUnPackage(String path, SmaliApkToolsPath inster) {
|
||||
this.inter = inster;
|
||||
isPackage = false;
|
||||
adClass = new HashMap<String, File>();
|
||||
nowAdClass = new HashMap<String, File>();
|
||||
nowAdFile = new HashMap<String, String>();
|
||||
smalitools = new SmaliUtils();
|
||||
JSONObject cfg = Tools.loadConfig(new File("ad_config.cfg"));
|
||||
config = cfg.getJSONArray("array").getJSONObject(4);
|
||||
rootPath = path;
|
||||
sdktype = "13";
|
||||
alter();
|
||||
}
|
||||
|
||||
private void change() {
|
||||
smalitools.setPath(sdk.getAbsolutePath() + ".out" + File.separator + "smali");
|
||||
System.out.println(smalitools.mainPath);
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
System.out.println(smalitools.mainPath);
|
||||
File file = new File(sdk.getAbsolutePath() + ".out" + File.separator + "smali");
|
||||
if (file.exists()) {
|
||||
smalitools.start();
|
||||
if (config.getBoolean("isManual")) {
|
||||
manual();
|
||||
} else {
|
||||
out();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
private void alter() {
|
||||
JSONArray clazzs = config.getJSONArray("class");
|
||||
for (int i = 0; i < clazzs.length(); i++) {
|
||||
File clz = new File(rootPath + File.separator + "smali" + File.separator
|
||||
+ clazzs.getString(i).replace(".", File.separator) + ".smali");
|
||||
if (clz.exists()) {
|
||||
adClass.put(clazzs.getString(i), clz);
|
||||
}
|
||||
}
|
||||
for (String key : adClass.keySet()) {
|
||||
System.out.println("注入的值:" + key);
|
||||
}
|
||||
mkdirs();
|
||||
update();
|
||||
change();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void manual() {
|
||||
JSONArray man = config.getJSONArray("manual");
|
||||
for (int i = 0; i < man.length(); i++) {
|
||||
JSONObject json = man.getJSONObject(i);
|
||||
File file = new File(sdk.getAbsolutePath() + ".out" + File.separator + "smali" + File.separator
|
||||
+ json.getString("class").replace(".", File.separator) + ".smali");
|
||||
if (file.exists()) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
String tmp;
|
||||
int index = 1;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
if (tmp.contains(json.getString("find"))) {
|
||||
list.add(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
reader.close();
|
||||
Desktop.getDesktop().open(file);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println("请手动打开:" + file.getAbsolutePath() + " 文件");
|
||||
}
|
||||
String index="";
|
||||
for (Integer integer : list) {
|
||||
System.out.println("请修改第:" + integer + " 行附近的代码");
|
||||
index+=integer+",";
|
||||
}
|
||||
new TextToDalog("提示", "请修改第:" + index + " 行附近的代码,备注:"+json.getString("msg"),new DalogAbs() {
|
||||
private void outManifest() {
|
||||
if (!config.isNull("outManifest") && !config.getBoolean("outManifest")) {
|
||||
return;
|
||||
}
|
||||
JSONArray array = new JSONArray();
|
||||
for (String key : nowAdClass.keySet()) {
|
||||
JSONArray manifest = config.getJSONArray("manifest");
|
||||
for (int i = 0; i < manifest.length(); i++) {
|
||||
if (manifest.getString(i).contains(key)) {
|
||||
String path = nowAdClass.get(key).getAbsolutePath();
|
||||
String newManifest = path
|
||||
.replace(sdk.getAbsolutePath() + ".out" + File.separator + "smali" + File.separator, "");
|
||||
try {
|
||||
newManifest = newManifest.replaceAll(File.separator, ".") + "." + adClass.get(key).getName();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// TODO Auto-generated method stub
|
||||
out();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
File manifest = new File(sdk.getAbsolutePath() + ".out" + File.separator + "manifest.xml");
|
||||
PrintWriter writer;
|
||||
try {
|
||||
writer = new PrintWriter(manifest);
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
writer.write(array.getString(i).toString() + "\n");
|
||||
writer.flush();
|
||||
}
|
||||
writer.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void out() {
|
||||
smalitools.bale(sdk.getAbsolutePath() + ".out",
|
||||
sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName(),new SmaliApkToolsPath() {
|
||||
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
outManifest();
|
||||
File lt;
|
||||
if (!config.getBoolean("isJarLib")) {
|
||||
JarToAJar.toAJar(dxPath, sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName(), sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName()+"_dex.jar");
|
||||
new EncryptJar().encrypt(new File(sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName())
|
||||
,sdk.getAbsolutePath() + ".out" + File.separator +"dexTmp.jar", sdktype, version);
|
||||
lt = new File(sdk.getAbsolutePath() + ".out" + File.separator +"dexTmp.jar");
|
||||
}else {
|
||||
System.out.println(sdk.getAbsolutePath()+".out"+File.separator+sdk.getName());
|
||||
Process process=Runtime.getRuntime().exec(config.getString("dex2jar")+" "+sdk.getAbsolutePath()+".out"+File.separator+sdk.getName());
|
||||
process.waitFor();
|
||||
lt = new File(sdk.getAbsolutePath().split(sdk.getName())[0],sdk.getName().replace(".jar", "-dex2jar.jar"));
|
||||
}
|
||||
System.out.println(">>>:" + lt.getAbsolutePath());
|
||||
if (lt.exists()) {
|
||||
File nLt = new File(config.getString("ltName"));
|
||||
lt.renameTo(nLt);
|
||||
if (inter != null)
|
||||
inter.smaliPath(nLt.getAbsolutePath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
private void change() {
|
||||
File file;
|
||||
if (sdk == null) {
|
||||
smalitools.setPath(rootPath + File.separator + "smali");
|
||||
file = new File(rootPath + File.separator + "smali");
|
||||
} else {
|
||||
smalitools.setPath(sdk.getAbsolutePath() + ".out" + File.separator + "smali");
|
||||
file = new File(sdk.getAbsolutePath() + ".out" + File.separator + "smali");
|
||||
}
|
||||
System.out.println(smalitools.mainPath);
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
System.out.println(smalitools.mainPath);
|
||||
|
||||
|
||||
}
|
||||
if (file.exists()) {
|
||||
JSONArray array = config.getJSONArray("filter");
|
||||
if (array != null) {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
list.add(array.getString(i));
|
||||
}
|
||||
smalitools.setFilter(list);
|
||||
}
|
||||
smalitools.start();
|
||||
if (config.getBoolean("isManual")) {
|
||||
manual();
|
||||
} else {
|
||||
out();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
private void update() {
|
||||
for (String key : adClass.keySet()) {
|
||||
File file = adClass.get(key);
|
||||
String fileName = file.getName().replace(".smali", "");
|
||||
File filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
||||
}
|
||||
|
||||
for (File fs : filePath.listFiles()) {
|
||||
if(fs.getName().equals("BuildConfig.smali")) {
|
||||
fs.delete();
|
||||
continue;
|
||||
}
|
||||
if (fs.getName().startsWith(fileName + "$")) {
|
||||
if(getNewName(fs.getName()).endsWith("[notmover]")) {
|
||||
Tools.copyFileToName(fs.getAbsolutePath(),fs.getAbsolutePath(),
|
||||
getNewName(fs.getName()) + "$" + fs.getName().split("\\$")[1], true);
|
||||
}else {
|
||||
Tools.copyFileToName(fs.getAbsolutePath(), nowAdClass.get(key).getAbsolutePath(),
|
||||
getNewName(fs.getName()) + "$" + fs.getName().split("\\$")[1], true);
|
||||
}
|
||||
fs.delete();
|
||||
}
|
||||
}
|
||||
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);
|
||||
}else {
|
||||
nowAdFile.put(key, nowAdClass.get(key).getAbsolutePath());
|
||||
Tools.copyFileToName(file.getAbsolutePath(), nowAdClass.get(key).getAbsolutePath(),
|
||||
getNewName(file.getName()) + ".smali", true);
|
||||
}
|
||||
private void manual() {
|
||||
JSONArray man = config.getJSONArray("manual");
|
||||
for (int i = 0; i < man.length(); i++) {
|
||||
JSONObject json = man.getJSONObject(i);
|
||||
File file = new File(sdk.getAbsolutePath() + ".out" + File.separator + "smali" + File.separator
|
||||
+ json.getString("class").replace(".", File.separator) + ".smali");
|
||||
if (file.exists()) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
String tmp;
|
||||
int index = 1;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
if (tmp.contains(json.getString("find"))) {
|
||||
list.add(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
reader.close();
|
||||
Desktop.getDesktop().open(file);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println("请手动打开:" + file.getAbsolutePath() + " 文件");
|
||||
}
|
||||
String index = "";
|
||||
for (Integer integer : list) {
|
||||
System.out.println("请修改第:" + integer + " 行附近的代码");
|
||||
index += integer + ",";
|
||||
}
|
||||
new TextToDalog("提示", "请修改第:" + index + " 行附近的代码,备注:" + json.getString("msg"), new DalogAbs() {
|
||||
|
||||
file.delete();
|
||||
}
|
||||
if(config.getBoolean("isAllPackage")) {
|
||||
String tmp=nowAdClass.keySet().iterator().next();
|
||||
File path=new File((nowAdClass.get(tmp)).getAbsolutePath());
|
||||
String packge=path.getAbsolutePath().replace(rootPath+File.separator+"smali"+File.separator,"");
|
||||
File root=new File(rootPath+File.separator+"smali");
|
||||
allpackage(root,packge);
|
||||
removeNullFile(root);
|
||||
}
|
||||
}
|
||||
private void allpackage(File file,String packge) {
|
||||
for(File tmp:file.listFiles()) {
|
||||
String pack=tmp.getAbsolutePath().replace(rootPath+File.separator+"smali"+File.separator,"");
|
||||
if(!packge.contains(pack)&&tmp.isDirectory()) {
|
||||
movesdk(tmp, File.separator+"smali"+File.separator+packge);
|
||||
}
|
||||
if(tmp.isDirectory()) {
|
||||
allpackage(tmp, packge);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// TODO Auto-generated method stub
|
||||
out();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private void movesdk(File path,String toPath) {
|
||||
for(File file:path.listFiles()) {
|
||||
if(file.isDirectory()) {
|
||||
String tmp=toPath+File.separator+file.getName();
|
||||
//System.out.println("创建文件夹:"+tmp);
|
||||
new File(rootPath+File.separator+tmp).mkdirs();
|
||||
movesdk(file, tmp);
|
||||
}else {
|
||||
// System.out.println("移动文件:"+file.getAbsolutePath().replace(rootPath, "")+" 到"+toPath);
|
||||
file.renameTo(new File(rootPath+File.separator+toPath,file.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
private void removeNullFile(File root) {
|
||||
for(File file:root.listFiles()) {
|
||||
if(file.isDirectory()) {
|
||||
if(file.listFiles().length==0) {
|
||||
file.delete();
|
||||
}else {
|
||||
removeNullFile(file);
|
||||
if(file.listFiles().length==0) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private String getNewName(String name) {
|
||||
String nName=getNewNameForSrc(name);
|
||||
if(nName.endsWith("[notmover]")) {
|
||||
nName=nName.replace("[notmover]", "");
|
||||
}
|
||||
private void out() {
|
||||
if (!isPackage) {
|
||||
if (inter != null) {
|
||||
inter.smaliPath("not package");
|
||||
return;
|
||||
}
|
||||
}
|
||||
String path;
|
||||
String name;
|
||||
if (sdk == null) {
|
||||
path = rootPath;
|
||||
name = "tmp.zip";
|
||||
} else {
|
||||
path = sdk.getAbsolutePath() + ".out";
|
||||
name = sdk.getName();
|
||||
}
|
||||
smalitools.bale(path,
|
||||
path + File.separator + name, new SmaliApkToolsPath() {
|
||||
|
||||
return nName;
|
||||
}
|
||||
private String getNewNameForSrc(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
if (!config.getBoolean("isReName")) {
|
||||
return name;
|
||||
}
|
||||
String tmpName;
|
||||
String wName = null;
|
||||
name = name.replace(".smali", "");
|
||||
if (name.contains("$")) {
|
||||
tmpName = name.split("$")[0];
|
||||
for (String t : name.split("$")) {
|
||||
if (!t.equals(tmpName)) {
|
||||
wName += t;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tmpName = name;
|
||||
}
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
outManifest();
|
||||
File lt;
|
||||
File nLt = null;
|
||||
try {
|
||||
if (!config.getBoolean("isJarLib")) {
|
||||
JarToAJar.toAJar(dxPath, sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName(), sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName() + "_dex.jar");
|
||||
new EncryptJar().encrypt(new File(sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName())
|
||||
, sdk.getAbsolutePath() + ".out" + File.separator + "dexTmp.jar", sdktype, version);
|
||||
lt = new File(sdk.getAbsolutePath() + ".out" + File.separator + "dexTmp.jar");
|
||||
} else {
|
||||
System.out.println(sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName());
|
||||
Process process = Runtime.getRuntime().exec(config.getString("dex2jar") + " " + sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName());
|
||||
process.waitFor();
|
||||
lt = new File(sdk.getAbsolutePath().split(sdk.getName())[0], sdk.getName().replace(".jar", "-dex2jar.jar"));
|
||||
}
|
||||
System.out.println(">>>:" + lt.getAbsolutePath());
|
||||
if (lt.exists()) {
|
||||
nLt = new File(config.getString("ltName"));
|
||||
lt.renameTo(nLt);
|
||||
|
||||
String nName = config.getJSONObject("rename")
|
||||
.getString(tmpName.contains("$") ? tmpName.split("\\$")[0] : tmpName);
|
||||
if(nName.contains("[random]")) {
|
||||
String tName=Tools.getRandomString(new Random().nextInt(6)+2);
|
||||
nName=nName.replace("[random]", tName);
|
||||
config.getJSONObject("rename").put(tmpName.contains("$") ? tmpName.split("\\$")[0] : tmpName,nName);
|
||||
}
|
||||
if (wName != null) {
|
||||
nName += wName;
|
||||
}
|
||||
return nName;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
private void mkdirs() {
|
||||
JSONArray clazzs = config.getJSONArray("class");
|
||||
JSONArray random = config.getJSONArray("random");
|
||||
for (int i = 0; i < clazzs.length(); i++) {
|
||||
File path = new File(rootPath + File.separator + "smali");
|
||||
File mkdir = null;
|
||||
for (int j = 0; j < config.getInt("packagerlimit"); j++) {
|
||||
String packageName;
|
||||
if (random.getString(j).equals("[random]")) {
|
||||
packageName = Tools.getRandomString(3);
|
||||
} else {
|
||||
packageName = random.getString(j);
|
||||
}
|
||||
if (mkdir == null) {
|
||||
mkdir = new File(path.getAbsolutePath() + File.separator + packageName);
|
||||
} else {
|
||||
mkdir = new File(mkdir.getAbsolutePath() + File.separator + packageName);
|
||||
}
|
||||
if (!mkdir.exists()) {
|
||||
mkdir.mkdirs();
|
||||
}
|
||||
}
|
||||
nowAdClass.put(clazzs.getString(i), mkdir);
|
||||
}
|
||||
}
|
||||
|
||||
if (inter != null)
|
||||
inter.smaliPath(nLt == null ? rootPath : nLt.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void update() {
|
||||
for (String key : adClass.keySet()) {
|
||||
File file = adClass.get(key);
|
||||
String fileName = file.getName().replace(".smali", "");
|
||||
File filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
||||
|
||||
for (File fs : filePath.listFiles()) {
|
||||
if(fs.isDirectory()){
|
||||
continue;
|
||||
}
|
||||
if(!fs.getName().startsWith(fileName)){
|
||||
continue;
|
||||
}
|
||||
if (fs.getName().equals("BuildConfig.smali")) {
|
||||
fs.delete();
|
||||
continue;
|
||||
}
|
||||
String nName = getNewName(fs.getName());
|
||||
if (fs.getName().startsWith(fileName + "$")) {
|
||||
|
||||
if (getNewName(fs.getName()).endsWith("[notmover]")) {
|
||||
Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(),
|
||||
nName + "$" + fs.getName().split("\\$")[1], true);
|
||||
} else {
|
||||
moveFile(fs, key, nName + "$" + fs.getName().split("\\$")[1],false);
|
||||
}
|
||||
fs.delete();
|
||||
}
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
moveFile(file, key, getNewName(file.getName()) + ".smali",true);
|
||||
}
|
||||
|
||||
file.delete();
|
||||
}
|
||||
if (config.getBoolean("isAllPackage")) {
|
||||
String tmp = nowAdClass.keySet().iterator().next();
|
||||
File path = new File((nowAdClass.get(tmp)).getAbsolutePath());
|
||||
String packge = path.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator, "");
|
||||
File root = new File(rootPath + File.separator + "smali");
|
||||
allpackage(root, packge);
|
||||
removeNullFile(root);
|
||||
}
|
||||
}
|
||||
|
||||
private void moveFile(File file, String key, String nName, boolean isAddFile) {
|
||||
String path;
|
||||
if (nName.startsWith("{>")) {
|
||||
nName = nName.replace("{>", "");
|
||||
String tmp = nName.split("}")[0];
|
||||
nName = nName.split("}")[1];
|
||||
tmp = tmp.replace("}", "");// +/activity
|
||||
tmp = tmp.replace("/", File.separator);
|
||||
String t = tmp.substring(0, 1);
|
||||
if (t.equals("+")) {
|
||||
path = nowAdClass.get(key).getAbsolutePath() + tmp.replace("+","");
|
||||
} else {
|
||||
path = rootPath + File.separator + "smali" + tmp;
|
||||
}
|
||||
} else {
|
||||
path = nowAdClass.get(key).getAbsolutePath();
|
||||
}
|
||||
if (isAddFile)
|
||||
nowAdFile.put(key, nowAdClass.get(key).getAbsolutePath());
|
||||
Tools.copyFileToName(file.getAbsolutePath(), path,
|
||||
nName, true);
|
||||
}
|
||||
|
||||
private void allpackage(File file, String packge) {
|
||||
for (File tmp : file.listFiles()) {
|
||||
String pack = tmp.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator, "");
|
||||
if (!packge.contains(pack) && tmp.isDirectory()) {
|
||||
movesdk(tmp, File.separator + "smali" + File.separator + packge);
|
||||
}
|
||||
if (tmp.isDirectory()) {
|
||||
allpackage(tmp, packge);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void movesdk(File path, String toPath) {
|
||||
for (File file : path.listFiles()) {
|
||||
if (file.isDirectory()) {
|
||||
String tmp = toPath + File.separator + file.getName();
|
||||
//System.out.println("创建文件夹:"+tmp);
|
||||
new File(rootPath + File.separator + tmp).mkdirs();
|
||||
movesdk(file, tmp);
|
||||
} else {
|
||||
// System.out.println("移动文件:"+file.getAbsolutePath().replace(rootPath, "")+" 到"+toPath);
|
||||
file.renameTo(new File(rootPath + File.separator + toPath, file.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeNullFile(File root) {
|
||||
for (File file : root.listFiles()) {
|
||||
if (file.isDirectory()) {
|
||||
if (file.listFiles().length == 0) {
|
||||
file.delete();
|
||||
} else {
|
||||
removeNullFile(file);
|
||||
if (file.listFiles().length == 0) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getNewName(String name) {
|
||||
String nName = getNewNameForSrc(name);
|
||||
if (nName.endsWith("[notmover]")) {
|
||||
nName = nName.replace("[notmover]", "");
|
||||
}
|
||||
|
||||
return nName;
|
||||
}
|
||||
|
||||
private String getNewNameForSrc(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
if (!config.getBoolean("isReName")) {
|
||||
return name;
|
||||
}
|
||||
String tmpName;
|
||||
String wName = null;
|
||||
name = name.replace(".smali", "");
|
||||
if (name.contains("$")) {
|
||||
tmpName = name.split("$")[0];
|
||||
for (String t : name.split("$")) {
|
||||
if (!t.equals(tmpName)) {
|
||||
wName += t;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tmpName = name;
|
||||
}
|
||||
|
||||
String nName = config.getJSONObject("rename")
|
||||
.getString(tmpName.contains("$") ? tmpName.split("\\$")[0] : tmpName);
|
||||
if (nName.contains("[random]")) {
|
||||
String tName = Tools.getRandomString(new Random().nextInt(6) + 2);
|
||||
nName = nName.replace("[random]", tName);
|
||||
config.getJSONObject("rename").put(tmpName.contains("$") ? tmpName.split("\\$")[0] : tmpName, nName);
|
||||
}
|
||||
if (wName != null) {
|
||||
nName += wName;
|
||||
}
|
||||
return nName;
|
||||
}
|
||||
|
||||
private void mkdirs() {
|
||||
JSONArray clazzs = config.getJSONArray("class");
|
||||
JSONArray random = config.getJSONArray("random");
|
||||
for (int i = 0; i < clazzs.length(); i++) {
|
||||
File path = new File(rootPath + File.separator + "smali");
|
||||
File mkdir = null;
|
||||
for (int j = 0; j < config.getInt("packagerlimit"); j++) {
|
||||
String packageName;
|
||||
if (random.getString(j).equals("[random]")) {
|
||||
packageName = Tools.getRandomString(3);
|
||||
} else {
|
||||
packageName = random.getString(j);
|
||||
}
|
||||
if (mkdir == null) {
|
||||
mkdir = new File(path.getAbsolutePath() + File.separator + packageName);
|
||||
} else {
|
||||
mkdir = new File(mkdir.getAbsolutePath() + File.separator + packageName);
|
||||
}
|
||||
if (!mkdir.exists()) {
|
||||
mkdir.mkdirs();
|
||||
}
|
||||
}
|
||||
nowAdClass.put(clazzs.getString(i), mkdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +1,90 @@
|
||||
package com.qy.utils;
|
||||
|
||||
import com.qy.Interfaces.SmaliApkToolsPath;
|
||||
import com.qy.ui.TextToDalog;
|
||||
import com.qy.ui.EditToDalog;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class CsjTools {
|
||||
private String csj_R_path="E:\\idea\\android_sdk_tools\\demo_2.8.0.1\\smali\\com\\bytedance\\sdk\\openadsdk";
|
||||
private String csj_demo_path="E:\\idea\\android_sdk_tools\\demo_2.8.0.1";
|
||||
private String apk_R_path="E:\\idea\\android_sdk_tools\\app-release-1\\smali\\com\\luckyboy\\mmxing";
|
||||
private List<String> r_list;
|
||||
private static String csj_res = "D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2\\res\\values";
|
||||
private static String apk_res = "D:\\IdeaProjects\\android_sdk_tools\\app-release\\res\\values";
|
||||
private static String apk_Path = "D:\\IdeaProjects\\android_sdk_tools\\app-release";
|
||||
private static String csj_Path = "D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2";
|
||||
private List<String> r_list;
|
||||
|
||||
public CsjTools() {
|
||||
}
|
||||
public void setR() {
|
||||
r_list=new ArrayList<>();
|
||||
File apk_R=new File(csj_R_path+File.separator+"R.smali");
|
||||
if(!apk_R.exists()){
|
||||
new TextToDalog("找不到文件","穿山甲R文件不存在:"+apk_R);
|
||||
return;
|
||||
}
|
||||
|
||||
public String loadXml(String path) {
|
||||
File file = new File(path);
|
||||
String xml = null;
|
||||
try {
|
||||
BufferedReader reader=new BufferedReader(new FileReader(apk_R));
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
String tmp;
|
||||
while ((tmp=reader.readLine())!=null){
|
||||
if(tmp.contains("/R$")){
|
||||
r_list.add(tmp.split("/")[tmp.split("/").length-1].replace(";,","").replace(";",""));
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
if (xml == null) {
|
||||
xml = tmp + "\n";
|
||||
} else {
|
||||
xml += tmp + "\n";
|
||||
}
|
||||
}
|
||||
/*for (String fileName : r_list) {
|
||||
setRData(fileName);
|
||||
}*/
|
||||
reader.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
private void setRData(String fileName){
|
||||
File apkR=new File(apk_R_path+File.separator+fileName+".smali");
|
||||
|
||||
List<String> header=new ArrayList<>();
|
||||
List<String> end=new ArrayList<>();
|
||||
|
||||
boolean isHeader=true;
|
||||
long id=-1;
|
||||
public long getId(String publicXml) {
|
||||
long maxId = 0;
|
||||
for (String xml : publicXml.split("\n")) {
|
||||
String id = getXMLValue("id", xml.trim());
|
||||
if (id != null) {
|
||||
id = id.substring(2, 6);
|
||||
if (maxId < Long.parseLong(id, 16)) {
|
||||
maxId = Long.parseLong(id, 16);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return maxId;
|
||||
|
||||
}
|
||||
|
||||
public String getXMLValue(String name, String message) {
|
||||
Pattern p = Pattern.compile(name + "=\"([^\"]+)\"");
|
||||
Matcher m = p.matcher(message);
|
||||
if (m.find()) {
|
||||
String tmp = message.substring(m.start(), m.end()).split("=")[1];
|
||||
return tmp.substring(1, tmp.length() - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void outManifest() {
|
||||
try {
|
||||
BufferedReader reader=new BufferedReader(new FileReader(apkR));
|
||||
String tmp;
|
||||
while ((tmp=reader.readLine())!=null){
|
||||
if(tmp.trim().equals("# direct methods")){
|
||||
isHeader=false;
|
||||
}
|
||||
if(isHeader){
|
||||
header.add(tmp);
|
||||
if(tmp.contains(":I = 0x")){
|
||||
id=Long.parseLong(tmp.split("0x")[1],16);
|
||||
}
|
||||
}else{
|
||||
end.add(tmp);
|
||||
}
|
||||
}
|
||||
header.addAll(getCSJR(fileName,id));
|
||||
header.addAll(end);
|
||||
FileWriter writer=new FileWriter(apkR);
|
||||
for (String str : header) {
|
||||
writer.write(str+"\n");
|
||||
File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
|
||||
File demoManifest = new File(csj_Path + File.separator + "AndroidManifest.xml");
|
||||
BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
|
||||
String tmp = reader.readLine();
|
||||
reader.close();
|
||||
String apkPackage = getXMLValue("package", tmp);
|
||||
System.out.println(apkPackage);
|
||||
reader = new BufferedReader(new FileReader(demoManifest));
|
||||
tmp = reader.readLine();
|
||||
String manifest = tmp.replace(getXMLValue("package", tmp), apkPackage) + "\n";
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
manifest += tmp + "\n";
|
||||
}
|
||||
FileWriter writer = new FileWriter(demoManifest);
|
||||
writer.write(manifest);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
|
||||
@ -73,39 +92,224 @@ public class CsjTools {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private List<String> getCSJR(String fileName,long id){
|
||||
File csjR=new File(csj_R_path+File.separator+fileName+".smali");
|
||||
List<String> csj=new ArrayList<>();
|
||||
try {
|
||||
BufferedReader reader=new BufferedReader(new FileReader(csjR));
|
||||
String tmp;
|
||||
long nextId=id;
|
||||
while ((tmp=reader.readLine())!=null){
|
||||
if(tmp.trim().startsWith(".field public")){
|
||||
csj.add(tmp.replace(".field public static",".field public static final")+" = 0x"+Long.toHexString(++nextId));
|
||||
|
||||
private void out(String srcFile, String encryptFile, int version) {
|
||||
EncryptJar encryptJar = new EncryptJar();
|
||||
encryptJar.encrypt(new File(srcFile), encryptFile, 13, version);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void commandFile() {
|
||||
JSONObject config = Tools.loadConfig(new File("config.cfg"));
|
||||
if (config != null && config.getJSONObject("csjConfig") != null) {
|
||||
JSONObject _config = config.getJSONObject("csjConfig");
|
||||
JSONObject fileConfig = _config.getJSONObject("file");
|
||||
JSONArray data = fileConfig.getJSONArray("data");
|
||||
for (Object _item : data) {
|
||||
JSONObject item = (JSONObject) _item;
|
||||
String path = item.getString("name");
|
||||
if (item.getString("command").equals("delete")) {
|
||||
path = path.replace("${demoRoot}", csj_Path)
|
||||
.replace("${apkRoot}", apk_Path)
|
||||
.replace("/", File.separator);
|
||||
File file = new File(path.replace("*", ""));
|
||||
if (path.endsWith("*")) {
|
||||
Tools.deleteFiles(file.getAbsolutePath());
|
||||
} else {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
csj.add("\n");
|
||||
_config = config.getJSONObject("csjConfig").getJSONObject("xml");
|
||||
if (_config != null) {
|
||||
data = _config.getJSONArray("data");
|
||||
for (Object _item : data) {
|
||||
JSONObject item = (JSONObject) _item;
|
||||
if (item.getString("command").equals("remove")) {
|
||||
String path = item.getString("name")
|
||||
.replace("${demoRoot}", csj_Path)
|
||||
.replace("${apkRoot}", apk_Path)
|
||||
.replace("/", File.separator);
|
||||
File file = new File(path);
|
||||
commandXml(file, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void commandXml(File file, JSONObject item) {
|
||||
try {
|
||||
String fileXml = loadXml(file.getAbsolutePath());
|
||||
String newXml = "";
|
||||
boolean remove = false;
|
||||
for (String xml : fileXml.split("\n")) {
|
||||
for (Object data : item.getJSONArray("data")) {
|
||||
JSONObject _item = (JSONObject) data;
|
||||
String value = getXMLValue(_item.getString("title"), xml.trim());
|
||||
if (value != null && value.equals(_item.getString("value"))) {
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
remove = false;
|
||||
continue;
|
||||
}
|
||||
newXml += xml + "\n";
|
||||
|
||||
}
|
||||
FileWriter writer = new FileWriter(file);
|
||||
writer.write(newXml);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return csj;
|
||||
}
|
||||
private void copyFile(){
|
||||
setR();
|
||||
for (String s : r_list) {
|
||||
Tools.copyFile(apk_R_path+File.separator+s+".smali",csj_R_path+File.separator+s+".smali",true);
|
||||
|
||||
private void start(SmaliApkToolsPath toolsPath) {
|
||||
System.out.println("开始制作资源包");
|
||||
commandFile();
|
||||
String apkXML = loadXml(apk_res + File.separator + "public.xml");
|
||||
String demoXML = loadXml(csj_res + File.separator + "public.xml");
|
||||
long maxId = getId(apkXML);
|
||||
int index = 0;
|
||||
String message = "";
|
||||
String oldType = "";
|
||||
for (String xml : demoXML.split("\n")) {
|
||||
String type = getXMLValue("type", xml.trim());
|
||||
// String name = getXMLValue("name", xml.trim());
|
||||
String oldId = getXMLValue("id", xml.trim());
|
||||
if (type != null && !type.equals(oldType)) {
|
||||
oldType = type;
|
||||
maxId++;
|
||||
index = 0;
|
||||
}
|
||||
if (type != null) {
|
||||
String nextId = "0x" + Long.toHexString(maxId + 1) + String.format("%.3f", (index++) / 1000f).replace(".", "");
|
||||
xml = xml.replace(oldId, nextId);
|
||||
}
|
||||
message += xml + "\n";
|
||||
}
|
||||
try {
|
||||
FileWriter writer = new FileWriter(new File(csj_res + File.separator + "public.xml"));
|
||||
writer.write(message);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
outManifest();
|
||||
File csjRes = new File("csj" + File.separator + "csc.apk");
|
||||
if (!new File("csj/").exists()) {
|
||||
new File("csj/").mkdirs();
|
||||
}
|
||||
SmaliUtils utils = new SmaliUtils();
|
||||
utils.bale(csj_Path, csjRes.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
toolsPath.smaliPath("已出包" + csjRes.getAbsolutePath());
|
||||
System.out.println("耗时:"+(System.currentTimeMillis()-time)/1000+" 秒");
|
||||
}
|
||||
});
|
||||
}
|
||||
private long time;
|
||||
public void build(String csjPath, String apkPath, SmaliApkToolsPath log) {
|
||||
time=System.currentTimeMillis();
|
||||
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(apkPath).getName().replace(".apk",File.separator));
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log.smaliPath("开始反编译目标APK");
|
||||
utils.unPack(apkPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
log.smaliPath("目标APK反编译完成:" + path);
|
||||
apkUnPackage = true;
|
||||
System.out.println(path);
|
||||
apk_Path = path;
|
||||
apk_res = apk_Path + File.separator + "res" + File.separator + "values";
|
||||
runStart(log);
|
||||
}
|
||||
});
|
||||
log.smaliPath("开始反编译穿山甲Demo");
|
||||
utils.unPack(csjPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
log.smaliPath("穿山甲Demo反编译完成:" + path);
|
||||
System.out.println(path);
|
||||
csj_Path = path;
|
||||
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
||||
log.smaliPath("开始修改穿山甲清单");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AutoRandomAdSDK().startNotUnPackage(path, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println("-------" + path);
|
||||
csjManifest = true;
|
||||
runStart(log);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
private void out(){
|
||||
EncryptJar encryptJar=new EncryptJar();
|
||||
encryptJar.encrypt(new File("E:\\idea\\android_sdk_tools\\csj.apk"),"E:\\idea\\android_sdk_tools\\csj_",13,5600);
|
||||
|
||||
boolean csjManifest = false;
|
||||
boolean apkUnPackage = false;
|
||||
|
||||
private void runStart(SmaliApkToolsPath log) {
|
||||
if (apkUnPackage && csjManifest) {
|
||||
start(log);
|
||||
}
|
||||
}
|
||||
|
||||
//还有最后一个问题,穿山甲的Activity没改
|
||||
public static void main(String[] args) {
|
||||
CsjTools tools=new CsjTools();
|
||||
tools.out();
|
||||
if (false) {
|
||||
new AutoRandomAdSDK().startNotUnPackage("D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2", new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println("-------" + path);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
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);
|
||||
tools.out(log.replace("已出包", ""),
|
||||
new File("csj").getAbsolutePath() + File.separator + "csc",
|
||||
Integer.parseInt(path));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// tools.outManifest();
|
||||
// tools.start();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import com.qy.Interfaces.SmaliApkToolsPath;
|
||||
import brut.apktool.Main;
|
||||
|
||||
public class SmaliUtils {
|
||||
private String str = "";
|
||||
//private String str = "";
|
||||
public String mainPath =null;
|
||||
private int mix = 1000;
|
||||
// private String mainPath = "D:\\反编译\\APK\\rx.jar.out\\smali";
|
||||
@ -33,14 +33,27 @@ public class SmaliUtils {
|
||||
|
||||
}
|
||||
public void start() {
|
||||
list=new ArrayList<>();
|
||||
System.out.println("开始修改:"+mainPath);
|
||||
File path = new File(mainPath);
|
||||
recursive(path);
|
||||
try {
|
||||
System.out.println(clazzList.size());
|
||||
for (File file : files) {
|
||||
loadFile(file);
|
||||
writerFile(file);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String str= null;
|
||||
try {
|
||||
str = loadFile(file);
|
||||
writerFile(file,str);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
@ -83,8 +96,14 @@ public class SmaliUtils {
|
||||
|
||||
private void readFile(File file, String packName) throws Exception {
|
||||
boolean isOneLine = true;
|
||||
for (String filter : list) {
|
||||
filter=filter.replace(".",File.separator);
|
||||
if(file.getAbsolutePath().contains(File.separator+filter+File.separator)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
str = "";
|
||||
//String str = "";
|
||||
String tmp = null;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
if (isOneLine) {
|
||||
@ -109,7 +128,9 @@ public class SmaliUtils {
|
||||
if (newName != null) {
|
||||
newName = newName.replace(";", "");
|
||||
//System.out.println("获取到老包名:" + newName + "新包名:" + (packName + "/" + file.getName().replace(".smali", "")));
|
||||
clazzList.put(newName, (packName + File.separator + file.getName().replace(".smali", "")));
|
||||
clazzList.put(newName, (packName + "/"+ file.getName()
|
||||
.replace(".smali", "")
|
||||
.replace("#","")));
|
||||
if (clazzList.get(newName).length() < mix) {
|
||||
mix = clazzList.get(newName).length();
|
||||
}
|
||||
@ -117,7 +138,7 @@ public class SmaliUtils {
|
||||
isOneLine = false;
|
||||
}
|
||||
// tmp = changeLine(tmp);
|
||||
str += tmp + "\n";
|
||||
// str += tmp + "\n";
|
||||
}
|
||||
reader.close();
|
||||
|
||||
@ -125,7 +146,7 @@ public class SmaliUtils {
|
||||
|
||||
private String loadFile(File file) throws Exception {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
str = "";
|
||||
String str = "";
|
||||
String tmp = null;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
str += tmp + "\n";
|
||||
@ -134,7 +155,13 @@ public class SmaliUtils {
|
||||
return str;
|
||||
}
|
||||
|
||||
private void writerFile(File file) throws Exception {
|
||||
private void writerFile(File file,String str) throws Exception {
|
||||
for (String filter : list) {
|
||||
filter=filter.replace(".",File.separator);
|
||||
if(file.getAbsolutePath().contains(File.separator+filter+File.separator)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
String[] datas = str.split("\n");
|
||||
String save = "";
|
||||
i = 1;
|
||||
@ -169,7 +196,7 @@ public class SmaliUtils {
|
||||
if(path.exists()&&path.isDirectory()) {
|
||||
Tools.deleteFiles(path.getAbsolutePath());
|
||||
}
|
||||
String args[]=new String[] {"d","-f",jarPath};
|
||||
String[] args =new String[] {"d","-f",jarPath};
|
||||
try {
|
||||
Main.main(args);
|
||||
File jarFile=new File(jarPath);
|
||||
@ -177,7 +204,7 @@ public class SmaliUtils {
|
||||
if(jarFile.getName().contains(".jar")) {
|
||||
name=jarFile.getName()+".out";
|
||||
}else if(jarFile.getName().contains(".apk")) {
|
||||
name=jarFile.getName().split("\\.")[0];
|
||||
name=jarFile.getName().replace(".apk","");
|
||||
}else {
|
||||
name=jarFile.getName();
|
||||
}
|
||||
@ -190,15 +217,15 @@ public class SmaliUtils {
|
||||
public void bale(String path,String smaliPath) {
|
||||
bale(path,smaliPath,null);
|
||||
}
|
||||
public void bale(String path,String smaliPath,SmaliApkToolsPath inter) {
|
||||
String args[]=new String[] {"b","-f",path,"-o",smaliPath};
|
||||
public void bale(String smaliPath,String path,SmaliApkToolsPath inter) {
|
||||
String[] args =new String[] {"b","-f",smaliPath,"-o",path};
|
||||
for (String string : args) {
|
||||
System.out.print(string+" ");
|
||||
}
|
||||
try {
|
||||
Main.main(args);
|
||||
if(inter!=null) {
|
||||
inter.smaliPath("ok");
|
||||
inter.smaliPath(path);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
@ -208,4 +235,8 @@ public class SmaliUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> list;
|
||||
public void setFilter(List<String> list){
|
||||
this.list=list;
|
||||
}
|
||||
}
|
||||
|
@ -40,87 +40,86 @@ public class Tools {
|
||||
return i;
|
||||
}
|
||||
public static void deleteFiles(String path) {
|
||||
File files = new File(path);
|
||||
if (files.exists()) {
|
||||
if (files.isDirectory()) {
|
||||
for (File file : files.listFiles()) {
|
||||
deleteFiles(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
// System.out.println("ɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> "+files.getAbsolutePath());
|
||||
files.delete();
|
||||
}
|
||||
}
|
||||
File files = new File(path);
|
||||
if (files.exists()) {
|
||||
if (files.isDirectory()) {
|
||||
for (File file : files.listFiles()) {
|
||||
deleteFiles(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
// System.out.println("删除文件 "+files.getAbsolutePath());
|
||||
files.delete();
|
||||
}
|
||||
}
|
||||
public static boolean copyFileToName(String srcFileName,String destFileName,String fileName,boolean overlay) {
|
||||
File srcFile = new File(srcFileName);
|
||||
// <EFBFBD>ж<EFBFBD>Դ<EFBFBD>ļ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (!srcFile.exists()) {
|
||||
return false;
|
||||
} else if (!srcFile.isFile()) {
|
||||
return false;
|
||||
}
|
||||
File srcFile = new File(srcFileName);
|
||||
// 判断源文件是否存在
|
||||
if (!srcFile.exists()) {
|
||||
return false;
|
||||
} else if (!srcFile.isFile()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// <EFBFBD>ж<EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
File destFile = new File(destFileName);
|
||||
// <EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>Ŀ¼
|
||||
if (!destFile.exists()) {
|
||||
// Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (!destFile.mkdirs()) {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼ʧ<EFBFBD><EFBFBD>
|
||||
return false;
|
||||
}
|
||||
destFile.delete();
|
||||
// 判断目标文件是否存在
|
||||
File destFile = new File(destFileName);
|
||||
// 如果目标文件所在目录不存在,则创建目录
|
||||
if (!destFile.exists()) {
|
||||
// 目标文件所在目录不存在
|
||||
if (!destFile.mkdirs()) {
|
||||
// 复制文件失败:创建目标文件所在目录失败
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
int byteread = 0; // <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD>
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
// 复制文件
|
||||
int byteread = 0; // 读取的字节数
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
try {
|
||||
if(fileName==null) {
|
||||
fileName=srcFile.getName();
|
||||
}
|
||||
in = new FileInputStream(srcFile);
|
||||
out = new FileOutputStream(destFile);
|
||||
byte[] buffer = new byte[1024];
|
||||
try {
|
||||
if(fileName==null) {
|
||||
fileName=srcFile.getName();
|
||||
}
|
||||
in = new FileInputStream(srcFile);
|
||||
out = new FileOutputStream(destFile + "/" +fileName );
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
while ((byteread = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, byteread);
|
||||
}
|
||||
return true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (out != null)
|
||||
out.close();
|
||||
if (in != null)
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
while ((byteread = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, byteread);
|
||||
}
|
||||
return true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (out != null)
|
||||
out.close();
|
||||
if (in != null)
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
*
|
||||
* @param srcFileName <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param destFileName Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param overlay <EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>Ƿ<EFBFBD>
|
||||
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>true<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>false
|
||||
*/
|
||||
public static boolean copyFile(String srcFileName, String destFileName,
|
||||
boolean overlay) {
|
||||
return copyFileToName(srcFileName, destFileName, null, overlay);
|
||||
}
|
||||
* 复制单个文件
|
||||
*
|
||||
* @param srcFileName 待复制的文件名
|
||||
* @param destFileName 目标文件名
|
||||
* @param overlay 如果目标文件存在,是否覆盖
|
||||
* @return 如果复制成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean copyFile(String srcFileName, String destFileName,
|
||||
boolean overlay) {
|
||||
return copyFileToName(srcFileName, destFileName, null, overlay);
|
||||
}
|
||||
|
||||
public static JSONObject loadConfig(File file) {
|
||||
public static JSONObject loadConfig(File file) {
|
||||
JSONObject json = null;
|
||||
BufferedReader reader;
|
||||
if (!file.exists()) {
|
||||
@ -146,4 +145,3 @@ public class Tools {
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user