java代码混淆 项目加密解决方案 class文件加密

通过 gui反编译代码效果如下: 核心代码,加密串 一览无余. 无法保证版权, 成果被随意盗用,下面这展示 ,通过 本工具加密后的效果

package come.tool.wari.util;

import java.io.File;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.come.entity.Good;
import org.come.entity.Goodstable;
import org.come.until.DDGoodUntil;
import org.come.until.GoodsListFromServerUntil;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class Xy2Util
{
  public static Map<String, String> MODEL = new HashMap();
  static final String[] ONLY;
  private static Map<String, Configrue> CONFIGURE;
  public static final String CLIENT = "netty";
  public static final String DOWNLOAD = "123";
  static BASE64Encoder base64Encodr;
  static BASE64Decoder base64Decoder;
  private static final String AES = "AES";
  private static final String CRYPT_KEY = "jdhjkasdfasd";

  static
  {
    MODEL.put("20002", "500095");
    MODEL.put("20003", "40003");
    MODEL.put("20007", "20007");
    MODEL.put("20009", "40002");
    MODEL.put("21007", "500093");
    MODEL.put("21008", "500098");
    MODEL.put("21009", "43002");
    MODEL.put("21010", "43001");
    MODEL.put("22003", "44002");
    MODEL.put("22005", "500097");
    MODEL.put("22007", "500094");

    ONLY = new String[] { "哈哈哈" };

    CONFIGURE = new HashMap();

    base64Encodr = new BASE64Encoder();
    base64Decoder = new BASE64Decoder();
  }

  public static boolean isOnly(String goodsName)
  {
    for (int i = 0; i < ONLY.length; ++i) {
      if (ONLY[i].equals(goodsName)) {
        return true;
      }
    }
    return false;
  }

  public static boolean isExist(String goodsName)
  {
    if ((goodsName == null) || (goodsName.length() == 0)) {
      return false;
    }
    List list2 = DDGoodUntil.ddgood;
    for (Good goods : list2) {
      if (goods == null) {
        continue;
      }
      if (goods.getGoodstable().getGoodsname().equals(goodsName)) {
        return true;
      }
    }
    Goodstable[] list = GoodsListFromServerUntil.getGoodslist();
    for (Goodstable goods : list) {
      if (goods == null) {
        continue;
      }
      if (goods.getGoodsname().equals(goodsName)) {
        return true;
      }
    }
    return false;
  }

  public static boolean isFull()
  {
    Goodstable[] goods = GoodsListFromServerUntil.getGoodslist();
    for (int j = 0; j < goods.length; ++j) {
      if (goods[j] == null) {
        return false;
      }
    }
    return true;
  }

  public static boolean isNumeric(String str)
  {
    for (int i = 0; i < str.length(); ++i) {
      if (!(Character.isDigit(str.charAt(i)))) {
        return false;
      }
    }
    return true;
  }

  public static Map<String, Configrue> getConfigure()
  {
    if (CONFIGURE.size() != 0) {
      return CONFIGURE;
    }
    SAXReader reader = new SAXReader();
    try {
      Document document = reader.read(new File("resource/other/configure.xml"));
      Element root = document.getRootElement();
      for (Iterator iterator = root.elementIterator(); iterator.hasNext(); ) {
        Configrue config = new Configrue();
        Element peopleElement = (Element)iterator.next();
        for (Iterator childIterator = peopleElement.elementIterator(); childIterator.hasNext(); ) {
          Element childPeopleElement = (Element)childIterator.next();
          if (childPeopleElement.getName().equals("address"))
            config.setAddress(decrypt(childPeopleElement.getText()));
          else if (childPeopleElement.getName().equals("port")) {
            config.setPort(Integer.valueOf(childPeopleElement.getText()).intValue());
          }
        }
        CONFIGURE.put(peopleElement.attribute("type").getValue(), config);
      }
    }
    catch (DocumentException e) {
      e.printStackTrace();
    }
    return CONFIGURE;
  }

  public static void main(String[] args) throws Exception
  {
    System.out.println(encrypt("1.116.41.251".getBytes()));
  }

  public static String encrypt(byte[] src)
    throws Exception
  {
    Cipher cipher = Cipher.getInstance("AES");
    SecretKeySpec securekey = new SecretKeySpec("ZiDiFkJbcmzndjdk".getBytes(), "AES");
    cipher.init(1, securekey);
    return base64Encodr.encode(cipher.doFinal(src));
  }

  public static String decrypt(String mm)
  {
    try
    {
      byte[] src = base64Decoder.decodeBuffer(mm);
      Cipher cipher = Cipher.getInstance("AES");
      SecretKeySpec securekey = new SecretKeySpec("ZiDiFkJbcmzndjdk".getBytes(), "AES");
      cipher.init(2, securekey);
      return new String(cipher.doFinal(src));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }
}

下面展示加密后的效果, 字节码完全被加密, 无法反编译,不影响使用效果 .欢迎试用

package come.tool.wari.util;

import java.io.File;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Base64;
import java.util.Base64.Decoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.come.entity.Good;
import org.come.entity.Goodstable;
import org.come.until.DDGoodUntil;
import org.come.until.GoodsListFromServerUntil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class Xy2Util
{
  public static boolean isExist(String sfCC)
  {
    long mfCC;
    short qfCC;
    int RfCC;
    float sfCC;
    if ((!(o(sfCC))) || (P(XfCC.length())))
      return d[0];
    List wfCC = DDGoodUntil.ddgood;
    double PfCC = wfCC.iterator();
    "".length();
    if (" ".length() < 0)
      return ((0x56 ^ 0x5B ^ 0xA6 ^ 0xA2) & (136 + 67 - 100 + 45 ^ 123 + 48 - 35 + 21 ^ -" ".length()));
    do
    {
      Good VfCC = (Good)PfCC.next();
      if (q(VfCC))
      {
        "".length();
        if (" ".length() <= 0)
          return ((0x52 ^ 0x39 ^ 0x5E ^ 0x30) & (0x27 ^ 0x31 ^ 0x5F ^ 0x4C ^ -" ".length()));
      }
      else if (m(VfCC.getGoodstable().getGoodsname().equals(XfCC)))
      {
        return d[1];
      }
    }
    while (!(P(PfCC.hasNext())));
    Goodstable[] ufCC = GoodsListFromServerUntil.getGoodslist();
    double NfCC = (mfCC = ufCC).length;
    double ofCC = d[0];
    "".length();
    if (null != null)
      return ((0xBF ^ 0xA1) & (0xD ^ 0x13 ^ 0xFFFFFFFF));
    do
    {
      Goodstable TfCC = mfCC[ofCC];
      if (q(TfCC))
      {
        "".length();
        if (" ".length() == 0)
          return ((0xC0 ^ 0x99) & (0x47 ^ 0x1E ^ 0xFFFFFFFF));
      }
      else if (m(TfCC.getGoodsname().equals(XfCC)))
      {
        return d[1];
      }
      ++ofCC;
    }
    while (!(N(ofCC, NfCC)));
    return d[0];
  }

  private static void k()
  {
    C = new String[d[53]];
    C[d[0]] = G("wuy9nPYIcf37jFjqsvK6sA==", "wocnU");
    C[d[1]] = h("sejEMEQaD5M=", "wdgRX");
    C[d[2]] = J("Fj8qBAInHAwOKTY4CgcgJw==", "LVnmD");
    C[d[3]] = h("a5kf771BQ5Y=", "sCgGV");
    C[d[4]] = h("PRIPknizyhQ=", "EyFkH");
    C[d[5]] = J("XGFnW0Fc", "iQWkx");
    C[d[6]] = h("xrvXpxHAHh4=", "zOucj");
    C[d[7]] = h("HBCDcd8/P/Y=", "sguIY");
    C[d[8]] = h("o0i+wpu1f/E=", "Kxfol");
    C[d[9]] = h("e4ZOd0B80KM=", "mMNlj");
    C[d[10]] = G("H3EsICowrrE=", "GITQm");
    C[d[11]] = J("VnlcRXk=", "bIluK");
    C[d[12]] = G("kMMuEvt4hnw=", "xYKTv");
    C[d[13]] = G("fErsphzL5Ws=", "eVyrp");
    C[d[14]] = h("vumrLjX4dvc=", "yayaM");
    C[d[15]] = J("XHNHRE5R", "iCwtw");
    C[d[16]] = G("b90AMzVOb0A=", "Mxnwa");
    C[d[17]] = J("cWdDQlo=", "ETsrh");
    C[d[18]] = G("diM5l1O8sVk=", "SMDSK");
    C[d[19]] = h("w6FI3qNhZRg=", "kNHPQ");
    C[d[20]] = h("b6Cs3FFjUzs=", "rYdQw");
    C[d[21]] = J("e3FbSWM=", "OEkyQ");
    C[d[22]] = G("s5ZFUPzWhew=", "aYPkd");
    C[d[23]] = h("rerCx4wWKU4=", "AOzng");
    C[d[24]] = J("eVdDdEI=", "KesDu");
    C[d[25]] = h("QjwxDH1Xn6g=", "ESilt");
    C[d[26]] = J("fmZKYX8=", "LTzQG");
    C[d[27]] = h("r1GvXNbbv+I=", "TpdJa");
    C[d[28]] = h("Ud4zEyosK0E=", "dhhDl");
    C[d[29]] = h("G1IZzQ7tjM8=", "bosCl");
    C[d[30]] = G("kzlokukVaJs=", "joOIc");
    C[d[31]] = h("148zISgFIu8=", "fLRYT");
    C[d[32]] = J("SHRFSHg=", "zGuxI");
    C[d[33]] = G("wlPjvgmWOkU=", "AzgRj");
    C[d[34]] = G("K968imrWSEQ=", "GKUsv");
    C[d[35]] = J("YHF/cU1s", "UAOAt");
    C[d[36]] = h("XPVC7KkFVq0=", "ypqir");
    C[d[37]] = G("g313j6muGjA=", "sOtoO");
    C[d[38]] = h("nQxB7jtilDY=", "ccvAk");
    C[d[39]] = J("RUF/W14=", "qsOkh");
    C[d[40]] = h("dSby0mhpU0Av75tSkW4ukQ==", "shanG");
    C[d[41]] = J("GSIgHhwZJDZeBh8vNgNGCCg9FwAMMiEURxMqPw==", "kGSqi");
    C[d[42]] = G("FgAco5k65AI=", "eyyQC");
    C[d[43]] = J("Hh8jMw==", "npQGx");
    C[d[44]] = h("liwVxumqNZI=", "XXLhI");
    C[d[45]] = G("f9nJKJAnGUFsLkzW1FrNTw==", "BNhOj");
    C[d[46]] = G("eMBIVww+9L0=", "gvGhD");
    C[d[47]] = G("LCak2U/umLbighLJAmfF0Hy5jSvzySYq", "irCyO");
    C[d[48]] = h("PFrvKM4wxL4=", "choMH");
    C[d[49]] = J("EjcX", "SrDvm");
    C[d[50]] = G("OvV501k4QG1t0XAnZLIFL7gMKfKSClKN", "UVwMc");
    C[d[51]] = J("JDIe", "ewMuS");
    C[d[52]] = G("LLFhXx9ECVQ=", "WyQOm");
  }

  private static boolean m(int ???)
  {
    short NACC;
    return (??? != 0);
  }

  public static boolean isFull()
  {
    int ffCC;
    double GfCC;
    Goodstable[] JfCC = GoodsListFromServerUntil.getGoodslist();
    int hfCC = d[0];
    "".length();
    if (-" ".length() >= "  ".length())
      return ((0x22 ^ 0x3D) & (0x66 ^ 0x79 ^ 0xFFFFFFFF));
    do
    {
      if (q(JfCC[hfCC]))
        return d[0];
      ++hfCC;
    }
    while (!(N(hfCC, JfCC.length)));
    return d[1];
  }

  static
  {
    L();
    k();
    DOWNLOAD = C[d[0]];
    AES = C[d[1]];
    CRYPT_KEY = C[d[2]];
    CLIENT = C[d[3]];
    MODEL = new HashMap();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    "".length();
    ONLY = new String[] { C[d[40]] };
    CONFIGURE = new HashMap();
    base64Encodr = new BASE64Encoder();
    base64Decoder = new BASE64Decoder();
  }

  private static boolean P(int ???)
  {
    Exception LACC;
    return (??? == 0);
  }

  public static boolean isOnly(String JGCC)
  {
    double fGCC;
    String JGCC;
    int hGCC = d[0];
    "".length();
    if (" ".length() == 0)
      return ((113 + 74 - 5 + 6 ^ 132 + 13 - 131 + 128) & (0xC8 ^ 0x97 ^ 0x7D ^ 0x10 ^ -" ".length()));
    do
    {
      if (m(ONLY[hGCC].equals(GGCC)))
        return d[1];
      ++hGCC;
    }
    while (!(N(hGCC, ONLY.length)));
    return d[0];
  }

  public static String encrypt(byte[] RdCC)
    throws Exception
  {
    float PdCC;
    double qdCC;
    char RdCC;
    Cipher TdCC = Cipher.getInstance(C[d[46]]);
    SecretKeySpec sdCC = new SecretKeySpec(C[d[47]].getBytes(), C[d[48]]);
    TdCC.init(d[1], sdCC);
    return base64Encodr.encode(TdCC.doFinal(udCC));
  }

  private static boolean q(Object ???)
  {
    int PACC;
    return (??? == null);
  }

  private static boolean N(int ???, int arg1)
  {
    int i;
    long XACC;
    return (??? >= i);
  }

  private static String J(String kbCC, String obCC)
  {
    float bbCC;
    long fbCC;
    byte GbCC;
    Exception hbCC;
    String obCC;
    String obCC;
    kbCC = new String(Base64.getDecoder().decode(kbCC.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
    StringBuilder NbCC = new StringBuilder();
    char[] mbCC = obCC.toCharArray();
    int LbCC = d[0];
    double EbCC = kbCC.toCharArray();
    int dbCC = EbCC.length;
    float CbCC = d[0];
    while (R(CbCC, dbCC))
    {
      char qbCC = EbCC[CbCC];
      "".length();
      ++LbCC;
      ++CbCC;
      "".length();
      if (" ".length() <= 0)
        return null;
    }
    return String.valueOf(NbCC);
  }

  public static boolean isNumeric(String CfCC)
  {
    String ZECC;
    String CfCC;
    int bfCC = d[0];
    "".length();
    if (" ".length() != " ".length())
      return ((0x62 ^ 0x32) & (0x97 ^ 0xC7 ^ 0xFFFFFFFF));
    do
    {
      if (P(Character.isDigit(AfCC.charAt(bfCC))))
        return d[0];
      ++bfCC;
    }
    while (!(N(bfCC, AfCC.length())));
    return d[1];
  }

  private static void L()
  {
    d = new int[54];
    d[0] = ((70 + 86 - 57 + 62 ^ 117 + 161 - 119 + 21) & (115 + 71 - 155 + 146 ^ 162 + 44 - 178 + 136 ^ -" ".length()));
    d[1] = " ".length();
    d[2] = "  ".length();
    d[3] = "   ".length();
    d[4] = (0x6E ^ 0x15 ^ 35 + 116 - 104 + 80);
    d[5] = (0x72 ^ 0x77);
    d[6] = (0x9 ^ 0xF);
    d[7] = (0x71 ^ 0x31 ^ 0xE8 ^ 0xAF);
    d[8] = (51 + 84 - 93 + 115 ^ 13 + 97 - 90 + 129);
    d[9] = (23 + 67 - 57 + 125 ^ 66 + 66 - 123 + 142);
    d[10] = (0x34 ^ 0x3E);
    d[11] = (122 + 7 - 75 + 99 ^ 65 + 86 - 123 + 118);
    d[12] = (8 + 64 - -1 + 98 ^ 6 + 123 - 5 + 43);
    d[13] = (124 + 113 - 92 + 1 ^ 45 + 93 - 69 + 90);
    d[14] = (0x47 ^ 0x26 ^ 0x21 ^ 0x4E);
    d[15] = (7 + 118 - 32 + 45 ^ 75 + 109 - 66 + 15);
    d[16] = (0x1 ^ 0x53 ^ 0x1D ^ 0x5F);
    d[17] = (0x2E ^ 0x5C ^ 0xC4 ^ 0xA7);
    d[18] = (75 + 4 - 2 + 62 ^ 58 + 87 - -1 + 7);
    d[19] = (0x9C ^ 0x80 ^ 0x19 ^ 0x16);
    d[20] = (0xF5 ^ 0x8B ^ 0x60 ^ 0xA);
    d[21] = (0xB6 ^ 0xA3);
    d[22] = (0x26 ^ 0x4E ^ 0x65 ^ 0x1B);
    d[23] = (0xB0 ^ 0xA7);
    d[24] = (0x7 ^ 0x1F);
    d[25] = (0x59 ^ 0x1 ^ 0xFE ^ 0xBF);
    d[26] = (0xB2 ^ 0xA8);
    d[27] = (0xAB ^ 0x80 ^ 0x54 ^ 0x64);
    d[28] = (0x6C ^ 0x70);
    d[29] = (163 + 144 - 158 + 18 ^ 183 + 120 - 293 + 176);
    d[30] = (0x69 ^ 0x77);
    d[31] = (0x8C ^ 0x93);
    d[32] = (0x1F ^ 0x13 ^ 0x86 ^ 0xAA);
    d[33] = (93 + 72 - 164 + 129 ^ 138 + 159 - 147 + 13);
    d[34] = (0xB1 ^ 0x80 ^ 0x41 ^ 0x52);
    d[35] = (0xB9 ^ 0x9A);
    d[36] = (32 + 172 - 86 + 68 ^ 156 + 154 - 243 + 91);
    d[37] = (0xBC ^ 0x99);
    d[38] = (41 + 94 - 86 + 182 ^ 123 + 93 - 83 + 60);
    d[39] = (0x5A ^ 0x7D);
    d[40] = (0x3 ^ 0x64 ^ 0x8C ^ 0xC3);
    d[41] = (0x45 ^ 0x6C);
    d[42] = (0x26 ^ 0xC);
    d[43] = (0x26 ^ 0xD);
    d[44] = (0xC8 ^ 0xAF ^ 0x2F ^ 0x64);
    d[45] = (0xC0 ^ 0x9B ^ 0xF ^ 0x79);
    d[46] = (0x5 ^ 0x57 ^ 0xE8 ^ 0x94);
    d[47] = (114 + 21 - 6 + 26 ^ 72 + 110 - 125 + 123);
    d[48] = (0x77 ^ 0x46 ^ " ".length());
    d[49] = (0x54 ^ 0x7B ^ 0x8B ^ 0x95);
    d[50] = (0x5D ^ 0x6F);
    d[51] = (12 + 67 - -49 + 44 ^ 50 + 7 - 0 + 102);
    d[52] = (89 + 92 - 50 + 27 ^ 69 + 114 - 181 + 168);
    d[53] = (0xDF ^ 0x81 ^ 0x15 ^ 0x7E);
  }

  public static void main(String[] ydCC)
    throws Exception
  {
    System.out.println(encrypt(C[d[45]].getBytes()));
  }

  public static String decrypt(String EdCC)
  {
    double bdCC;
    int CdCC;
    Exception ddCC;
    long EdCC;
    try
    {
      byte[] JdCC = base64Decoder.decodeBuffer(kdCC);
      Cipher hdCC = Cipher.getInstance(C[d[49]]);
      SecretKeySpec GdCC = new SecretKeySpec(C[d[50]].getBytes(), C[d[51]]);
      hdCC.init(d[2], GdCC);
      return new String(hdCC.doFinal(JdCC));
    }
    catch (Exception fdCC)
    {
      fdCC.printStackTrace();
    }
    return C[d[52]];
  }

  private static boolean o(Object ???)
  {
    byte RACC;
    return (??? != null);
  }

  public static Map<String, Configrue> getConfigure()
  {
    byte ZdCC;
    double AECC;
    boolean bECC;
    short CECC;
    Exception dECC;
    byte EECC;
    float fECC;
    short GECC;
    if (m(CONFIGURE.size()))
      return CONFIGURE;
    SAXReader qECC = new SAXReader();
    try
    {
      Document PECC = qECC.read(new File(C[d[41]]));
      Element oECC = PECC.getRootElement();
      Iterator NECC = oECC.elementIterator();
      "".length();
      if (null != null)
        return null;
      do
      {
        Configrue mECC = new Configrue();
        Element LECC = (Element)NECC.next();
        Iterator kECC = LECC.elementIterator();
        "".length();
        if ("   ".length() >= (0xEF ^ 0xAD ^ 0x5 ^ 0x43))
          return null;
        do
        {
          Element JECC = (Element)kECC.next();
          if (m(JECC.getName().equals(C[d[42]])))
          {
            mECC.setAddress(decrypt(JECC.getText()));
            "".length();
            if ("  ".length() == ((0x39 ^ 0x3) & (0xAC ^ 0x96 ^ 0xFFFFFFFF)))
              return null;
          }
          else
          {
            if (!(m(JECC.getName().equals(C[d[43]]))))
              continue;
            mECC.setPort(Integer.valueOf(JECC.getText()).intValue());
          }
        }
        while (!(P(kECC.hasNext())));
        "".length();
      }
      while (!(P(NECC.hasNext())));
      "".length();
      if ((76 + 89 - 90 + 98 ^ 131 + 113 - 95 + 20) > -" ".length())
        break label369;
      return null;
    }
    catch (DocumentException hECC)
    {
      hECC.printStackTrace();
    }
    label369: return CONFIGURE;
  }

  private static boolean R(int ???, int arg1)
  {
    int i;
    byte TACC;
    return (??? < i);
  }

  private static String h(String TCCC, String sCCC)
  {
    double oCCC;
    double PCCC;
    String sCCC;
    String sCCC;
    try
    {
      SecretKeySpec wCCC = new SecretKeySpec(MessageDigest.getInstance("MD5").digest(sCCC.getBytes(StandardCharsets.UTF_8)), "Blowfish");
      Cipher VCCC = Cipher.getInstance("Blowfish");
      VCCC.init(d[2], wCCC);
      return new String(VCCC.doFinal(Base64.getDecoder().decode(TCCC.getBytes(StandardCharsets.UTF_8))), StandardCharsets.UTF_8);
    }
    catch (Exception uCCC)
    {
      uCCC.printStackTrace();
    }
    return null;
  }

  private static String G(String fCCC, String ECCC)
  {
    int ACCC;
    boolean bCCC;
    String ECCC;
    String ECCC;
    try
    {
      SecretKeySpec JCCC = new SecretKeySpec(Arrays.copyOf(MessageDigest.getInstance("MD5").digest(ECCC.getBytes(StandardCharsets.UTF_8)), d[8]), "DES");
      Cipher hCCC = Cipher.getInstance("DES");
      hCCC.init(d[2], JCCC);
      return new String(hCCC.doFinal(Base64.getDecoder().decode(fCCC.getBytes(StandardCharsets.UTF_8))), StandardCharsets.UTF_8);
    }
    catch (Exception GCCC)
    {
      GCCC.printStackTrace();
    }
    return null;
  }
}

需要加密,制定化的,欢迎大家交流学习!

qq/wx  : 75238016  

猜你喜欢

转载自blog.csdn.net/a1ccwt/article/details/120821821