mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
style: fmt code
This commit is contained in:
@@ -4,4 +4,4 @@ title: Jetty
|
||||
|
||||
## Handler 内存马
|
||||
|
||||
## Customizer 内存马
|
||||
## Customizer 内存马
|
||||
|
||||
@@ -4,4 +4,4 @@ title: Tomcat Valve
|
||||
|
||||
## Valve 内存马
|
||||
|
||||
## ProxyValve 内存马
|
||||
## ProxyValve 内存马
|
||||
|
||||
@@ -104,7 +104,7 @@ public class WebSocketConfig implements ServerApplicationConfig {
|
||||
.build();
|
||||
|
||||
result.add(config);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ public class WsSci implements ServletContainerInitializer {
|
||||
```
|
||||
|
||||
代码中有两个关键的地方:
|
||||
|
||||
1. init 方法中,注册的 WsServerContainer 对象会被放入 ServletContext 中,key 为 "javax.websocket.server.ServerContainer",高版本为 "jakarta.websocket.server.ServerContainer"。
|
||||
2. 调用 WsServerContainer 的 addEndpoint 方法注册 Endpoint。
|
||||
|
||||
@@ -218,7 +219,7 @@ public class WsFilter implements Filter {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
if (this.sc.areEndpointsRegistered()
|
||||
if (this.sc.areEndpointsRegistered()
|
||||
&& UpgradeUtil.isWebSocketUpgradeRequest(request, response)) {
|
||||
HttpServletRequest req = (HttpServletRequest)request;
|
||||
HttpServletResponse resp = (HttpServletResponse)response;
|
||||
@@ -237,8 +238,8 @@ public class WsFilter implements Filter {
|
||||
public class UpgradeUtil {
|
||||
|
||||
public static boolean isWebSocketUpgradeRequest(ServletRequest request, ServletResponse response) {
|
||||
return request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse
|
||||
return request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse
|
||||
&& headerContainsToken((HttpServletRequest)request, "Upgrade", "websocket") // [!code highlight]
|
||||
&& "GET".equals(((HttpServletRequest)request).getMethod());
|
||||
}
|
||||
@@ -372,4 +373,4 @@ private void inject(Object context, Object obj) throws Exception {
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Command 内存马使用教程](/docs/shelltool/command) - 了解如何生成和使用 WebSocket 命令执行内存马
|
||||
- [Command 内存马使用教程](/docs/shelltool/command) - 了解如何生成和使用 WebSocket 命令执行内存马
|
||||
|
||||
Reference in New Issue
Block a user