测试穿山甲资源包工具

This commit is contained in:
Yutousama 2020-02-16 21:49:13 +08:00
parent 81db19fd4b
commit 9fa2eb3a02
4 changed files with 563 additions and 445 deletions

View File

@ -39,486 +39,492 @@ import com.qy.utils.JarToBase;
import com.qy.utils.Tools;
public class AppMain extends JFrame {
private JList<String> configList;
private JButton zipToJar, jarToBase, reload, btnAdbPull;
private JTextField log;
public static JSONObject json;
private Vector<String> vector;
public static boolean isOpenWindows = false;
/**
*
*/
private static final long serialVersionUID = 1L;
private JTextField txtCom;
private JButton btnUserBase;
private JTextField textPackName;
private JButton btnRestartapp;
private JLabel lblactivity;
private JTextField textActivity;
private JMenuBar menuBar;
private JTextField uFilePath;
private JSeparator separator;
private JMenuItem menuItem_1;
private JCheckBox openWindows;
private JMenu mnBasetools;
private JMenuItem mntmbase;
private JMenuItem mntmBase;
private JList<String> configList;
private JButton zipToJar, jarToBase, reload, btnAdbPull;
private JTextField log;
public static JSONObject json;
private Vector<String> vector;
public static boolean isOpenWindows = false;
/**
*
*/
private static final long serialVersionUID = 1L;
private JTextField txtCom;
private JButton btnUserBase;
private JTextField textPackName;
private JButton btnRestartapp;
private JLabel lblactivity;
private JTextField textActivity;
private JMenuBar menuBar;
private JTextField uFilePath;
private JSeparator separator;
private JMenuItem menuItem_1;
private JCheckBox openWindows;
private JMenu mnBasetools;
private JMenuItem mntmbase;
private JMenuItem mntmBase;
public static void main(String[] args) {
// TODO Auto-generated method stub
new AppMain();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new AppMain();
}
public AppMain() {
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
json = Tools.loadConfig(new File("config.cfg"));
initView();
initData();
log.setText("已载入配置文件");
public AppMain() {
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
json = Tools.loadConfig(new File("config.cfg"));
initView();
initData();
log.setText("已载入配置文件");
separator = new JSeparator();
separator.setBounds(247, 149, 158, 2);
getContentPane().add(separator);
separator = new JSeparator();
separator.setBounds(247, 149, 158, 2);
getContentPane().add(separator);
repaint();
}
repaint();
}
private void initData() {
JSONArray array = json.getJSONArray("array");
vector = new Vector<>();
for (int i = 0; i < array.length(); i++) {
vector.add(array.getString(i));
}
configList.setListData(vector);
}
private void initData() {
JSONArray array = json.getJSONArray("array");
vector = new Vector<>();
for (int i = 0; i < array.length(); i++) {
vector.add(array.getString(i));
}
configList.setListData(vector);
}
private void initView() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
setTitle("\u8F6C\u6362\u5668v2.7");
// TODO Auto-generated constructor stub
setSize(900, 456);
getContentPane().setLayout(null);
private void initView() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
setTitle("\u8F6C\u6362\u5668v2.7");
// TODO Auto-generated constructor stub
setSize(900, 456);
getContentPane().setLayout(null);
configList = new JList<String>();
configList.setBounds(0, 0, 1, 1);
configList = new JList<String>();
configList.setBounds(0, 0, 1, 1);
JScrollPane scrollBar = new JScrollPane(configList);
scrollBar.setBounds(51, 49, 147, 215);
getContentPane().add(scrollBar);
JScrollPane scrollBar = new JScrollPane(configList);
scrollBar.setBounds(51, 49, 147, 215);
getContentPane().add(scrollBar);
zipToJar = new JButton("\u8F6Cjar");
zipToJar.addMouseListener(new MouseAdapter() {
File file;
Timer timer;
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);
zipToJar = new JButton("\u8F6Cjar");
zipToJar.addMouseListener(new MouseAdapter() {
File file;
Timer timer;
String name, path;
jarToBase = new JButton("\u52A0\u5BC6Jar");
jarToBase.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(configList.getSelectedIndex()<0) {
new TextToDalog("警告", "列表未选择");
return;
}
json.put("switch", configList.getSelectedIndex() + 1 + "");
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
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);
@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();
reload = new JButton("\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6");
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);
JarToAJar.start(json);
log = new JTextField("\u521D\u59CB\u5316");
log.setBorder(new LineBorder(Color.BLACK, 0));
log.setHorizontalAlignment(SwingConstants.LEFT);
log.setForeground(Color.BLACK);
log.setEditable(false);
log.setBounds(51, 340, 766, 31);
getContentPane().add(log);
timer = new Timer();
timer.schedule(new TimerTask() {
txtCom = new JTextField();
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);
@Override
public void run() {
// TODO Auto-generated method stub
if (file.exists()) {
log.setText("已生成" + name);
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");
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 = new JButton("\u52A0\u5BC6Jar");
}
});
btnAdbPull.setBounds(444, 295, 147, 27);
getContentPane().add(btnAdbPull);
jarToBase.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
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;
@Override
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);
}
});
jarToBase.setBounds(247, 109, 158, 27);
getContentPane().add(jarToBase);
JButton btnNewButton = new JButton("\u89E3\u5BC6\u6587\u4EF6");
btnNewButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
jFile.showOpenDialog(null);
File file = jFile.getSelectedFile();
String fileName=file.getAbsolutePath();
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);
reload = new JButton("\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6");
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);
openWindows = new JCheckBox("\u6253\u5F00\u7A97\u53E3");
openWindows.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
isOpenWindows = openWindows.isSelected();
}
});
log = new JTextField("\u521D\u59CB\u5316");
log.setBorder(new LineBorder(Color.BLACK, 0));
log.setHorizontalAlignment(SwingConstants.LEFT);
log.setForeground(Color.BLACK);
log.setEditable(false);
log.setBounds(51, 340, 766, 31);
getContentPane().add(log);
openWindows.setBounds(247, 30, 133, 31);
getContentPane().add(openWindows);
txtCom = new JTextField();
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");
label.setBounds(444, 113, 72, 18);
getContentPane().add(label);
JLabel lblAdb = new JLabel("adb\u6307\u4EE4");
lblAdb.setBounds(444, 51, 72, 18);
getContentPane().add(lblAdb);
textPackName = new JTextField();
textPackName.setText("com.luckyboy.mmxing");
textPackName.setBounds(444, 135, 293, 24);
getContentPane().add(textPackName);
textPackName.setColumns(10);
btnAdbPull = new JButton("adb");
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("执行失败");
}
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);
}
});
btnAdbPull.setBounds(444, 295, 147, 27);
getContentPane().add(btnAdbPull);
lblactivity = new JLabel("\u4E3BActivity");
lblactivity.setBounds(444, 164, 119, 18);
getContentPane().add(lblactivity);
new ButtonGroup();
textActivity = new JTextField();
textActivity.setText(".MainActivity");
textActivity.setBounds(444, 185, 293, 24);
getContentPane().add(textActivity);
textActivity.setColumns(10);
btnUserBase = new JButton("\u52A0\u5BC6\u6587\u4EF6");
btnUserBase.addMouseListener(new MouseAdapter() {
File file;
JButton btnJavatoajar = new JButton("Jar\u8F6C\u5B89\u5353Jar");
btnJavatoajar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
chooser.showOpenDialog(null);
File java = chooser.getSelectedFile();
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);
@Override
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;
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);
@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));
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");
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
uFilePath.setText(file.getAbsolutePath());
log.setText("获取自定义文件路径完成");
JButton btnNewButton = new JButton("\u89E3\u5BC6\u6587\u4EF6");
btnNewButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser jFile = new JFileChooser(new File(new File("").getAbsolutePath()));
jFile.showOpenDialog(null);
File file = jFile.getSelectedFile();
String fileName = file.getAbsolutePath();
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);
}
});
button.setBounds(755, 235, 113, 27);
getContentPane().add(button);
openWindows = new JCheckBox("\u6253\u5F00\u7A97\u53E3");
openWindows.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
isOpenWindows = openWindows.isSelected();
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
openWindows.setBounds(247, 30, 133, 31);
getContentPane().add(openWindows);
JMenu mnNewMenu = new JMenu("\u83DC\u5355");
menuBar.add(mnNewMenu);
JLabel label = new JLabel("\u5305\u540D");
label.setBounds(444, 113, 72, 18);
getContentPane().add(label);
JMenuItem menuItem = new JMenuItem("\u91CD\u542F");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
new AppMain();
}
});
textPackName = new JTextField();
textPackName.setText("com.luckyboy.mmxing");
textPackName.setBounds(444, 135, 293, 24);
getContentPane().add(textPackName);
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");
menuBar.add(menu);
lblactivity = new JLabel("\u4E3BActivity");
lblactivity.setBounds(444, 164, 119, 18);
getContentPane().add(lblactivity);
JMenuItem mntmAes = new JMenuItem("AES\u5DE5\u5177");
mntmAes.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new AESUi();
}
});
menu.add(mntmAes);
textActivity = new JTextField();
textActivity.setText(".MainActivity");
textActivity.setBounds(444, 185, 293, 24);
getContentPane().add(textActivity);
textActivity.setColumns(10);
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("修改万维成功,成功后文件将生成在反编译文件夹中");
JButton btnJavatoajar = new JButton("Jar\u8F6C\u5B89\u5353Jar");
btnJavatoajar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
chooser.showOpenDialog(null);
File java = chooser.getSelectedFile();
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);
}
});
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);
}
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);
uFilePath = new JTextField();
uFilePath.setBounds(444, 238, 293, 24);
getContentPane().add(uFilePath);
uFilePath.setColumns(10);
JButton button = new JButton("\u83B7\u53D6");
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JFileChooser chooser = new JFileChooser(new File(new File("").getAbsolutePath()));
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
uFilePath.setText(file.getAbsolutePath());
log.setText("获取自定义文件路径完成");
}
});
button.setBounds(755, 235, 113, 27);
getContentPane().add(button);
menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("\u83DC\u5355");
menuBar.add(mnNewMenu);
JMenuItem menuItem = new JMenuItem("\u91CD\u542F");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
new AppMain();
}
});
mnNewMenu.add(menuItem);
JMenu menu = new JMenu("\u5DE5\u5177");
menuBar.add(menu);
JMenuItem mntmAes = new JMenuItem("AES\u5DE5\u5177");
mntmAes.addActionListener(new ActionListener() {
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);
}
}

View 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();
}
}

View File

@ -31,7 +31,7 @@ public class EncryptJar {
FileOutputStream fos = new FileOutputStream(outputFile);
fos.write(int2byte(filetype));
System.out.println("资源包版本号:" + ver);
System.out.println("资源包版本号:" + ver);
fos.write(int2byte(ver));
FileInputStream is = new FileInputStream(file);
@ -124,7 +124,7 @@ public class EncryptJar {
}
@Override
public String toString() {
return "资源类型:"+type + " 版本号:" + version + " 文件路径:" + file.getAbsolutePath();
return "资源类型:"+type + " 版本号:" + version + " 文件路径:" + file.getAbsolutePath();
}
}

View File

@ -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>
return false;
}
destFile.delete();
}
@ -82,7 +83,7 @@ public class Tools {
fileName=srcFile.getName();
}
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile + "/" +fileName );
out = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];
while ((byteread = in.read(buffer)) != -1) {