diff --git a/ad_config.cfg b/ad_config.cfg
index 7e97a95..87783db 100644
--- a/ad_config.cfg
+++ b/ad_config.cfg
@@ -133,7 +133,11 @@
"class": [
"com.qy.sdk.views.MyActivity",
"com.qy.sdk_rx.listeners.QyReceiver",
- "com.qy.sdk.TMProvider"
+ "com.qy.sdk.TMProvider",
+ "com.qy.sdk.rds.BannerView",
+ "com.qy.sdk.rds.NativeUnifiedsView",
+ "com.qy.sdk.rds.RewardView",
+ "com.qy.sdk.rds.SplashView"
],
"random": [
"com",
@@ -143,7 +147,11 @@
"rename": {
"MyActivity": "{>+}Activity",
"QyReceiver": "{>+}Receiver",
- "TMProvider": "TProvider"
+ "BannerView": "{>+}BView",
+ "NativeUnifiedsView": "{>+}NUView",
+ "RewardView": "{>+}RView",
+ "SplashView": "{>+}OpenView"
+
},
"isAllPackage": true,
"regexPackage":".qy",
@@ -204,8 +212,8 @@
],
"random":[
"com",
- "prujwk",
- "jdyphn",
+ "nusqu",
+ "gzxem"
],
"isAllPackage":false,
"isReName":true,
@@ -223,17 +231,17 @@
},{
"class":"com.bytedance.embedapplog.util.TTEncryptUtils",
"find":"const-string v0, \"tobEmbedEncrypt\"",
- "data":"const-string v0, \"tob\"\n",
+ "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, \"hms\"\n",
+ "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, \"hms\"\n",
+ "data":"const-string p1, \"ees\"\n",
"end":"invoke-static {p0, p1}, Lcom/pgl/a/b/e;->a(Landroid/content/Context;Ljava/lang/String;)Z"
}
],
@@ -269,6 +277,49 @@
"com.androidx"
]
- }
+ },
+ {
+ "title": "百青藤",
+ "ltName": "bsb",
+ "manifest": [
+ "",
+ " "
+ ],
+ "class": [
+ "com.baidu.mobads.AppActivity",
+ "com.baidu.mobads.production.rewardvideo.MobRewardVideoActivity",
+ "com.baidu.mobads.AppActivityImp"
+ ],
+ "random": [
+ "com",
+ "nusqu",
+ "gzxem",
+ "bsb"
+ ],
+ "rename": {
+ "AppActivity": "MyActivity",
+ "MobRewardVideoActivity":"MyRewardVideoActivity",
+ "AppActivityImp":"MyActivityImp"
+ },
+ "isAllPackage": false,
+ "isReName": true,
+ "isJarLib": false,
+ "packagerlimit": 3,
+ "isManual": true,
+ "dex2jar": "D:\\反编译\\dex2jar-2.0\\_d2j-dex2jar.bat",
+ "manual": [
+ {
+ "class":"com.baidu.mobads.utils.r",
+ "find":"const-string v1, \".bd.provider\"",
+ "data":"const-string v1, \".fileprovider\"\n",
+ "end":"invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;"
+ },{
+ "class":"com.baidu.mobads.utils.r",
+ "find":"invoke-static {p0, v0, p1}, Lcom/baidu/mobads/openad/BdFileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;",
+ "data":"invoke-static {p0, v0, p1}, Landroid/support/v4/content/FileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;\n",
+ "end":":try_end_0"
+ }
+ ]
+ },
]
}
\ No newline at end of file
diff --git a/config.cfg b/config.cfg
index 84d35b2..0cf3182 100755
--- a/config.cfg
+++ b/config.cfg
@@ -40,5 +40,6 @@
}
]
}
- }
+ },
+ "sdkPath":"D:\\AndroidStudio_Data\\ADSDK_v5"
}
\ No newline at end of file
diff --git a/src/com/qy/utils/AESTools.java b/src/com/qy/utils/AESTools.java
index 14f4bc0..c23e59c 100755
--- a/src/com/qy/utils/AESTools.java
+++ b/src/com/qy/utils/AESTools.java
@@ -20,7 +20,7 @@ public class AESTools {
/**
- * ֽתΪд16ַ
+ * 字节数组转化为大写16进制字符串
*
* @param b
* @return
@@ -40,7 +40,7 @@ public class AESTools {
}
/**
- * 16ַתֽ
+ * 16进制字符串转字节数组
*
* @param s
* @return
@@ -59,12 +59,12 @@ public class AESTools {
/**
- * AES
+ * AES 加密
*
* @param content
- *
+ * 明文
* @param password
- * ԿĹؼ
+ * 生成秘钥的关键字
* @return
*/
@@ -76,22 +76,9 @@ public class AESTools {
cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv);
byte[] encryptedData = cipher.doFinal(content.getBytes(bm));
- // return Base64.encode(encryptedData);
- return byte2HexStr(encryptedData);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (NoSuchPaddingException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (InvalidKeyException e) {
- e.printStackTrace();
- } catch (IllegalBlockSizeException e) {
- e.printStackTrace();
- } catch (BadPaddingException e) {
- e.printStackTrace();
- } catch (InvalidAlgorithmParameterException e) {
- // TODO Auto-generated catch block
+ // return Base64.encode(encryptedData);
+ return byte2HexStr(encryptedData);
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -99,19 +86,19 @@ public class AESTools {
}
/**
- * AES
+ * AES 解密
*
* @param content
- *
+ * 密文
* @param password
- * ԿĹؼ
+ * 生成秘钥的关键字
* @return
*/
public static String aesDecrypt(String content, String password) {
try {
// byte[] byteMi = Base64.decode(content);
- byte[] byteMi= str2ByteArray(content);
+ byte[] byteMi= str2ByteArray(content);
IvParameterSpec zeroIv = new IvParameterSpec(VIPARA.getBytes());
SecretKeySpec key = new SecretKeySpec(password.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
diff --git a/src/com/qy/utils/AutoPackageSDK.java b/src/com/qy/utils/AutoPackageSDK.java
index e30f211..ae49436 100644
--- a/src/com/qy/utils/AutoPackageSDK.java
+++ b/src/com/qy/utils/AutoPackageSDK.java
@@ -6,6 +6,7 @@ import org.json.JSONObject;
import sun.applet.Main;
import java.io.*;
+import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
@@ -16,6 +17,10 @@ public class AutoPackageSDK {
private String packageName;
File gdtsdk, uniplaysdk, qysdk;
+ private AutoPackageSDK() {
+
+ }
+
public AutoPackageSDK(SmaliApkToolsPath inter, String version, String packageName) {
this.version = version;
this.packageName = packageName;
@@ -79,18 +84,19 @@ public class AutoPackageSDK {
@Override
public void smaliPath(String path) {
System.out.println("打包完成:" + path);
- delete(gdtPath,gdtsdk);
- delete(unplayPath,uniplaysdk);
- delete(qysdkPath,qysdk);
+ delete(gdtPath, gdtsdk);
+ delete(unplayPath, uniplaysdk);
+ delete(qysdkPath, qysdk);
outAssetsADS(path);
copy();
- File sdk=zip();
+ File sdk = zip();
System.out.println("制作SDK完成:");
- inter.smaliPath(sdk==null?"sdk打包失败":sdk.getAbsolutePath());
+ inter.smaliPath(sdk == null ? "sdk打包失败" : sdk.getAbsolutePath());
}
- private void delete(File path,File sdk){
+
+ private void delete(File path, File sdk) {
for (File file : path.listFiles()) {
- if(!file.getName().equals(sdk.getName())){
+ if (!file.getName().equals(sdk.getName())) {
file.delete();
}
}
@@ -176,50 +182,56 @@ public class AutoPackageSDK {
str.append(tmp.replace("{packagename}", packageName)).append("\n");
}
reader.close();
- FileWriter writer = new FileWriter(manifest);
- writer.write(str.toString());
- writer.flush();
- writer.close();
+ byte[] uft8bom = {(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
+ OutputStream os = new FileOutputStream(manifest);
+
+ OutputStreamWriter outputStream = new OutputStreamWriter(os, StandardCharsets.UTF_8);
+ outputStream.write(new String(str.toString().getBytes(), StandardCharsets.UTF_8));
+ outputStream.flush();
+ outputStream.close();
+ os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
+
private File zip(File file) throws Exception {
String cd = "cd " + new File("packageSDK").getAbsolutePath();
File sdk = new File("packageSDK" + File.separator + "sdk.aar");
- File files=new File("packageSDK");
- String aapt=new File("aapt.exe").exists()?new File("aapt.exe").getAbsolutePath():"aapt";
+ File files = new File("packageSDK");
+ String aapt = new File("aapt.exe").exists() ? new File("aapt.exe").getAbsolutePath() : "aapt";
for (File listFile : file.listFiles()) {
- if(listFile.isDirectory()){
+ if (listFile.isDirectory()) {
zip(listFile);
- }else if(!listFile.getName().equals("sdk.aar")){
- String path=listFile.getAbsolutePath().replace(files.getAbsolutePath(),"");
- String exec=aapt+" r "+sdk.getAbsolutePath()+" "+path.substring(1)+"\n";
- Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
+ } else if (!listFile.getName().equals("sdk.aar")) {
+ String path = listFile.getAbsolutePath().replace(files.getAbsolutePath(), "");
+ String exec = aapt + " r " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
+ Runtime.getRuntime().exec("cmd /c " + cd + " && " + exec);
Thread.sleep(100);
- exec =aapt+ " a " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
- Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
+ exec = aapt + " a " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
+ Runtime.getRuntime().exec("cmd /c " + cd + " && " + exec);
Thread.sleep(100);
}
}
return sdk;
}
+
private File zip() {
- File sdk=null;
+ File sdk = null;
try {
Tools.copyFile(new File("input" + File.separator + "Documents" + File.separator + "sdk.aar").getAbsolutePath(),
new File("packageSDK").getAbsolutePath(), true);
String cd = "cd " + new File("packageSDK").getAbsolutePath() + "\n\r";
- Process process=Runtime.getRuntime().exec(new String[]{"cmd"});
- OutputStream stream =process.getOutputStream();
+ Process process = Runtime.getRuntime().exec(new String[]{"cmd"});
+ OutputStream stream = process.getOutputStream();
stream.write(cd.getBytes());
stream.flush();
stream.close();
process.destroy();
- sdk=zip(new File("packageSDK"));
- File copy=new File("packageSDK"+File.separator+"copy");
- if(copy.exists()){
+ sdk = zip(new File("packageSDK"));
+ File copy = new File("packageSDK" + File.separator + "copy");
+ if (copy.exists()) {
zip(copy);
}
stream.close();
@@ -230,24 +242,37 @@ public class AutoPackageSDK {
}
return sdk;
}
- private void copy(){
- try{
- File copyPath=new File("input"+File.separator+"Documents"+File.separator+"copy");
- if(copyPath.exists()){
- Tools.copyFile(copyPath.getAbsolutePath(),new File("packageSDK").getAbsolutePath(),true);
+
+ private void copy() {
+ try {
+ File copyPath = new File("input" + File.separator + "Documents" + File.separator + "copy");
+ if (copyPath.exists()) {
+ Tools.copyFile(copyPath.getAbsolutePath(), new File("packageSDK").getAbsolutePath(), true);
}
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
}
+
public static void main(String[] args) {
- int a=1;
- new AutoPackageSDK(new SmaliApkToolsPath() {
- @Override
- public void smaliPath(String path) {
- //com.tanggttaxc.langtt.mi
- System.out.println(">"+path);
+ int[] nums = new int[]{-1,-1,-1,1,-1,-1};
+ for (int j = 1; j < nums.length; j++) {
+ int index =j;
+ int tmp = 0;
+ int tmp2 = 0;
+ for (int i = 0; i < index; i++) {
+ tmp += nums[i];
}
- }, "5800", a==0?"com.luckyboy.mmxing":"com.prujwk.jdyphn");
+ for (int i = index + 1; i < nums.length; i++) {
+ tmp2 += nums[i];
+ }
+ System.out.println(tmp);
+ System.out.println(tmp2);
+ if (tmp == tmp2) {
+ System.out.println("return:" + index);
+ return;
+ }
+ }
+ System.out.println("return:" + -1);
}
}
diff --git a/src/com/qy/utils/AutoPackageSDKMust.java b/src/com/qy/utils/AutoPackageSDKMust.java
new file mode 100644
index 0000000..8dac912
--- /dev/null
+++ b/src/com/qy/utils/AutoPackageSDKMust.java
@@ -0,0 +1,161 @@
+package com.qy.utils;
+
+import com.qy.Interfaces.SmaliApkToolsPath;
+import org.json.JSONObject;
+
+import java.io.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AutoPackageSDKMust {
+ private String key;
+ private SmaliApkToolsPath path;
+ private JSONObject config;
+ private String sdkCode = " String RDCpplictPath=Decode.getData(\"RDCpplictPath\");";
+
+ private AutoPackageSDKMust(String key, SmaliApkToolsPath path) {
+ this.key = key;
+ this.path = path;
+ config = Tools.loadConfig(new File("config.cfg"));
+ start();
+ }
+
+ public static void start(String key, SmaliApkToolsPath path) {
+ new AutoPackageSDKMust(key, path);
+ }
+
+ private void start() {
+ if (true) {
+ copySDK();
+ File sdk_src = new File("sdk_src" + File.separator + "sdk" + File.separator + "src" + File.separator + "main" + File.separator + "java");
+ loadFile(sdk_src);
+ path.smaliPath(packageSDK());
+ } else {
+ System.out.println(encrypt(sdkCode));
+ System.out.println(AESTools.aesDecrypt("655312476E8F4F12A72E1AB1C3CF8032", key));
+ }
+ }
+
+ private void copySDK() {
+ File sdkPath = new File(config.getString("sdkPath"));
+ if (!sdkPath.exists()) {
+ path.smaliPath(null);
+ return;
+ }
+ File sdk_src = new File("sdk_src");
+ sdk_src.mkdirs();
+ Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "build.gradle", sdk_src.getAbsolutePath() + File.separator, true);
+ Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "gradlew", sdk_src.getAbsolutePath() + File.separator, true);
+ Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "gradlew.bat", sdk_src.getAbsolutePath() + File.separator, true);
+ Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "settings.gradle", sdk_src.getAbsolutePath() + File.separator, true);
+ Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "local.properties", sdk_src.getAbsolutePath() + File.separator, true);
+ try {
+ BufferedReader reader;
+ Process process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "gradle " + sdk_src.getAbsolutePath() + File.separator + "gradle /E /I /Y");
+ reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ while (reader.readLine() != null) ;
+ reader.close();
+ process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "sdk " + sdk_src.getAbsolutePath() + File.separator + "sdk /E /I /Y");
+ reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ while (reader.readLine() != null) ;
+ reader.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("复制完全");
+ }
+
+ private void loadFile(File path) {
+ for (File file : path.listFiles()) {
+ if (file.isDirectory()) {
+ loadFile(file);
+ } else if (file.getName().endsWith(".java")) {
+ if (!file.getName().equals("Decode.java")) {
+ loadCode(file);
+ } else {
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ StringBuilder builder = new StringBuilder();
+ String tmp = null;
+ while ((tmp = reader.readLine()) != null) {
+ if (tmp.contains("String key=")) {
+ tmp = tmp.replace("\"\"", "\"" + key + "\"");
+ }
+ builder.append(tmp).append("\n");
+ }
+ reader.close();
+ FileWriter writer = new FileWriter(file);
+ writer.write(builder.toString());
+ writer.flush();
+ writer.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ }
+ }
+
+ private void loadCode(File java) {
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader(java));
+ StringBuilder builder = new StringBuilder();
+ String tmp = null;
+ while ((tmp = reader.readLine()) != null) {
+ tmp = encrypt(tmp);
+ builder.append(tmp).append("\n");
+ }
+ reader.close();
+ FileWriter writer = new FileWriter(java);
+ writer.write(builder.toString());
+ writer.flush();
+ writer.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private String encrypt(String tmp) {
+ Pattern pattern = Pattern.compile("\\\"([^\\\"]*)\\\"");
+ Matcher matcher = pattern.matcher(tmp);
+ while (matcher.find()) {
+ String code = tmp.substring(matcher.start(), matcher.end());
+ String encrypt = AESTools.aesEncrypt(code.replace("\"", ""), key);
+ if (encrypt != null) {
+ tmp = tmp.replace(code, "$#&" + encrypt + "$#&");
+ }
+ matcher = pattern.matcher(tmp);
+ }
+ tmp = tmp.replace("$#&", "\"");
+ return tmp;
+ }
+
+ private String packageSDK() {
+ File sdk_src = new File("sdk_src");
+ try {
+ Process process = Runtime.getRuntime().exec(sdk_src.getAbsolutePath() + File.separator + "gradlew.bat assembleRelease -p " + sdk_src.getAbsolutePath() + File.separator + "sdk");//打包sdk
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String tmp;
+ while ((tmp = reader.readLine()) != null) {
+ System.out.println(tmp);
+ }
+ process.waitFor();
+ reader.close();
+ return sdk_src.getAbsolutePath() + File.separator + "sdk" + File.separator + "build" + File.separator
+ + "intermediates" + File.separator + "aar_main_jar" + File.separator + "release" + File.separator + "classes.jar";
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static void main(String[] args) {
+ start("eZMpiVponpIUV5VO", new SmaliApkToolsPath() {
+ @Override
+ public void smaliPath(String path) {
+ System.out.println("over=" + path);
+ }
+ });
+ }
+}
diff --git a/src/com/qy/utils/Tools.java b/src/com/qy/utils/Tools.java
index 5987167..f8aca60 100755
--- a/src/com/qy/utils/Tools.java
+++ b/src/com/qy/utils/Tools.java
@@ -298,7 +298,15 @@ public class Tools {
String exec="java -jar "+dx+" --dex --output="+outName+" "+inName+"";
System.out.println("java to dex:"+exec);
Process process=Runtime.getRuntime().exec(exec);
+ BufferedReader reader=new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ System.out.println("read");
+ String tmp=reader.readLine();
+ while (tmp!=null){
+ System.out.println(tmp);
+ tmp=reader.readLine();
+ }
process.waitFor();
+ System.out.println("打包完成");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();