This commit is contained in:
Yutousama 2020-06-03 17:50:55 +08:00
parent afe1407825
commit 4c1aeed350
4 changed files with 51 additions and 28 deletions

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.qy.utils.CsjTools
Main-Class: com.qy.ui.AppMain

View File

@ -63,6 +63,15 @@ public class AutoRandomAdSDK {
private SmaliApkToolsPath inter;
private boolean isDev = false;
public void clear() {
if (adClass != null)
adClass.clear();
if (nowAdClass != null)
nowAdClass.clear();
if (nowAdFile != null)
nowAdFile.clear();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
// new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600", "5", 1, null);
@ -103,11 +112,13 @@ public class AutoRandomAdSDK {
public AutoRandomAdSDK() {
}
private SmaliApkToolsPath batchInter;
private SmaliApkToolsPath batchInter;
private JSONArray batch;
public AutoRandomAdSDK(JSONArray batch, SmaliApkToolsPath inter) {
batchInter=inter;
this.batch=batch;
batchInter = inter;
this.batch = batch;
for (Object o : batch) {
//System.out.println("循环");
final JSONObject item = (JSONObject) o;
@ -123,10 +134,12 @@ public class AutoRandomAdSDK {
});
}
}
private int outIndex=0;
private int outIndex = 0;
private void outInter(JSONArray array) {
outIndex++;
if(batch.length()==outIndex){
if (batch.length() == outIndex) {
batchInter.smaliPath(batch.toString());
}
}
@ -225,12 +238,12 @@ public class AutoRandomAdSDK {
+ clazzs.getString(i).replace(".", File.separator) + ".smali");
if (clz.exists()) {
// System.out.println("key="+clazzs.getString(i)+" value="+clz);
// System.out.println("key="+clazzs.getString(i)+" value="+clz);
adClass.put(clazzs.getString(i), clz);
}
}
for (String key : adClass.keySet()) {
// System.out.println("注入的值:" + key);
// System.out.println("注入的值:" + key);
}
mkdirs();
update();
@ -446,6 +459,7 @@ public class AutoRandomAdSDK {
public void smaliPath(String path) {
// TODO Auto-generated method stub
try {
smalitools.clear();
Thread.sleep(2000);
outManifest();
File lt;
@ -479,6 +493,7 @@ public class AutoRandomAdSDK {
}
if (inter != null)
inter.smaliPath(nLt == null ? rootPath : nLt.getAbsolutePath());
clear();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
@ -513,7 +528,7 @@ public class AutoRandomAdSDK {
if (!config.getBoolean("isAllPackage")) {
filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
}
// System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
// System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
//System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
if (filePath.listFiles() == null) {
//System.out.println("filePath为空" + filePath.getAbsolutePath());
@ -521,7 +536,7 @@ public class AutoRandomAdSDK {
}
//moveFile(filePath,key);
for (File fs : filePath.listFiles()) {
// System.out.println(fs.getAbsolutePath());
// System.out.println(fs.getAbsolutePath());
if (fs.isDirectory()) {
continue;
}
@ -533,12 +548,12 @@ public class AutoRandomAdSDK {
//System.out.println(fs.getAbsolutePath().replace(rootPath,"")+" > "+nName);
if (fs.getName().startsWith(fileName.split("\\$")[0] + "$")) {
if (getNewName(fs.getAbsolutePath()).endsWith("[notmover]")) {
Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
.getName().replace(fs.getName().split("\\$")[0], nName), true);
file.delete();
} else {
moveFile(fs, key, nName+fs.getName().substring(fileName.length()), false);
moveFile(fs, key, nName + fs.getName().substring(fileName.length()), false);
}
}
}
@ -600,7 +615,7 @@ public class AutoRandomAdSDK {
boolean t = Tools.copyFileToName(file.getAbsolutePath(), path,
nName, true);
file.delete();
//System.err.println("移动文件:" + file.getAbsolutePath() + "" + path + " 重命名为:" + nName + " 结果" + t);
//System.err.println("移动文件:" + file.getAbsolutePath() + "" + path + " 重命名为:" + nName + " 结果" + t);
}
private void allpackage(File file, String packge) {
@ -625,9 +640,9 @@ public class AutoRandomAdSDK {
if (packageName != null && file.getAbsolutePath().contains(packageName.replace(".", File.separator))) {
continue;
}
String sdkPackageName=config.isNull("regexPackage")?null:config.getString("regexPackage");
if(sdkPackageName!=null){
toPath=toPath.replace(sdkPackageName.replace(".",File.separator),"");
String sdkPackageName = config.isNull("regexPackage") ? null : config.getString("regexPackage");
if (sdkPackageName != null) {
toPath = toPath.replace(sdkPackageName.replace(".", File.separator), "");
}
if (file.isDirectory()) {
@ -645,11 +660,11 @@ public class AutoRandomAdSDK {
//boolean data = file.renameTo(new File(rootPath + toPath, file.getName()));
boolean data=Tools.copyFile(file.getAbsolutePath(),rootPath + toPath,true);
boolean data = Tools.copyFile(file.getAbsolutePath(), rootPath + toPath, true);
file.delete();
// System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + "" + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data);
// System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + "" + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data);
if (nowAdClass.containsKey(fileName)) {
// System.err.println("移动文件:"+file.getAbsolutePath().replace(rootPath, "")+""+toPath+" > "+fileName+" "+nowAdClass.get(fileName));
// System.err.println("移动文件:"+file.getAbsolutePath().replace(rootPath, "")+""+toPath+" > "+fileName+" "+nowAdClass.get(fileName));
// //System.out.println(file.getAbsolutePath().replace(rootPath,"")+" "+toPath);
nowAdClass.put(fileName, new File(rootPath + File.separator + toPath));
}
@ -675,11 +690,11 @@ public class AutoRandomAdSDK {
}
private String getNewName(String name) {
File file=new File(name);
String packageName=file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator,"").replace(file.getName(),"");
String nName = getNewNameForSrc(packageName.replace(File.separator,".")+file.getName());
if(nName.equals(packageName.replace(File.separator,".")+file.getName().replace(".smali",""))){
nName=getNewNameForSrc(file.getName());
File file = new File(name);
String packageName = file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator, "").replace(file.getName(), "");
String nName = getNewNameForSrc(packageName.replace(File.separator, ".") + file.getName());
if (nName.equals(packageName.replace(File.separator, ".") + file.getName().replace(".smali", ""))) {
nName = getNewNameForSrc(file.getName());
}
if (nName.endsWith("[notmover]")) {
nName = nName.replace("[notmover]", "");
@ -751,9 +766,6 @@ public class AutoRandomAdSDK {
}
}
nowAdClass.put(clazzs.getString(i), mkdir);
for (String key : nowAdClass.keySet()) {
// System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
}
}
}
}

View File

@ -302,6 +302,7 @@ public class CsjTools {
apk_Path = path;
apk_res = apk_Path + File.separator + "res" + File.separator + "values";
runStart();
utils.clear();
}
});
@ -319,6 +320,7 @@ public class CsjTools {
csj_Path = path;
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
_log.smaliPath("开始修改穿山甲");
utils.clear();
new Thread(new Runnable() {
@Override
public void run() {

View File

@ -27,7 +27,7 @@ public class SmaliUtils {
}
public SmaliUtils() {
clazzList = new HashMap<>();
clazzList = new HashMap<>();
}
public void setPath(String uPath) {
@ -256,6 +256,15 @@ public class SmaliUtils {
List<String> list;
public void clear() {
if (clazzList != null)
clazzList.clear();
if (list != null)
list.clear();
if (files != null)
files.clear();
}
public void setFilter(List<String> list) {
this.list = list;
}