|
|
|
|
@ -9,6 +9,8 @@ import com.google.common.io.BaseEncoding; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
import javax.crypto.Cipher; |
|
|
|
|
import javax.crypto.spec.IvParameterSpec; |
|
|
|
|
@ -40,8 +42,8 @@ public class Decoder { |
|
|
|
|
try { |
|
|
|
|
File file = FileUtil.getJar(jar); |
|
|
|
|
if (md5.length() > 0 && FileUtil.equals(jar, md5)) return file; |
|
|
|
|
String data = getData(jar.substring(4)); |
|
|
|
|
data = data.substring(data.indexOf("**") + 2); |
|
|
|
|
String data = extract(getData(jar.substring(4))); |
|
|
|
|
if (data.isEmpty()) return FileUtil.getJar(jar); |
|
|
|
|
return FileUtil.write(file, Base64.decode(data, Base64.DEFAULT)); |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
return FileUtil.getJar(jar); |
|
|
|
|
@ -79,7 +81,16 @@ public class Decoder { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String base64(String data) { |
|
|
|
|
return new String(Base64.decode(data.substring(data.indexOf("**") + 2), Base64.DEFAULT)); |
|
|
|
|
String extract = extract(data); |
|
|
|
|
if (extract.isEmpty()) return data; |
|
|
|
|
return new String(Base64.decode(extract, Base64.DEFAULT)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String extract(String data) { |
|
|
|
|
Matcher matcher = Pattern.compile("[A-Za-z0-9]{8}\\*\\*").matcher(data); |
|
|
|
|
if (!matcher.find()) return ""; |
|
|
|
|
String key = matcher.group(); |
|
|
|
|
return data.substring(data.indexOf(key) + key.length()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static byte[] padEnd(String key) { |
|
|
|
|
|