完成了穿山甲资源包打包工具
修复了从Eclipse转移导致UI乱码的问题
This commit is contained in:
parent
e9e5ba609b
commit
c58b890c61
@ -128,8 +128,8 @@
|
||||
],
|
||||
"random": [
|
||||
"com",
|
||||
"wq",
|
||||
"rx"
|
||||
"opx",
|
||||
"bh"
|
||||
],
|
||||
"rename": {
|
||||
"MyActivity": "Activity",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"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",
|
||||
"dx": "dx.jar",
|
||||
"array": [
|
||||
"rd_rx",
|
||||
"qy_rx",
|
||||
|
@ -155,7 +155,7 @@ public class AndroidKey extends JFrame{
|
||||
JFileChooser chooser=new JFileChooser(new File("").getAbsolutePath());
|
||||
chooser.showOpenDialog(null);
|
||||
rsa=chooser.getSelectedFile();
|
||||
new EditToDalog("ĚáĘž", "ÇëĘäČëĂÜÔż", null, new SmaliApkToolsPath() {
|
||||
new EditToDalog("提示", "请输入密钥", null, new SmaliApkToolsPath() {
|
||||
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
|
@ -29,7 +29,7 @@ public class ApkSignUi extends JFrame {
|
||||
private JLabel lblSginpath;
|
||||
|
||||
public ApkSignUi() {
|
||||
setTitle("\u7B7E\u540D\u5DE5\u5177");
|
||||
setTitle("\u7B7E\u540D\u5DE5\u5177v1.1");
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
// TODO Auto-generated constructor stub
|
||||
@ -115,10 +115,13 @@ public class ApkSignUi extends JFrame {
|
||||
tools.setKeyStorePassword(txtSpass.getText());
|
||||
tools.setSignKey(txtPass.getText());
|
||||
if(tools.chack()) {
|
||||
tools.sign();
|
||||
new TextToDalog("成功", "签名完成");
|
||||
if(tools.sign()) {
|
||||
new TextToDalog("成功", "签名完成");
|
||||
}else{
|
||||
new TextToDalog("失败", "签名异常");
|
||||
}
|
||||
}else {
|
||||
new TextToDalog("错误", "APK文件或签名文件不存在");
|
||||
new TextToDalog("错误", "APK文件或签名文件不存在");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -503,6 +503,16 @@ public class AppMain extends JFrame {
|
||||
});
|
||||
menu.add(mntmsdk_1);
|
||||
|
||||
JMenuItem csj=new JMenuItem("穿山甲资源包");
|
||||
csj.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ChuanShanJiaUi.main(null);
|
||||
}
|
||||
});
|
||||
menu.add(csj);
|
||||
|
||||
|
||||
mnBasetools = new JMenu("Base64\u5DE5\u5177");
|
||||
menuBar.add(mnBasetools);
|
||||
|
||||
|
110
src/com/qy/ui/ChuanShanJiaUi.form
Normal file
110
src/com/qy/ui/ChuanShanJiaUi.form
Normal file
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.qy.ui.ChuanShanJiaUi">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="526" height="434"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="af63e" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="North"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="406e6" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="West"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="748d4" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="South"/>
|
||||
<properties>
|
||||
<minimumSize width="50" height="24"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<scrollpane id="23ab9">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalScrollBarPolicy value="30"/>
|
||||
<verticalScrollBarPolicy value="20"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="7fc43" class="javax.swing.JTextArea" binding="log">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="log "/>
|
||||
<visible value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<vspacer id="1bf42">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="1" height="180"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="f1705" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="East"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="d0747" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="94888" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="选择目标APK包"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="6e701">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<vspacer id="bcdeb">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="4ba45" class="javax.swing.JButton" binding="selectButton">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="选择"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
108
src/com/qy/ui/ChuanShanJiaUi.java
Normal file
108
src/com/qy/ui/ChuanShanJiaUi.java
Normal file
@ -0,0 +1,108 @@
|
||||
package com.qy.ui;
|
||||
|
||||
import com.qy.Interfaces.SmaliApkToolsPath;
|
||||
import com.qy.utils.CsjTools;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class ChuanShanJiaUi {
|
||||
private JPanel mainPanel;
|
||||
private JButton selectButton;
|
||||
private JTextArea log;
|
||||
|
||||
public ChuanShanJiaUi() {
|
||||
selectButton.addActionListener(new ActionListener() {
|
||||
File apkFile,csjDemo;
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFileChooser jfile=new JFileChooser(new File("").getAbsolutePath());
|
||||
jfile.showOpenDialog(null);
|
||||
apkFile=jfile.getSelectedFile();
|
||||
if(apkFile!=null){
|
||||
append("已选择文件:"+apkFile.getAbsolutePath());
|
||||
File csjPath=new File("input"+File.separator+"csjDemo"+File.separator);
|
||||
if(csjPath.exists()){
|
||||
File[] fs=csjPath.listFiles();
|
||||
if(fs==null||fs.length==0){
|
||||
append("没有找到穿山甲demo,请将穿山甲demo放置在 input"+File.separator+"csjDemo文件夹中");
|
||||
}else{
|
||||
selectButton.setEnabled(false);
|
||||
append("穿山甲Demo选择为 "+fs[0].getName());
|
||||
csjDemo=fs[0];
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CsjTools tools=new CsjTools();
|
||||
tools.build(csjDemo.getAbsolutePath(), apkFile.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
append(path);
|
||||
if(path.startsWith("已出包")) {
|
||||
new EditToDalog("成功", "打包完成,请输入版本号", "5600", new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String out) {
|
||||
System.out.println(">>" + out);
|
||||
tools.out(path.replace("已出包", ""),
|
||||
new File("csj").getAbsolutePath() + File.separator + "csc",
|
||||
Integer.parseInt(out));
|
||||
append("加密包位置:" + new File("csj").getAbsolutePath() + File.separator + "csc");
|
||||
selectButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
}else{
|
||||
append("没有找到穿山甲demo,请将穿山甲demo放置在 input"+File.separator+"csjDemo文件夹中");
|
||||
csjDemo.mkdirs();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private void append(String log){
|
||||
this.log.append("["+new SimpleDateFormat("HH:mm:ss").format(new Date()) +"]"+log+"\n");
|
||||
}
|
||||
private void show(){
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
JFrame frame = new JFrame("穿山甲资源包生成v1.0");
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setContentPane(new ChuanShanJiaUi().mainPanel);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
frame.setSize(420,400);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
JFrame frame = new JFrame("穿山甲资源包生成v1.0");
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setContentPane(new ChuanShanJiaUi().mainPanel);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
frame.setSize(420,400);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -26,7 +26,7 @@ import java.awt.event.ActionEvent;
|
||||
|
||||
public class ModifySdkUi extends JFrame{
|
||||
private JList<String> list;
|
||||
private File sdkFile;
|
||||
private File sdkFile=new File("D:\\IdeaProjects\\android_sdk_tools\\classes.jar");
|
||||
private Map<Integer, Boolean> userEncrypt;
|
||||
/**
|
||||
*
|
||||
@ -137,4 +137,8 @@ public class ModifySdkUi extends JFrame{
|
||||
}
|
||||
list.setListData(vector);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ModifySdkUi();
|
||||
}
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ public class OneWayTools {
|
||||
+ File.separator + "sdk" + File.separator + "b" + File.separator + "c.smali");
|
||||
if (!activity.exists()) {
|
||||
System.out.println(activity.getAbsolutePath());
|
||||
new TextToDalog("警告", "Unit.smali文件不存在!");
|
||||
new TextToDalog("警告", "Unit.smali文件不存在!");
|
||||
return;
|
||||
}
|
||||
if (!provider.exists()) {
|
||||
new TextToDalog("警告", "c.smali文件不存在!");
|
||||
new TextToDalog("警告", "c.smali文件不存在!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -82,10 +82,10 @@ public class OneWayTools {
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
new TextToDalog("错误", "处理unit.smali文件失败:" + e.getMessage());
|
||||
new TextToDalog("错误", "处理unit.smali文件失败:" + e.getMessage());
|
||||
return;
|
||||
}
|
||||
new TextToDalog("警告", "Unit.smali文件没有包含指定代码,请手动检查");
|
||||
new TextToDalog("警告", "Unit.smali文件没有包含指定代码,请手动检查");
|
||||
}
|
||||
|
||||
private void updateProvider(String path) {
|
||||
@ -123,9 +123,9 @@ public class OneWayTools {
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
new TextToDalog("错误", "处理c.smali文件失败:" + e.getMessage());
|
||||
new TextToDalog("错误", "处理c.smali文件失败:" + e.getMessage());
|
||||
return;
|
||||
}
|
||||
new TextToDalog("警告", "c.smali文件没有包含指定代码,请手动检查");
|
||||
new TextToDalog("警告", "c.smali文件没有包含指定代码,请手动检查");
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ import javax.swing.SwingConstants;
|
||||
public class SMSToolsUi extends JFrame {
|
||||
|
||||
/**
|
||||
* 更新日志 v1.0: 初始版,默认热包版本 v2.22
|
||||
* v1.1 修复Eclipse无法使用的问题
|
||||
* v1.2 新增对话框回调 热更包更新至2.24
|
||||
* v1.3 修复Eclipse无法打包的问题 ,自带jdk降低到1.7版本,采用jar.exe打包sdk
|
||||
* 更新日志 v1.0: 初始版,默认热包版本 v2.22
|
||||
* v1.1 修复Eclipse无法使用的问题
|
||||
* v1.2 新增对话框回调 热更包更新至2.24
|
||||
* v1.3 修复Eclipse无法打包的问题 ,自带jdk降低到1.7版本,采用jar.exe打包sdk
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JButton btnNewButton;
|
||||
@ -62,7 +62,7 @@ public class SMSToolsUi extends JFrame {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
path = btnNewButton.getText();
|
||||
btnNewButton.setEnabled(false);
|
||||
btnNewButton.setText("正在编译SDK,请稍后...");
|
||||
btnNewButton.setText("正在编译SDK,请稍后...");
|
||||
new Timer().schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
@ -71,7 +71,7 @@ public class SMSToolsUi extends JFrame {
|
||||
SDKTools.start(new File("").getAbsolutePath());
|
||||
btnNewButton.setText(path);
|
||||
btnNewButton.setEnabled(true);
|
||||
new TextToDalog("提示", "计费SDK生成成功,请选择保存位置", new DalogAbs() {
|
||||
new TextToDalog("提示", "计费SDK生成成功,请选择保存位置", new DalogAbs() {
|
||||
File sdk;
|
||||
|
||||
@Override
|
||||
@ -83,16 +83,16 @@ public class SMSToolsUi extends JFrame {
|
||||
sdk = chooser.getSelectedFile();
|
||||
if (sdk != null) {
|
||||
File sdk_ = new File(
|
||||
sdk.getAbsolutePath() + "/" + "计费sdk" + SDKTools.version + ".zip");
|
||||
sdk.getAbsolutePath() + "/" + "计费sdk" + SDKTools.version + ".zip");
|
||||
SDKTools.buildSDK(sdk_);
|
||||
new TextToDalog("完成", "任务已完成", new DalogAbs() {
|
||||
new TextToDalog("完成", "任务已完成", new DalogAbs() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
Desktop.getDesktop().open(sdk);
|
||||
System.out.println("\n本窗口可以关掉了");
|
||||
System.out.println("\n本窗口可以关掉了");
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -101,7 +101,7 @@ public class SMSToolsUi extends JFrame {
|
||||
});
|
||||
|
||||
} else {
|
||||
new TextToDalog("错误", "已放弃本次任务");
|
||||
new TextToDalog("错误", "已放弃本次任务");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -161,7 +161,7 @@ public class SmaliUi extends JFrame {
|
||||
int index = list.getSelectedIndex();
|
||||
if (index > 0) {
|
||||
file = fileList.get(index);
|
||||
new EditToDalog("重命名", "希望将文件(夹) " + file.getName() + " 重命名为?", file.getName(),
|
||||
new EditToDalog("重命名", "希望将文件(夹) " + file.getName() + " 重命名为?", file.getName(),
|
||||
new SmaliApkToolsPath() {
|
||||
|
||||
@Override
|
||||
@ -170,7 +170,7 @@ public class SmaliUi extends JFrame {
|
||||
if (path.trim().length() != 0 && !file.getName().equals(path)) {
|
||||
File toFile = new File(file.getParentFile().getAbsolutePath() + File.separator + path);
|
||||
file.renameTo(toFile);
|
||||
lblInfo.setText("重命名:" + toFile.getName());
|
||||
lblInfo.setText("重命名:" + toFile.getName());
|
||||
changeList();
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@ public class SmaliUi extends JFrame {
|
||||
File path = chooser.getSelectedFile();
|
||||
File file = fileList.get(index);
|
||||
file.renameTo(new File(path.getAbsolutePath() + File.separator + file.getName()));
|
||||
lblInfo.setText("移动:" + file.getAbsolutePath());
|
||||
lblInfo.setText("移动:" + file.getAbsolutePath());
|
||||
changeList();
|
||||
}
|
||||
}
|
||||
@ -271,14 +271,14 @@ public class SmaliUi extends JFrame {
|
||||
button.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
lblInfo.setText("开始拆包");
|
||||
lblInfo.setText("开始拆包");
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
if(jarPath.getText().trim().length()==0) {
|
||||
new TextToDalog("警告", "没有选择目标文件");
|
||||
new TextToDalog("警告", "没有选择目标文件");
|
||||
return;
|
||||
}
|
||||
utils.unPack(jarPath.getText(), new SmaliApkToolsPath() {
|
||||
@ -288,7 +288,7 @@ public class SmaliUi extends JFrame {
|
||||
// TODO Auto-generated method stub
|
||||
smaliPath.setText(path);
|
||||
smaliHome = path;
|
||||
lblInfo.setText("拆包完成");
|
||||
lblInfo.setText("拆包完成");
|
||||
}
|
||||
});
|
||||
|
||||
@ -308,23 +308,23 @@ public class SmaliUi extends JFrame {
|
||||
smaliPath.setText(smaliHome);
|
||||
if(savePath.getText().trim().length()==0) {
|
||||
savePath.setText(smaliHome);
|
||||
lblInfo.setText("没有填写保存路径,默认保存在当前目录");
|
||||
new TextToDalog("警告", "没有填写保存路径,默认保存在当前目录");
|
||||
lblInfo.setText("没有填写保存路径,默认保存在当前目录");
|
||||
new TextToDalog("警告", "没有填写保存路径,默认保存在当前目录");
|
||||
}
|
||||
if(jarPath.getText().trim().length()==0) {
|
||||
path="dex.zip";
|
||||
new TextToDalog("警告", "没有填写保存文件名,默认为dex.zip");
|
||||
new TextToDalog("警告", "没有填写保存文件名,默认为dex.zip");
|
||||
}else {
|
||||
path=new File(jarPath.getText()).getName();
|
||||
}
|
||||
lblInfo.setText("开始打包");
|
||||
lblInfo.setText("开始打包");
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
utils.bale(smaliPath.getText(), savePath.getText() + File.separator+path);
|
||||
lblInfo.setText("打包完成,保存路径为:" + savePath.getText());
|
||||
lblInfo.setText("打包完成,保存路径为:" + savePath.getText());
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
@ -346,7 +346,7 @@ public class SmaliUi extends JFrame {
|
||||
path = file.getParentFile().getAbsolutePath();
|
||||
}
|
||||
try {
|
||||
lblInfo.setText("已打开");
|
||||
lblInfo.setText("已打开");
|
||||
Desktop.getDesktop().open(new File(path));
|
||||
} catch (IOException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
@ -371,7 +371,7 @@ public class SmaliUi extends JFrame {
|
||||
break;
|
||||
}
|
||||
}
|
||||
lblInfo.setText("开始根据目录结构修改smali 请等待...");
|
||||
lblInfo.setText("开始根据目录结构修改smali 请等待...");
|
||||
utils.setPath(smaliPath.getText());
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@ -379,7 +379,7 @@ public class SmaliUi extends JFrame {
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
utils.start();
|
||||
lblInfo.setText("完成");
|
||||
lblInfo.setText("完成");
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
@ -427,7 +427,7 @@ public class SmaliUi extends JFrame {
|
||||
File[] files = file.listFiles();
|
||||
vector.clear();
|
||||
fileList.clear();
|
||||
vector.add("返回上层");
|
||||
vector.add("返回上层");
|
||||
fileList.add(file.getParentFile());
|
||||
for (File f : files) {
|
||||
if (!f.isHidden()) {
|
||||
@ -436,10 +436,10 @@ public class SmaliUi extends JFrame {
|
||||
}
|
||||
}
|
||||
list.setListData(vector);
|
||||
lblInfo.setText("刷新界面");
|
||||
lblInfo.setText("刷新界面");
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
lblInfo.setText("刷新失败");
|
||||
lblInfo.setText("刷新失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,15 +24,17 @@ public class ApkSignTools {
|
||||
public ApkSignTools() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
public void sign() {
|
||||
String exec="jarsigner -verbose -keystore " + signFile.getAbsolutePath() + " -keypass " + signKey
|
||||
+ " -storepass " + keyStorePassword + " -signedjar " + apkFile.getAbsolutePath()+"_sign.apk" + " " + apkFile.getAbsolutePath() + " " + name;
|
||||
public boolean sign() {
|
||||
String exec="jarsigner -verbose -keystore \"" + signFile.getAbsolutePath() + "\" -keypass " + signKey
|
||||
+ " -storepass " + keyStorePassword + " -signedjar \"" + apkFile.getAbsolutePath()+"_sign.apk" + "\" \"" + apkFile.getAbsolutePath() + "\" " + name;
|
||||
System.out.println(exec);
|
||||
try {
|
||||
Runtime.getRuntime().exec(exec);
|
||||
} catch (IOException e) {
|
||||
Runtime.getRuntime().exec(exec).waitFor();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public File getSignFile() {
|
||||
|
@ -146,6 +146,7 @@ public class AutoRandomAdSDK {
|
||||
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);
|
||||
}
|
||||
@ -172,7 +173,7 @@ public class AutoRandomAdSDK {
|
||||
String newManifest = path
|
||||
.replace(sdk.getAbsolutePath() + ".out" + File.separator + "smali" + File.separator, "");
|
||||
try {
|
||||
newManifest = newManifest.replaceAll(File.separator, ".") + "." + adClass.get(key).getName();
|
||||
newManifest = newManifest.replace(File.separator, ".") + "." + adClass.get(key).getName();
|
||||
array.put(manifest.getString(i).replace(key, newManifest.replace(".smali", "")));
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
@ -218,7 +219,7 @@ public class AutoRandomAdSDK {
|
||||
|
||||
|
||||
if (file.exists()) {
|
||||
JSONArray array = config.getJSONArray("filter");
|
||||
JSONArray array = config.isNull("filter")?null:config.getJSONArray("filter");
|
||||
if (array != null) {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
@ -282,7 +283,16 @@ public class AutoRandomAdSDK {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void show(File file){
|
||||
for (File listFile : file.listFiles()) {
|
||||
if(listFile.isDirectory()){
|
||||
show(listFile);
|
||||
}else{
|
||||
System.out.println(">?"+listFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void out() {
|
||||
if (!isPackage) {
|
||||
if (inter != null) {
|
||||
@ -299,6 +309,11 @@ public class AutoRandomAdSDK {
|
||||
path = sdk.getAbsolutePath() + ".out";
|
||||
name = sdk.getName();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
smalitools.bale(path,
|
||||
path + File.separator + name, new SmaliApkToolsPath() {
|
||||
|
||||
@ -306,6 +321,7 @@ public class AutoRandomAdSDK {
|
||||
public void smaliPath(String path) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
outManifest();
|
||||
File lt;
|
||||
File nLt = null;
|
||||
@ -317,13 +333,22 @@ public class AutoRandomAdSDK {
|
||||
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());
|
||||
|
||||
String exec=config.getString("dex2jar") + " " + sdk.getAbsolutePath() + ".out" + File.separator + sdk.getName();
|
||||
System.out.println("exec:"+exec);
|
||||
Process process = Runtime.getRuntime().exec(exec);
|
||||
process.waitFor();
|
||||
Thread.sleep(100);
|
||||
process=Runtime.getRuntime().exec(exec);
|
||||
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"));
|
||||
if(nLt.exists()){
|
||||
nLt.delete();
|
||||
}
|
||||
lt.renameTo(nLt);
|
||||
|
||||
}
|
||||
@ -351,16 +376,13 @@ public class AutoRandomAdSDK {
|
||||
File filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
||||
|
||||
for (File fs : filePath.listFiles()) {
|
||||
System.out.println(fs.getAbsolutePath().replace(new File("").getAbsolutePath(),""));
|
||||
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 + "$")) {
|
||||
|
||||
@ -383,6 +405,7 @@ public class AutoRandomAdSDK {
|
||||
|
||||
file.delete();
|
||||
}
|
||||
System.out.println("配置:"+config.getBoolean("isAllPackage"));
|
||||
if (config.getBoolean("isAllPackage")) {
|
||||
String tmp = nowAdClass.keySet().iterator().next();
|
||||
File path = new File((nowAdClass.get(tmp)).getAbsolutePath());
|
||||
@ -418,6 +441,7 @@ public class AutoRandomAdSDK {
|
||||
|
||||
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);
|
||||
@ -431,14 +455,19 @@ public class AutoRandomAdSDK {
|
||||
|
||||
private void movesdk(File path, String toPath) {
|
||||
for (File file : path.listFiles()) {
|
||||
if (file.getName().equals("BuildConfig.smali")) {
|
||||
file.delete();
|
||||
continue;
|
||||
}
|
||||
|
||||
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()));
|
||||
boolean data=file.renameTo(new File(rootPath + File.separator + toPath, file.getName()));
|
||||
// System.out.println("移动文件:"+file.getAbsolutePath().replace(rootPath, "")+" 到"+(rootPath + File.separator + toPath)+" "+data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ public class CsjTools {
|
||||
reader.close();
|
||||
String apkPackage = getXMLValue("package", tmp);
|
||||
System.out.println(apkPackage);
|
||||
_log.smaliPath("获取到APK包名:"+apkPackage);
|
||||
reader = new BufferedReader(new FileReader(demoManifest));
|
||||
tmp = reader.readLine();
|
||||
String manifest = tmp.replace(getXMLValue("package", tmp), apkPackage) + "\n";
|
||||
@ -93,7 +94,7 @@ public class CsjTools {
|
||||
}
|
||||
}
|
||||
|
||||
private void out(String srcFile, String encryptFile, int version) {
|
||||
public void out(String srcFile, String encryptFile, int version) {
|
||||
EncryptJar encryptJar = new EncryptJar();
|
||||
encryptJar.encrypt(new File(srcFile), encryptFile, 13, version);
|
||||
|
||||
@ -168,8 +169,9 @@ public class CsjTools {
|
||||
}
|
||||
}
|
||||
|
||||
private void start(SmaliApkToolsPath toolsPath) {
|
||||
System.out.println("开始制作资源包");
|
||||
private void start() {
|
||||
_log.smaliPath("开始制作资源包");
|
||||
|
||||
commandFile();
|
||||
String apkXML = loadXml(apk_res + File.separator + "public.xml");
|
||||
String demoXML = loadXml(csj_res + File.separator + "public.xml");
|
||||
@ -206,24 +208,39 @@ public class CsjTools {
|
||||
new File("csj/").mkdirs();
|
||||
}
|
||||
SmaliUtils utils = new SmaliUtils();
|
||||
_log.smaliPath("资源包制作完成,开始打包为apk");
|
||||
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+" 秒");
|
||||
_log.smaliPath("已出包" + csjRes.getAbsolutePath());
|
||||
_log.smaliPath("耗时:" + (System.currentTimeMillis() - time) / 1000 + " 秒");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private long time;
|
||||
private boolean unPackageCSJ = false;
|
||||
private SmaliApkToolsPath _log;
|
||||
|
||||
public void build(String csjPath, String apkPath, SmaliApkToolsPath log) {
|
||||
time=System.currentTimeMillis();
|
||||
time = System.currentTimeMillis();
|
||||
_log=log;
|
||||
unPackageCSJ=false;
|
||||
File csjFile = new File(csjPath);
|
||||
if (new File(csjFile.getName().replace(".apk", "")).exists()) {
|
||||
System.out.println(">?>>"+new File(csjFile.getName().replace(".apk", "")).getAbsolutePath());
|
||||
unPackageCSJ = true;
|
||||
}
|
||||
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));
|
||||
// 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");
|
||||
_log.smaliPath("开始反编译目标APK");
|
||||
|
||||
|
||||
utils.unPack(apkPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
@ -232,27 +249,34 @@ public class CsjTools {
|
||||
System.out.println(path);
|
||||
apk_Path = path;
|
||||
apk_res = apk_Path + File.separator + "res" + File.separator + "values";
|
||||
runStart(log);
|
||||
runStart();
|
||||
}
|
||||
});
|
||||
log.smaliPath("开始反编译穿山甲Demo");
|
||||
|
||||
if (unPackageCSJ) {
|
||||
_log.smaliPath("穿山甲demo已存在,不再反编译");
|
||||
csjManifest = true;
|
||||
runStart();
|
||||
} else {
|
||||
_log.smaliPath("开始反编译穿山甲Demo");
|
||||
utils.unPack(csjPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
log.smaliPath("穿山甲Demo反编译完成:" + path);
|
||||
_log.smaliPath("穿山甲Demo反编译完成:" + path);
|
||||
System.out.println(path);
|
||||
csj_Path = path;
|
||||
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
||||
log.smaliPath("开始修改穿山甲清单");
|
||||
_log.smaliPath("开始修改穿山甲");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AutoRandomAdSDK().startNotUnPackage(path, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
_log.smaliPath("穿山甲修改完成");
|
||||
System.out.println("-------" + path);
|
||||
csjManifest = true;
|
||||
runStart(log);
|
||||
runStart();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -260,7 +284,7 @@ public class CsjTools {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
@ -269,9 +293,9 @@ public class CsjTools {
|
||||
boolean csjManifest = false;
|
||||
boolean apkUnPackage = false;
|
||||
|
||||
private void runStart(SmaliApkToolsPath log) {
|
||||
private void runStart() {
|
||||
if (apkUnPackage && csjManifest) {
|
||||
start(log);
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user