测试穿山甲资源包工具
This commit is contained in:
parent
81db19fd4b
commit
9fa2eb3a02
@ -39,486 +39,492 @@ import com.qy.utils.JarToBase;
|
|||||||
import com.qy.utils.Tools;
|
import com.qy.utils.Tools;
|
||||||
|
|
||||||
public class AppMain extends JFrame {
|
public class AppMain extends JFrame {
|
||||||
private JList<String> configList;
|
private JList<String> configList;
|
||||||
private JButton zipToJar, jarToBase, reload, btnAdbPull;
|
private JButton zipToJar, jarToBase, reload, btnAdbPull;
|
||||||
private JTextField log;
|
private JTextField log;
|
||||||
public static JSONObject json;
|
public static JSONObject json;
|
||||||
private Vector<String> vector;
|
private Vector<String> vector;
|
||||||
public static boolean isOpenWindows = false;
|
public static boolean isOpenWindows = false;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private JTextField txtCom;
|
private JTextField txtCom;
|
||||||
private JButton btnUserBase;
|
private JButton btnUserBase;
|
||||||
private JTextField textPackName;
|
private JTextField textPackName;
|
||||||
private JButton btnRestartapp;
|
private JButton btnRestartapp;
|
||||||
private JLabel lblactivity;
|
private JLabel lblactivity;
|
||||||
private JTextField textActivity;
|
private JTextField textActivity;
|
||||||
private JMenuBar menuBar;
|
private JMenuBar menuBar;
|
||||||
private JTextField uFilePath;
|
private JTextField uFilePath;
|
||||||
private JSeparator separator;
|
private JSeparator separator;
|
||||||
private JMenuItem menuItem_1;
|
private JMenuItem menuItem_1;
|
||||||
private JCheckBox openWindows;
|
private JCheckBox openWindows;
|
||||||
private JMenu mnBasetools;
|
private JMenu mnBasetools;
|
||||||
private JMenuItem mntmbase;
|
private JMenuItem mntmbase;
|
||||||
private JMenuItem mntmBase;
|
private JMenuItem mntmBase;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
new AppMain();
|
new AppMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppMain() {
|
public AppMain() {
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
json = Tools.loadConfig(new File("config.cfg"));
|
json = Tools.loadConfig(new File("config.cfg"));
|
||||||
initView();
|
initView();
|
||||||
initData();
|
initData();
|
||||||
log.setText("已载入配置文件");
|
log.setText("已载入配置文件");
|
||||||
|
|
||||||
separator = new JSeparator();
|
separator = new JSeparator();
|
||||||
separator.setBounds(247, 149, 158, 2);
|
separator.setBounds(247, 149, 158, 2);
|
||||||
getContentPane().add(separator);
|
getContentPane().add(separator);
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
JSONArray array = json.getJSONArray("array");
|
JSONArray array = json.getJSONArray("array");
|
||||||
vector = new Vector<>();
|
vector = new Vector<>();
|
||||||
for (int i = 0; i < array.length(); i++) {
|
for (int i = 0; i < array.length(); i++) {
|
||||||
vector.add(array.getString(i));
|
vector.add(array.getString(i));
|
||||||
}
|
}
|
||||||
configList.setListData(vector);
|
configList.setListData(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
setTitle("\u8F6C\u6362\u5668v2.7");
|
setTitle("\u8F6C\u6362\u5668v2.7");
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
setSize(900, 456);
|
setSize(900, 456);
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
|
|
||||||
configList = new JList<String>();
|
configList = new JList<String>();
|
||||||
configList.setBounds(0, 0, 1, 1);
|
configList.setBounds(0, 0, 1, 1);
|
||||||
|
|
||||||
JScrollPane scrollBar = new JScrollPane(configList);
|
JScrollPane scrollBar = new JScrollPane(configList);
|
||||||
scrollBar.setBounds(51, 49, 147, 215);
|
scrollBar.setBounds(51, 49, 147, 215);
|
||||||
getContentPane().add(scrollBar);
|
getContentPane().add(scrollBar);
|
||||||
|
|
||||||
zipToJar = new JButton("\u8F6Cjar");
|
zipToJar = new JButton("\u8F6Cjar");
|
||||||
zipToJar.addMouseListener(new MouseAdapter() {
|
zipToJar.addMouseListener(new MouseAdapter() {
|
||||||
File file;
|
File file;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
String name,path;
|
String name, path;
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
if(configList.getSelectedIndex()<0) {
|
|
||||||
new TextToDalog("警告", "列表未选择");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
json.put("switch", configList.getSelectedIndex() + 1 + "");
|
|
||||||
path = json.getString("out");
|
|
||||||
name = json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1)+".jar";
|
|
||||||
file=new File(path+name);
|
|
||||||
if(file.exists())
|
|
||||||
file.delete();
|
|
||||||
|
|
||||||
JarToAJar.start(json);
|
|
||||||
|
|
||||||
timer=new Timer();
|
|
||||||
timer.schedule(new TimerTask() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
if(file.exists()) {
|
|
||||||
log.setText("已生成" + name);
|
|
||||||
timer.cancel();
|
|
||||||
}else {
|
|
||||||
log.setText("正在生成");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0,100);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
zipToJar.setBounds(247, 72, 158, 27);
|
|
||||||
getContentPane().add(zipToJar);
|
|
||||||
|
|
||||||
jarToBase = new JButton("\u52A0\u5BC6Jar");
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
jarToBase.addMouseListener(new MouseAdapter() {
|
if (configList.getSelectedIndex() < 0) {
|
||||||
@Override
|
new TextToDalog("警告", "列表未选择");
|
||||||
public void mouseClicked(MouseEvent e) {
|
return;
|
||||||
if(configList.getSelectedIndex()<0) {
|
}
|
||||||
new TextToDalog("警告", "列表未选择");
|
json.put("switch", configList.getSelectedIndex() + 1 + "");
|
||||||
return;
|
path = json.getString("out");
|
||||||
}
|
name = json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1) + ".jar";
|
||||||
json.put("switch", configList.getSelectedIndex() + 1 + "");
|
file = new File(path + name);
|
||||||
new EditToDalog("需要版本号", "请输入资源版本号", "", new SmaliApkToolsPath() {
|
if (file.exists())
|
||||||
String version;
|
file.delete();
|
||||||
@Override
|
|
||||||
public void smaliPath(String path) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
version=path;
|
|
||||||
if(version==null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new EditToDalog("资源类型", "请输入资源类型\n0=内核\n4=自主广告\n1=广点通\n5=聚量\n11=万维\n13=穿山甲", "", new SmaliApkToolsPath() {
|
|
||||||
@Override
|
|
||||||
public void smaliPath(String path) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
File input=new File(json.getString("out")
|
|
||||||
+ json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1) + ".jar");
|
|
||||||
JarToAJar.toAJar(json.getString("dx"), input.getAbsolutePath(), input.getAbsolutePath().replace(input.getName(), "dexTmp.jar"));
|
|
||||||
File outFile=new EncryptJar().encrypt(new File(input.getAbsolutePath().replace(input.getName(), "dexTmp.jar")), json.getString("out")
|
|
||||||
+ json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1) + "_encrypt.jar", Integer.valueOf(path)
|
|
||||||
, Integer.valueOf(version));
|
|
||||||
log.setText("data路径为:" + outFile.getAbsolutePath());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/*
|
|
||||||
* JarToBase.start(json.getString("out") +
|
|
||||||
* json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")
|
|
||||||
* ) - 1) + ".jar", true);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jarToBase.setBounds(247, 109, 158, 27);
|
|
||||||
getContentPane().add(jarToBase);
|
|
||||||
|
|
||||||
reload = new JButton("\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6");
|
JarToAJar.start(json);
|
||||||
reload.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
initData();
|
|
||||||
json = Tools.loadConfig(new File("config.cfg"));
|
|
||||||
log.setText("已重置");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
reload.setBounds(51, 13, 153, 27);
|
|
||||||
getContentPane().add(reload);
|
|
||||||
|
|
||||||
log = new JTextField("\u521D\u59CB\u5316");
|
timer = new Timer();
|
||||||
log.setBorder(new LineBorder(Color.BLACK, 0));
|
timer.schedule(new TimerTask() {
|
||||||
log.setHorizontalAlignment(SwingConstants.LEFT);
|
|
||||||
log.setForeground(Color.BLACK);
|
|
||||||
log.setEditable(false);
|
|
||||||
log.setBounds(51, 340, 766, 31);
|
|
||||||
getContentPane().add(log);
|
|
||||||
|
|
||||||
txtCom = new JTextField();
|
@Override
|
||||||
txtCom.setHorizontalAlignment(SwingConstants.LEFT);
|
public void run() {
|
||||||
txtCom.setText("adb push \"" + new File("").getAbsolutePath() + "/[jar]/data/data/[packname]/plugs/");
|
// TODO Auto-generated method stub
|
||||||
txtCom.setBounds(444, 73, 293, 27);
|
if (file.exists()) {
|
||||||
getContentPane().add(txtCom);
|
log.setText("已生成" + name);
|
||||||
txtCom.setColumns(10);
|
timer.cancel();
|
||||||
|
} else {
|
||||||
|
log.setText("正在生成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0, 100);
|
||||||
|
|
||||||
JLabel lblAdb = new JLabel("adb\u6307\u4EE4");
|
}
|
||||||
lblAdb.setBounds(444, 51, 72, 18);
|
});
|
||||||
getContentPane().add(lblAdb);
|
zipToJar.setBounds(247, 72, 158, 27);
|
||||||
|
getContentPane().add(zipToJar);
|
||||||
|
|
||||||
btnAdbPull = new JButton("adb");
|
jarToBase = new JButton("\u52A0\u5BC6Jar");
|
||||||
btnAdbPull.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
String cmd = txtCom.getText();
|
|
||||||
cmd = cmd.replace("[packname]", textPackName.getText());
|
|
||||||
cmd = cmd.replace("[jar]", configList.getSelectedValue().toString() + ".jar");
|
|
||||||
try {
|
|
||||||
System.out.println(cmd);
|
|
||||||
Runtime.getRuntime().exec("adb root");
|
|
||||||
Runtime.getRuntime().exec("adb remount");
|
|
||||||
Runtime.getRuntime().exec(cmd);
|
|
||||||
log.setText("执行:" + cmd);
|
|
||||||
} catch (IOException e1) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
|
||||||
log.setText("执行失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
jarToBase.addMouseListener(new MouseAdapter() {
|
||||||
});
|
@Override
|
||||||
btnAdbPull.setBounds(444, 295, 147, 27);
|
public void mouseClicked(MouseEvent e) {
|
||||||
getContentPane().add(btnAdbPull);
|
if (configList.getSelectedIndex() < 0) {
|
||||||
|
new TextToDalog("警告", "列表未选择");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
json.put("switch", configList.getSelectedIndex() + 1 + "");
|
||||||
|
new EditToDalog("需要版本号", "请输入资源版本号", "", new SmaliApkToolsPath() {
|
||||||
|
String version;
|
||||||
|
|
||||||
new ButtonGroup();
|
@Override
|
||||||
|
public void smaliPath(String path) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
version = path;
|
||||||
|
if (version == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new EditToDalog("资源类型", "请输入资源类型\n0=内核\n4=自主广告\n1=广点通\n5=聚量\n11=万维\n13=穿山甲", "", new SmaliApkToolsPath() {
|
||||||
|
@Override
|
||||||
|
public void smaliPath(String path) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
File input = new File(json.getString("out")
|
||||||
|
+ json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1) + ".jar");
|
||||||
|
JarToAJar.toAJar(json.getString("dx"), input.getAbsolutePath(), input.getAbsolutePath().replace(input.getName(), "dexTmp.jar"));
|
||||||
|
File outFile = new EncryptJar().encrypt(new File(input.getAbsolutePath().replace(input.getName(), "dexTmp.jar")), json.getString("out")
|
||||||
|
+ json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")) - 1) + "_encrypt.jar", Integer.valueOf(path)
|
||||||
|
, Integer.valueOf(version));
|
||||||
|
log.setText("data路径为:" + outFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
* JarToBase.start(json.getString("out") +
|
||||||
|
* json.getJSONArray("array").getString(Integer.valueOf(json.getString("switch")
|
||||||
|
* ) - 1) + ".jar", true);
|
||||||
|
*/
|
||||||
|
|
||||||
btnUserBase = new JButton("\u52A0\u5BC6\u6587\u4EF6");
|
}
|
||||||
btnUserBase.addMouseListener(new MouseAdapter() {
|
});
|
||||||
File file;
|
jarToBase.setBounds(247, 109, 158, 27);
|
||||||
@Override
|
getContentPane().add(jarToBase);
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
|
||||||
jFile.showOpenDialog(null);
|
|
||||||
file = jFile.getSelectedFile();
|
|
||||||
new EditToDalog("需要版本号", "请输入资源版本号", "", new SmaliApkToolsPath() {
|
|
||||||
String version;
|
|
||||||
@Override
|
|
||||||
public void smaliPath(String path) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
version=path;
|
|
||||||
if(version==null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new EditToDalog("资源类型", "请输入资源类型\n0=内核\n4=自主广告\n1=广点通\n5=聚量\n11=万维\n13=穿山甲", "", new SmaliApkToolsPath() {
|
|
||||||
@Override
|
|
||||||
public void smaliPath(String path) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
JarToAJar.toAJar(json.getString("dx"), file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), "dexTmp.jar"));
|
|
||||||
File fileOut=new EncryptJar().encrypt(new File(file.getAbsolutePath().replace(file.getName(), "dexTmp.jar")), file.getAbsolutePath() + "_encrypt.jar", Integer.valueOf(path)
|
|
||||||
, Integer.valueOf(version));
|
|
||||||
log.setText("data路径为:" + fileOut.getAbsolutePath());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//JarToBase.start(file.getAbsolutePath(), true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnUserBase.setBounds(247, 160, 158, 27);
|
|
||||||
getContentPane().add(btnUserBase);
|
|
||||||
|
|
||||||
JButton btnNewButton = new JButton("\u89E3\u5BC6\u6587\u4EF6");
|
reload = new JButton("\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6");
|
||||||
btnNewButton.addMouseListener(new MouseAdapter() {
|
reload.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
initData();
|
||||||
jFile.showOpenDialog(null);
|
json = Tools.loadConfig(new File("config.cfg"));
|
||||||
File file = jFile.getSelectedFile();
|
log.setText("已重置");
|
||||||
String fileName=file.getAbsolutePath();
|
}
|
||||||
if(fileName.endsWith("_encrypt.jar")) {
|
});
|
||||||
fileName=fileName.replace("_encrypt.jar", "_decrypt.jar");
|
reload.setBounds(51, 13, 153, 27);
|
||||||
}else {
|
getContentPane().add(reload);
|
||||||
fileName+="_decrypt.jar";
|
|
||||||
}
|
|
||||||
EncryptJar.FileData data= new EncryptJar().decrypt(file, fileName);
|
|
||||||
new TextToDalog("解码提示", data.toString());
|
|
||||||
//JarToBase.start(file.getAbsolutePath(), false);
|
|
||||||
log.setText("已解码");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnNewButton.setBounds(247, 200, 158, 27);
|
|
||||||
getContentPane().add(btnNewButton);
|
|
||||||
|
|
||||||
openWindows = new JCheckBox("\u6253\u5F00\u7A97\u53E3");
|
log = new JTextField("\u521D\u59CB\u5316");
|
||||||
openWindows.addActionListener(new ActionListener() {
|
log.setBorder(new LineBorder(Color.BLACK, 0));
|
||||||
public void actionPerformed(ActionEvent e) {
|
log.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
isOpenWindows = openWindows.isSelected();
|
log.setForeground(Color.BLACK);
|
||||||
}
|
log.setEditable(false);
|
||||||
});
|
log.setBounds(51, 340, 766, 31);
|
||||||
|
getContentPane().add(log);
|
||||||
|
|
||||||
openWindows.setBounds(247, 30, 133, 31);
|
txtCom = new JTextField();
|
||||||
getContentPane().add(openWindows);
|
txtCom.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
|
txtCom.setText("adb push \"" + new File("").getAbsolutePath() + "/[jar]/data/data/[packname]/plugs/");
|
||||||
|
txtCom.setBounds(444, 73, 293, 27);
|
||||||
|
getContentPane().add(txtCom);
|
||||||
|
txtCom.setColumns(10);
|
||||||
|
|
||||||
JLabel label = new JLabel("\u5305\u540D");
|
JLabel lblAdb = new JLabel("adb\u6307\u4EE4");
|
||||||
label.setBounds(444, 113, 72, 18);
|
lblAdb.setBounds(444, 51, 72, 18);
|
||||||
getContentPane().add(label);
|
getContentPane().add(lblAdb);
|
||||||
|
|
||||||
textPackName = new JTextField();
|
btnAdbPull = new JButton("adb");
|
||||||
textPackName.setText("com.luckyboy.mmxing");
|
btnAdbPull.addMouseListener(new MouseAdapter() {
|
||||||
textPackName.setBounds(444, 135, 293, 24);
|
@Override
|
||||||
getContentPane().add(textPackName);
|
public void mouseClicked(MouseEvent e) {
|
||||||
textPackName.setColumns(10);
|
String cmd = txtCom.getText();
|
||||||
|
cmd = cmd.replace("[packname]", textPackName.getText());
|
||||||
|
cmd = cmd.replace("[jar]", configList.getSelectedValue().toString() + ".jar");
|
||||||
|
try {
|
||||||
|
System.out.println(cmd);
|
||||||
|
Runtime.getRuntime().exec("adb root");
|
||||||
|
Runtime.getRuntime().exec("adb remount");
|
||||||
|
Runtime.getRuntime().exec(cmd);
|
||||||
|
log.setText("执行:" + cmd);
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
log.setText("执行失败");
|
||||||
|
}
|
||||||
|
|
||||||
btnRestartapp = new JButton("\u91CD\u542FAPP");
|
}
|
||||||
btnRestartapp.addMouseListener(new MouseAdapter() {
|
});
|
||||||
@Override
|
btnAdbPull.setBounds(444, 295, 147, 27);
|
||||||
public void mouseClicked(MouseEvent e) {
|
getContentPane().add(btnAdbPull);
|
||||||
try {
|
|
||||||
Runtime.getRuntime().exec("adb shell am force-stop " + textPackName.getText());
|
|
||||||
Runtime.getRuntime()
|
|
||||||
.exec("adb shell am start " + textPackName.getText() + File.separator + textActivity.getText());
|
|
||||||
log.setText("重启完毕");
|
|
||||||
} catch (IOException e1) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
|
||||||
log.setText("重启失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnRestartapp.setBounds(595, 295, 147, 27);
|
|
||||||
getContentPane().add(btnRestartapp);
|
|
||||||
|
|
||||||
lblactivity = new JLabel("\u4E3BActivity");
|
new ButtonGroup();
|
||||||
lblactivity.setBounds(444, 164, 119, 18);
|
|
||||||
getContentPane().add(lblactivity);
|
|
||||||
|
|
||||||
textActivity = new JTextField();
|
btnUserBase = new JButton("\u52A0\u5BC6\u6587\u4EF6");
|
||||||
textActivity.setText(".MainActivity");
|
btnUserBase.addMouseListener(new MouseAdapter() {
|
||||||
textActivity.setBounds(444, 185, 293, 24);
|
File file;
|
||||||
getContentPane().add(textActivity);
|
|
||||||
textActivity.setColumns(10);
|
|
||||||
|
|
||||||
JButton btnJavatoajar = new JButton("Jar\u8F6C\u5B89\u5353Jar");
|
@Override
|
||||||
btnJavatoajar.addMouseListener(new MouseAdapter() {
|
public void mouseClicked(MouseEvent e) {
|
||||||
@Override
|
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
public void mouseClicked(MouseEvent e) {
|
jFile.showOpenDialog(null);
|
||||||
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
file = jFile.getSelectedFile();
|
||||||
chooser.showOpenDialog(null);
|
new EditToDalog("需要版本号", "请输入资源版本号", "", new SmaliApkToolsPath() {
|
||||||
File java = chooser.getSelectedFile();
|
String version;
|
||||||
JarToAJar.toAJar(json.getString("dx"), java.getAbsolutePath(),
|
|
||||||
new File("").getAbsolutePath() + File.separator+java.getName()+"_jar.jar");
|
|
||||||
if (AppMain.isOpenWindows) {
|
|
||||||
try {
|
|
||||||
Desktop.getDesktop().open(new File(new File("").getAbsolutePath()));
|
|
||||||
} catch (IOException e1) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.setText("已转为Android可用java");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnJavatoajar.setBounds(247, 237, 158, 27);
|
|
||||||
getContentPane().add(btnJavatoajar);
|
|
||||||
|
|
||||||
JLabel label_t = new JLabel("\u83B7\u53D6\u81EA\u5B9A\u4E49\u6587\u4EF6\u8DEF\u5F84");
|
@Override
|
||||||
label_t.setBounds(444, 215, 208, 18);
|
public void smaliPath(String path) {
|
||||||
getContentPane().add(label_t);
|
// TODO Auto-generated method stub
|
||||||
|
version = path;
|
||||||
|
if (version == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new EditToDalog("资源类型", "请输入资源类型\n0=内核\n4=自主广告\n1=广点通\n5=聚量\n11=万维\n13=穿山甲", "", new SmaliApkToolsPath() {
|
||||||
|
@Override
|
||||||
|
public void smaliPath(String path) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
JarToAJar.toAJar(json.getString("dx"), file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), "dexTmp.jar"));
|
||||||
|
File fileOut = new EncryptJar().encrypt(new File(file.getAbsolutePath().replace(file.getName(), "dexTmp.jar")), file.getAbsolutePath() + "_encrypt.jar", Integer.valueOf(path)
|
||||||
|
, Integer.valueOf(version));
|
||||||
|
System.out.println("data路径为:" + fileOut.getAbsolutePath());
|
||||||
|
if (log != null)
|
||||||
|
log.setText("data路径为:" + fileOut.getAbsolutePath());
|
||||||
|
|
||||||
uFilePath = new JTextField();
|
}
|
||||||
uFilePath.setBounds(444, 238, 293, 24);
|
});
|
||||||
getContentPane().add(uFilePath);
|
}
|
||||||
uFilePath.setColumns(10);
|
});
|
||||||
|
//JarToBase.start(file.getAbsolutePath(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnUserBase.setBounds(247, 160, 158, 27);
|
||||||
|
getContentPane().add(btnUserBase);
|
||||||
|
|
||||||
JButton button = new JButton("\u83B7\u53D6");
|
JButton btnNewButton = new JButton("\u89E3\u5BC6\u6587\u4EF6");
|
||||||
button.addMouseListener(new MouseAdapter() {
|
btnNewButton.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
chooser.showOpenDialog(null);
|
jFile.showOpenDialog(null);
|
||||||
File file = chooser.getSelectedFile();
|
File file = jFile.getSelectedFile();
|
||||||
uFilePath.setText(file.getAbsolutePath());
|
String fileName = file.getAbsolutePath();
|
||||||
log.setText("获取自定义文件路径完成");
|
if (fileName.endsWith("_encrypt.jar")) {
|
||||||
|
fileName = fileName.replace("_encrypt.jar", "_decrypt.jar");
|
||||||
|
} else {
|
||||||
|
fileName += "_decrypt.jar";
|
||||||
|
}
|
||||||
|
EncryptJar.FileData data = new EncryptJar().decrypt(file, fileName);
|
||||||
|
new TextToDalog("解码提示", data.toString());
|
||||||
|
//JarToBase.start(file.getAbsolutePath(), false);
|
||||||
|
log.setText("已解码");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnNewButton.setBounds(247, 200, 158, 27);
|
||||||
|
getContentPane().add(btnNewButton);
|
||||||
|
|
||||||
}
|
openWindows = new JCheckBox("\u6253\u5F00\u7A97\u53E3");
|
||||||
});
|
openWindows.addActionListener(new ActionListener() {
|
||||||
button.setBounds(755, 235, 113, 27);
|
public void actionPerformed(ActionEvent e) {
|
||||||
getContentPane().add(button);
|
isOpenWindows = openWindows.isSelected();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
menuBar = new JMenuBar();
|
openWindows.setBounds(247, 30, 133, 31);
|
||||||
|
getContentPane().add(openWindows);
|
||||||
setJMenuBar(menuBar);
|
|
||||||
|
|
||||||
JMenu mnNewMenu = new JMenu("\u83DC\u5355");
|
JLabel label = new JLabel("\u5305\u540D");
|
||||||
menuBar.add(mnNewMenu);
|
label.setBounds(444, 113, 72, 18);
|
||||||
|
getContentPane().add(label);
|
||||||
|
|
||||||
JMenuItem menuItem = new JMenuItem("\u91CD\u542F");
|
textPackName = new JTextField();
|
||||||
menuItem.addActionListener(new ActionListener() {
|
textPackName.setText("com.luckyboy.mmxing");
|
||||||
public void actionPerformed(ActionEvent e) {
|
textPackName.setBounds(444, 135, 293, 24);
|
||||||
dispose();
|
getContentPane().add(textPackName);
|
||||||
new AppMain();
|
textPackName.setColumns(10);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mnNewMenu.add(menuItem);
|
btnRestartapp = new JButton("\u91CD\u542FAPP");
|
||||||
|
btnRestartapp.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec("adb shell am force-stop " + textPackName.getText());
|
||||||
|
Runtime.getRuntime()
|
||||||
|
.exec("adb shell am start " + textPackName.getText() + File.separator + textActivity.getText());
|
||||||
|
log.setText("重启完毕");
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
log.setText("重启失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnRestartapp.setBounds(595, 295, 147, 27);
|
||||||
|
getContentPane().add(btnRestartapp);
|
||||||
|
|
||||||
JMenu menu = new JMenu("\u5DE5\u5177");
|
lblactivity = new JLabel("\u4E3BActivity");
|
||||||
menuBar.add(menu);
|
lblactivity.setBounds(444, 164, 119, 18);
|
||||||
|
getContentPane().add(lblactivity);
|
||||||
|
|
||||||
JMenuItem mntmAes = new JMenuItem("AES\u5DE5\u5177");
|
textActivity = new JTextField();
|
||||||
mntmAes.addActionListener(new ActionListener() {
|
textActivity.setText(".MainActivity");
|
||||||
public void actionPerformed(ActionEvent e) {
|
textActivity.setBounds(444, 185, 293, 24);
|
||||||
new AESUi();
|
getContentPane().add(textActivity);
|
||||||
}
|
textActivity.setColumns(10);
|
||||||
});
|
|
||||||
menu.add(mntmAes);
|
|
||||||
|
|
||||||
JMenuItem mntmSmali = new JMenuItem("Smali\u5DE5\u5177");
|
JButton btnJavatoajar = new JButton("Jar\u8F6C\u5B89\u5353Jar");
|
||||||
mntmSmali.addActionListener(new ActionListener() {
|
btnJavatoajar.addMouseListener(new MouseAdapter() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
@Override
|
||||||
new SmaliUi();
|
public void mouseClicked(MouseEvent e) {
|
||||||
}
|
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
});
|
chooser.showOpenDialog(null);
|
||||||
menu.add(mntmSmali);
|
File java = chooser.getSelectedFile();
|
||||||
|
JarToAJar.toAJar(json.getString("dx"), java.getAbsolutePath(),
|
||||||
JMenuItem mntmsdk = new JMenuItem("\u4E00\u952E\u77ED\u4EE3SDK");
|
new File("").getAbsolutePath() + File.separator + java.getName() + "_jar.jar");
|
||||||
mntmsdk.addActionListener(new ActionListener() {
|
if (AppMain.isOpenWindows) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
try {
|
||||||
new SMSToolsUi();
|
Desktop.getDesktop().open(new File(new File("").getAbsolutePath()));
|
||||||
}
|
} catch (IOException e1) {
|
||||||
});
|
// TODO Auto-generated catch block
|
||||||
menu.add(mntmsdk);
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
menuItem_1 = new JMenuItem("\u67E5\u770B\u7B7E\u540D");
|
}
|
||||||
menuItem_1.addActionListener(new ActionListener() {
|
log.setText("已转为Android可用java");
|
||||||
@Override
|
}
|
||||||
public void actionPerformed(ActionEvent e) {
|
});
|
||||||
new AndroidKey();
|
btnJavatoajar.setBounds(247, 237, 158, 27);
|
||||||
}
|
getContentPane().add(btnJavatoajar);
|
||||||
});
|
|
||||||
menu.add(menuItem_1);
|
|
||||||
|
|
||||||
JMenuItem mntmOnweay = new JMenuItem("\u4FEE\u6539\u4E07\u7EF4\u63D2\u4EF6\u5305");
|
|
||||||
mntmOnweay.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
|
||||||
chooser.showOpenDialog(null);
|
|
||||||
File file = chooser.getSelectedFile();
|
|
||||||
uFilePath.setText(file.getAbsolutePath());
|
|
||||||
log.setText("正在修改万维插件包...");
|
|
||||||
new OneWayTools(file);
|
|
||||||
log.setText("修改万维成功,成功后文件将生成在反编译文件夹中");
|
|
||||||
|
|
||||||
}
|
JLabel label_t = new JLabel("\u83B7\u53D6\u81EA\u5B9A\u4E49\u6587\u4EF6\u8DEF\u5F84");
|
||||||
});
|
label_t.setBounds(444, 215, 208, 18);
|
||||||
|
getContentPane().add(label_t);
|
||||||
JMenuItem mntmapk = new JMenuItem("\u7B7E\u540DAPK");
|
|
||||||
mntmapk.addActionListener(new ActionListener() {
|
uFilePath = new JTextField();
|
||||||
public void actionPerformed(ActionEvent e) {
|
uFilePath.setBounds(444, 238, 293, 24);
|
||||||
new ApkSignUi();
|
getContentPane().add(uFilePath);
|
||||||
}
|
uFilePath.setColumns(10);
|
||||||
});
|
|
||||||
menu.add(mntmapk);
|
JButton button = new JButton("\u83B7\u53D6");
|
||||||
menu.add(mntmOnweay);
|
button.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
JMenuItem mntmsdk_1 = new JMenuItem("\u4FEE\u6539\u7B2C\u4E09\u65B9SDK");
|
public void mouseClicked(MouseEvent e) {
|
||||||
mntmsdk_1.addActionListener(new ActionListener() {
|
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
chooser.showOpenDialog(null);
|
||||||
new ModifySdkUi();
|
File file = chooser.getSelectedFile();
|
||||||
}
|
uFilePath.setText(file.getAbsolutePath());
|
||||||
});
|
log.setText("获取自定义文件路径完成");
|
||||||
menu.add(mntmsdk_1);
|
|
||||||
|
}
|
||||||
mnBasetools = new JMenu("Base64\u5DE5\u5177");
|
});
|
||||||
menuBar.add(mnBasetools);
|
button.setBounds(755, 235, 113, 27);
|
||||||
|
getContentPane().add(button);
|
||||||
mntmbase = new JMenuItem("\u8F6CBase64");
|
|
||||||
mntmbase.addActionListener(new ActionListener() {
|
menuBar = new JMenuBar();
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
setJMenuBar(menuBar);
|
||||||
jFile.showOpenDialog(null);
|
|
||||||
File file = jFile.getSelectedFile();
|
JMenu mnNewMenu = new JMenu("\u83DC\u5355");
|
||||||
JarToBase.start(file.getAbsolutePath(), true);
|
menuBar.add(mnNewMenu);
|
||||||
}
|
|
||||||
});
|
JMenuItem menuItem = new JMenuItem("\u91CD\u542F");
|
||||||
mnBasetools.add(mntmbase);
|
menuItem.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
mntmBase = new JMenuItem("Base64\u89E3\u7801");
|
dispose();
|
||||||
mntmBase.addActionListener(new ActionListener() {
|
new AppMain();
|
||||||
public void actionPerformed(ActionEvent e) {
|
}
|
||||||
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
});
|
||||||
jFile.showOpenDialog(AppMain.this);
|
|
||||||
File file = jFile.getSelectedFile();
|
mnNewMenu.add(menuItem);
|
||||||
JarToBase.start(file.getAbsolutePath(), false);
|
|
||||||
log.setText("已解码");
|
JMenu menu = new JMenu("\u5DE5\u5177");
|
||||||
}
|
menuBar.add(menu);
|
||||||
});
|
|
||||||
mnBasetools.add(mntmBase);
|
JMenuItem mntmAes = new JMenuItem("AES\u5DE5\u5177");
|
||||||
|
mntmAes.addActionListener(new ActionListener() {
|
||||||
setVisible(true);
|
public void actionPerformed(ActionEvent e) {
|
||||||
}
|
new AESUi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(mntmAes);
|
||||||
|
|
||||||
|
JMenuItem mntmSmali = new JMenuItem("Smali\u5DE5\u5177");
|
||||||
|
mntmSmali.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
new SmaliUi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(mntmSmali);
|
||||||
|
|
||||||
|
JMenuItem mntmsdk = new JMenuItem("\u4E00\u952E\u77ED\u4EE3SDK");
|
||||||
|
mntmsdk.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
new SMSToolsUi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(mntmsdk);
|
||||||
|
|
||||||
|
menuItem_1 = new JMenuItem("\u67E5\u770B\u7B7E\u540D");
|
||||||
|
menuItem_1.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
new AndroidKey();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(menuItem_1);
|
||||||
|
|
||||||
|
JMenuItem mntmOnweay = new JMenuItem("\u4FEE\u6539\u4E07\u7EF4\u63D2\u4EF6\u5305");
|
||||||
|
mntmOnweay.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
|
chooser.showOpenDialog(null);
|
||||||
|
File file = chooser.getSelectedFile();
|
||||||
|
uFilePath.setText(file.getAbsolutePath());
|
||||||
|
log.setText("正在修改万维插件包...");
|
||||||
|
new OneWayTools(file);
|
||||||
|
log.setText("修改万维成功,成功后文件将生成在反编译文件夹中");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
JMenuItem mntmapk = new JMenuItem("\u7B7E\u540DAPK");
|
||||||
|
mntmapk.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
new ApkSignUi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(mntmapk);
|
||||||
|
menu.add(mntmOnweay);
|
||||||
|
|
||||||
|
JMenuItem mntmsdk_1 = new JMenuItem("\u4FEE\u6539\u7B2C\u4E09\u65B9SDK");
|
||||||
|
mntmsdk_1.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
new ModifySdkUi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(mntmsdk_1);
|
||||||
|
|
||||||
|
mnBasetools = new JMenu("Base64\u5DE5\u5177");
|
||||||
|
menuBar.add(mnBasetools);
|
||||||
|
|
||||||
|
mntmbase = new JMenuItem("\u8F6CBase64");
|
||||||
|
mntmbase.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
|
jFile.showOpenDialog(null);
|
||||||
|
File file = jFile.getSelectedFile();
|
||||||
|
JarToBase.start(file.getAbsolutePath(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mnBasetools.add(mntmbase);
|
||||||
|
|
||||||
|
mntmBase = new JMenuItem("Base64\u89E3\u7801");
|
||||||
|
mntmBase.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
|
||||||
|
jFile.showOpenDialog(AppMain.this);
|
||||||
|
File file = jFile.getSelectedFile();
|
||||||
|
JarToBase.start(file.getAbsolutePath(), false);
|
||||||
|
log.setText("已解码");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mnBasetools.add(mntmBase);
|
||||||
|
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
111
src/com/qy/utils/CsjTools.java
Normal file
111
src/com/qy/utils/CsjTools.java
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
package com.qy.utils;
|
||||||
|
|
||||||
|
import com.qy.Interfaces.SmaliApkToolsPath;
|
||||||
|
import com.qy.ui.TextToDalog;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
BufferedReader reader=new BufferedReader(new FileReader(apk_R));
|
||||||
|
String tmp;
|
||||||
|
while ((tmp=reader.readLine())!=null){
|
||||||
|
if(tmp.contains("/R$")){
|
||||||
|
r_list.add(tmp.split("/")[tmp.split("/").length-1].replace(";,","").replace(";",""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*for (String fileName : r_list) {
|
||||||
|
setRData(fileName);
|
||||||
|
}*/
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
csj.add("\n");
|
||||||
|
} 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 out(){
|
||||||
|
EncryptJar encryptJar=new EncryptJar();
|
||||||
|
encryptJar.encrypt(new File("E:\\idea\\android_sdk_tools\\csj.apk"),"E:\\idea\\android_sdk_tools\\csj_",13,5600);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
CsjTools tools=new CsjTools();
|
||||||
|
tools.out();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ public class EncryptJar {
|
|||||||
FileOutputStream fos = new FileOutputStream(outputFile);
|
FileOutputStream fos = new FileOutputStream(outputFile);
|
||||||
fos.write(int2byte(filetype));
|
fos.write(int2byte(filetype));
|
||||||
|
|
||||||
System.out.println("资源包版本号:" + ver);
|
System.out.println("资源包版本号:" + ver);
|
||||||
fos.write(int2byte(ver));
|
fos.write(int2byte(ver));
|
||||||
|
|
||||||
FileInputStream is = new FileInputStream(file);
|
FileInputStream is = new FileInputStream(file);
|
||||||
@ -124,7 +124,7 @@ public class EncryptJar {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "资源类型:"+type + " 版本号:" + version + " 文件路径:" + file.getAbsolutePath();
|
return "资源类型:"+type + " 版本号:" + version + " 文件路径:" + file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ public class Tools {
|
|||||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼ʧ<EFBFBD><EFBFBD>
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼ʧ<EFBFBD><EFBFBD>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
destFile.delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ 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);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
while ((byteread = in.read(buffer)) != -1) {
|
while ((byteread = in.read(buffer)) != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user