App exe 封装教程

jpackage

Burp-Suite-Launch

IdeaProjects/Burp-Suite-Launch/src/burpsuite/Main.java

package burpsuite;

public class Main {

public static void main(String[] args) {
new Main().shell();
}

public String getPath() {
String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
if (System.getProperty("os.name").contains("dos")) {
path = path.substring(1);
}
if (path.contains("jar")) {
path = path.substring(0, path.lastIndexOf("."));
return path.substring(0, path.lastIndexOf("/"));
}
return path.replace("target/classes/", "");
}

public void shell() {
String getPath = getPath();
try {
Runtime.getRuntime().exec(getPath + "/start.sh " + getPath);
} catch (Exception e) {
e.printStackTrace();
}
}
}

image-20210224011419891

注意勾选 包含在项目构建中右上角铁锤🔨点一下

start.sh

注意java路径

#!/bin/sh
$@/zulu15/zulu-15.jdk/Contents/Home/bin/java -noverify -javaagent:$@/BurpSuiteLoader.jar -javaagent:$@/BurpSuiteCn.jar -Dfile.encoding=utf-8 -jar $@/Burp-Suite.jar

listen

需要切换到app包内目录开启激活工具

./zulu15/zulu-15.jdk/Contents/Home/bin/java -noverify -jar BurpSuiteLoader.jar

生成

查看 out/artifacts/Burp-Suite/ 目录,复制文件到该目录

image-20210224011715316

jpackage --name Burp-Suite --input . --main-jar Burp-Suite-Launch.jar --type dmg --app-version "2021.2.1" \
--copyright "Xrsec" --description "Burp-suite with JDK and Chinese. Mac zulu-Jdk15 Burp-Suite2021.2.1 Burp-Suite-Launch 1.0.0" --icon app.icns

授人以鱼不如授人以渔 抱歉,鱼卖光了

pyinstaller

image-20210224012500539

pyinstaller -w -F --icon="app.ico" Burp-Suite.py

Windows 需要ico图标 生成完毕可以清理多余文件夹,生成的exe在dist

Burp-Suite.py

import subprocess, os

burpsuite = os.getcwd()

cmd = burpsuite + "\\jdk-15\\bin\\java.exe -noverify -javaagent:" \
+ burpsuite + "\\BurpSuiteLoader.jar -javaagent:" \
+ burpsuite + "\\BurpSuiteCn.jar -Dfile.encoding=utf-8 -jar " \
+ burpsuite + "\\Burp-Suite.jar"
subprocess.call(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)