(编辑:jimmy 日期: 2024/12/23 浏览:2)
企业微信截图_20200227124109.png
public abstract class EncryptedLicenseSelector extends AbstractLicenseSelector { byte[] getBytes() { byte[] var1 = this.readRawBytes(); return this.decrypt(var1); } private byte[] decrypt(byte[] var1) { // 修改为 return var1; try { System.getProperties().setProperty("com.ibm.crypto.provider.DoRSATypeChecking", "false"); return (new CommonDecryptChain()).decrypt(var1); } catch (Throwable var3) { this.decryptFailed(var3); return new byte[0]; } } protected void decryptFailed(Throwable var1) { FineLoggerFactory.getLogger().error("Read license failed." + var1.getMessage(), var1); } abstract byte[] readRawBytes();}
public class LicFileRegistry { private static Map<Integer, LicFileChecker> _2c75dfba_fdee_47fa_8cf4_74897f6d7e9a = new ConcurrentHashMap(5); private LicFileRegistry() { } static { register(new LicFileCheckerImpl()); } public static void register(LicFileChecker var0) { _2c75dfba_fdee_47fa_8cf4_74897f6d7e9a.put(var0.getTypeCode(), var0); } public static boolean check(InputStream var0, Integer var1) { // 修改为 return true; LicFileChecker var2 = _2c75dfba_fdee_47fa_8cf4_74897f6d7e9a.get(var1); return var2 != null && var2.check(var0); }}
public class FineLicense extends AbstractLicense { public FineLicense(JSONObject var1) { super(var1); } public String getString(String var1, String var2) { return super.getInnerString(var1, var2); } public boolean support(PluginMarker var1) { // 修改为 return true; if (var1 == null) { return false; } else { try { JSONObject var2 = this.getJSONObject(); if (var2.has(LicenseItem.Plugin.getKey())) { JSONArray var3 = var2.getJSONArray(LicenseItem.Plugin.getKey()); for(int var5 = 0; var5 < var3.length(); ++var5) { String[] var4 = var3.getString(var5).split(","); if (var4.length >= 2 && var1.getPluginID().equals(var4[0])) { return true; } } } } catch (Exception var6) { FineLoggerFactory.getLogger().error(var6.getMessage(), var6); } return false; } } public boolean support(FunctionPoint var1) { // 修改为 return true; String var2 = this.getString(LicenseItem.Function.getKey(), ""); if (StringUtils.isNotBlank(var2)) { BigInteger var3 = new BigInteger(String.valueOf(var2)); return var3.and(BigInteger.ONE.shiftLeft(var1.getMarker())).compareTo(BigInteger.ZERO) == 1; } else { return true; } }
public class FxxxAgent { public static void agentmain(String args, Instrumentation inst) throws Exception { Class<?>[] classes = inst.getAllLoadedClasses(); for (Class<?> clazz : classes) { if (clazz.getName().equals("com.fr.license.selector.EncryptedLicenseSelector")) { inst.addTransformer((loader, className, classBeingRedefined, protectionDomain, classfileBuffer) -> { if (className.equals("com/fr/license/selector/EncryptedLicenseSelector")) { try { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(classfileBuffer)); ClassFile classFile = new ClassFile(inputStream); inputStream.close(); ConstPool constPool = classFile.getConstPool(); MethodInfo methodInfo = classFile.getMethod("decrypt"); CodeAttribute codeAttribute = new CodeAttribute(constPool, 1, 2, new byte[]{43, -80}, new ExceptionTable(constPool)); methodInfo.setCodeAttribute(codeAttribute); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); classFile.write(outputStream); outputStream.close(); byte[] result = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); return result; } catch (Exception e) { e.printStackTrace(); return classfileBuffer; } } else { return classfileBuffer; } }); inst.retransformClasses(clazz); } } }}
private static void initEncryptedBridge() throws Exception { ClassLoader var0 = (ClassLoader) Class.forName(START_LOADER_FACTORY_NAME).newInstance(); Class.forName("com.fr.plugin.bridge.FinePluginBridge", true, var0); String name = ManagementFactory.getRuntimeMXBean().getName(); String pid = name.substring(0, name.indexOf('@')); VirtualMachine virtualMachine = VirtualMachine.attach(pid); virtualMachine.loadAgent("D:/agent.jar", null); // 这里的路径即为刚刚打的jar包路径 virtualMachine.detach(); }
{"VERSION":"10.0","DEADLINE":"253402271999000","CONCURRENCY":"0"}