更新打包流程
This commit is contained in:
parent
d452d95576
commit
256d724150
@ -31,6 +31,7 @@
|
|||||||
"isJarLib": false,
|
"isJarLib": false,
|
||||||
"packagerlimit": 3,
|
"packagerlimit": 3,
|
||||||
"isManual": false,
|
"isManual": false,
|
||||||
|
"dex2jar": "D:\\反编译\\dex2jar-2.0\\_d2j-dex2jar.bat",
|
||||||
"manual": [
|
"manual": [
|
||||||
{
|
{
|
||||||
"class": "com.qq.e.comm.a",
|
"class": "com.qq.e.comm.a",
|
||||||
@ -72,6 +73,7 @@
|
|||||||
"isJarLib": false,
|
"isJarLib": false,
|
||||||
"packagerlimit": 3,
|
"packagerlimit": 3,
|
||||||
"isManual": true,
|
"isManual": true,
|
||||||
|
"dex2jar": "D:\\反编译\\dex2jar-2.0\\_d2j-dex2jar.bat",
|
||||||
"manual": [
|
"manual": [
|
||||||
{
|
{
|
||||||
"class": "com.uniplay.adsdk.basic.RuleManage",
|
"class": "com.uniplay.adsdk.basic.RuleManage",
|
||||||
@ -202,8 +204,8 @@
|
|||||||
],
|
],
|
||||||
"random":[
|
"random":[
|
||||||
"com",
|
"com",
|
||||||
"ww",
|
"prujwk",
|
||||||
"za",
|
"jdyphn",
|
||||||
],
|
],
|
||||||
"isAllPackage":false,
|
"isAllPackage":false,
|
||||||
"isReName":true,
|
"isReName":true,
|
||||||
|
@ -225,11 +225,12 @@ public class AutoRandomAdSDK {
|
|||||||
+ clazzs.getString(i).replace(".", File.separator) + ".smali");
|
+ clazzs.getString(i).replace(".", File.separator) + ".smali");
|
||||||
|
|
||||||
if (clz.exists()) {
|
if (clz.exists()) {
|
||||||
|
// System.out.println("key="+clazzs.getString(i)+" value="+clz);
|
||||||
adClass.put(clazzs.getString(i), clz);
|
adClass.put(clazzs.getString(i), clz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String key : adClass.keySet()) {
|
for (String key : adClass.keySet()) {
|
||||||
//System.out.println("注入的值:" + key);
|
// System.out.println("注入的值:" + key);
|
||||||
}
|
}
|
||||||
mkdirs();
|
mkdirs();
|
||||||
update();
|
update();
|
||||||
@ -296,7 +297,6 @@ public class AutoRandomAdSDK {
|
|||||||
smalitools.setPath(rootPath + File.separator + "smali");
|
smalitools.setPath(rootPath + File.separator + "smali");
|
||||||
file = new File(rootPath + File.separator + "smali");
|
file = new File(rootPath + File.separator + "smali");
|
||||||
|
|
||||||
//System.out.println(file.getAbsolutePath() + " " + file.exists());
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
//System.out.println(smalitools.mainPath);
|
//System.out.println(smalitools.mainPath);
|
||||||
@ -506,13 +506,14 @@ public class AutoRandomAdSDK {
|
|||||||
System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
|
System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
|
||||||
}*/
|
}*/
|
||||||
for (String key : adClass.keySet()) {
|
for (String key : adClass.keySet()) {
|
||||||
|
|
||||||
File file = new File(adClass.get(key).getAbsolutePath());
|
File file = new File(adClass.get(key).getAbsolutePath());
|
||||||
String fileName = file.getName().replace(".smali", "");
|
String fileName = file.getName().replace(".smali", "");
|
||||||
File filePath = new File(nowAdClass.get(key).getAbsolutePath().replace(file.getName(), "").replace(".smali", ""));
|
File filePath = new File(nowAdClass.get(key).getAbsolutePath().replace(file.getName(), "").replace(".smali", ""));
|
||||||
if (!config.getBoolean("isAllPackage")) {
|
if (!config.getBoolean("isAllPackage")) {
|
||||||
filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
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());
|
//System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
|
||||||
if (filePath.listFiles() == null) {
|
if (filePath.listFiles() == null) {
|
||||||
//System.out.println("filePath为空:" + filePath.getAbsolutePath());
|
//System.out.println("filePath为空:" + filePath.getAbsolutePath());
|
||||||
@ -520,7 +521,7 @@ public class AutoRandomAdSDK {
|
|||||||
}
|
}
|
||||||
//moveFile(filePath,key);
|
//moveFile(filePath,key);
|
||||||
for (File fs : filePath.listFiles()) {
|
for (File fs : filePath.listFiles()) {
|
||||||
// //System.out.println(fs.getAbsolutePath().replace(rootPath, ""));
|
// System.out.println(fs.getAbsolutePath());
|
||||||
if (fs.isDirectory()) {
|
if (fs.isDirectory()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -529,25 +530,28 @@ public class AutoRandomAdSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String nName = getNewName(fs.getAbsolutePath());
|
String nName = getNewName(fs.getAbsolutePath());
|
||||||
|
//System.out.println(fs.getAbsolutePath().replace(rootPath,"")+" > "+nName);
|
||||||
if (fs.getName().startsWith(fileName.split("\\$")[0] + "$")) {
|
if (fs.getName().startsWith(fileName.split("\\$")[0] + "$")) {
|
||||||
if (getNewName(fs.getAbsolutePath()).endsWith("[notmover]")) {
|
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);
|
.getName().replace(fs.getName().split("\\$")[0], nName), true);
|
||||||
|
file.delete();
|
||||||
} else {
|
} else {
|
||||||
moveFile(fs, key, fs.getName().replace(fs.getName().split("\\$")[0], nName), false);
|
|
||||||
|
moveFile(fs, key, nName+fs.getName().substring(fileName.length()), false);
|
||||||
}
|
}
|
||||||
fs.delete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getNewNameForSrc(file.getName()).endsWith("[notmover]")) {
|
if (getNewNameForSrc(file.getName()).endsWith("[notmover]")) {
|
||||||
nowAdFile.put(key, file.getAbsolutePath());
|
nowAdFile.put(key, file.getAbsolutePath());
|
||||||
Tools.copyFileToName(file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), ""),
|
Tools.copyFileToName(file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), ""),
|
||||||
getNewName(file.getAbsolutePath()) + ".smali", true);
|
getNewName(file.getAbsolutePath()) + ".smali", true);
|
||||||
|
file.delete();
|
||||||
} else {
|
} else {
|
||||||
moveFile(file, key, getNewName(file.getAbsolutePath()) + ".smali", true);
|
moveFile(file, key, getNewName(file.getAbsolutePath()) + ".smali", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.delete();
|
|
||||||
}
|
}
|
||||||
if (root != null)
|
if (root != null)
|
||||||
removeNullFile(root);
|
removeNullFile(root);
|
||||||
@ -640,8 +644,10 @@ public class AutoRandomAdSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean data = file.renameTo(new File(rootPath + toPath, file.getName()));
|
//boolean data = file.renameTo(new File(rootPath + toPath, file.getName()));
|
||||||
//System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + " 到 " + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data);
|
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);
|
||||||
if (nowAdClass.containsKey(fileName)) {
|
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);
|
// //System.out.println(file.getAbsolutePath().replace(rootPath,"")+" "+toPath);
|
||||||
|
@ -123,6 +123,8 @@ public class SmaliUtils {
|
|||||||
newName = tmp.replace(".class L", "");
|
newName = tmp.replace(".class L", "");
|
||||||
} else if (tmp.contains(".class synthetic L")) {
|
} else if (tmp.contains(".class synthetic L")) {
|
||||||
newName = tmp.replace(".class synthetic L", "");
|
newName = tmp.replace(".class synthetic L", "");
|
||||||
|
} else if(tmp.contains(".class final enum L")){
|
||||||
|
newName=tmp.replace(".class final enum L","");
|
||||||
}
|
}
|
||||||
if (newName != null) {
|
if (newName != null) {
|
||||||
newName = newName.replace(";", "");
|
newName = newName.replace(";", "");
|
||||||
@ -164,6 +166,7 @@ public class SmaliUtils {
|
|||||||
String[] datas = str.split("\n");
|
String[] datas = str.split("\n");
|
||||||
String save = "";
|
String save = "";
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
for (String string : datas) {
|
for (String string : datas) {
|
||||||
save += changeLine(string) + "\n";
|
save += changeLine(string) + "\n";
|
||||||
}
|
}
|
||||||
@ -178,13 +181,11 @@ public class SmaliUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
private String changeLine(String old) {
|
private String changeLine(String old) {
|
||||||
Set<String> keySet = clazzList.keySet();
|
Set<String> keySet = clazzList.keySet();
|
||||||
for (String clazz : keySet) {
|
for (String clazz : keySet) {
|
||||||
if (old.contains(clazz)) {
|
if (old.contains(clazz+";")) {
|
||||||
old = old.replace(clazz, clazzList.get(clazz));
|
old= old.replace(clazz, clazzList.get(clazz));
|
||||||
//System.out.println((i++) + " 修改:" + t + " 到:" + old + " " + clazz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return old;
|
return old;
|
||||||
|
@ -89,12 +89,14 @@ public class Tools {
|
|||||||
fileName=srcFile.getName();
|
fileName=srcFile.getName();
|
||||||
}
|
}
|
||||||
in = new FileInputStream(srcFile);
|
in = new FileInputStream(srcFile);
|
||||||
out = new FileOutputStream(destFile + "/" +fileName );
|
out = new FileOutputStream(destFile + File.separator +fileName );
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
while ((byteread = in.read(buffer)) != -1) {
|
while ((byteread = in.read(buffer)) != -1) {
|
||||||
out.write(buffer, 0, byteread);
|
out.write(buffer, 0, byteread);
|
||||||
}
|
}
|
||||||
|
out.close();
|
||||||
|
in.close();
|
||||||
return true;
|
return true;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -102,15 +104,6 @@ public class Tools {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (out != null)
|
|
||||||
out.close();
|
|
||||||
if (in != null)
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user