Skip to content

Commit 726690e

Browse files
committed
feat: support FilterProbe generate
1 parent 29852ec commit 726690e

File tree

14 files changed

+137
-137
lines changed

14 files changed

+137
-137
lines changed

generator/src/main/java/com/reajason/javaweb/probe/config/ResponseBodyConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.reajason.javaweb.utils.CommonUtil;
44
import lombok.Builder;
55
import lombok.Getter;
6+
import lombok.Setter;
67
import lombok.ToString;
78
import lombok.experimental.SuperBuilder;
89
import org.apache.commons.lang3.StringUtils;
@@ -26,6 +27,7 @@ public class ResponseBodyConfig extends ProbeContentConfig {
2627
/**
2728
* 内置执行类加载的字节码
2829
*/
30+
@Setter
2931
private String base64Bytes;
3032

3133
/**

generator/src/main/java/com/reajason/javaweb/probe/generator/response/ResponseBodyGenerator.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.reajason.javaweb.probe.generator.ByteBuddyShellGenerator;
1111
import com.reajason.javaweb.probe.payload.ByteCodeProbe;
1212
import com.reajason.javaweb.probe.payload.CommandProbe;
13+
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
1314
import com.reajason.javaweb.probe.payload.ScriptEngineProbe;
1415
import com.reajason.javaweb.probe.payload.response.*;
1516
import com.reajason.javaweb.utils.ShellCommonUtil;
@@ -37,11 +38,14 @@ public ResponseBodyGenerator(ProbeConfig probeConfig, ResponseBodyConfig probeCo
3738

3839
@Override
3940
protected DynamicType.Builder<?> build(ByteBuddy buddy) {
40-
String name = probeContentConfig.getReqParamName();
4141
Class<?> getDataFromReqInterceptor = getDataFromReqInterceptor.class;
42-
if (Server.Jetty.equals(probeContentConfig.getServer())) {
42+
String server = probeContentConfig.getServer();
43+
if (Server.Jetty.equals(server)) {
4344
getDataFromReqInterceptor = getDataFromReqJettyInterceptor.class;
4445
}
46+
if (ProbeContent.Filter.equals(probeConfig.getProbeContent())) {
47+
probeContentConfig.setBase64Bytes(FilterProbeFactory.getBase64ByServer(server));
48+
}
4549
Class<?> writerClass = getWriterClass();
4650
Class<?> runnerClass = getRunnerClass();
4751
DynamicType.Builder<?> builder = buddy.redefine(writerClass)
@@ -53,12 +57,12 @@ protected DynamicType.Builder<?> build(ByteBuddy buddy) {
5357
.on(named("run")));
5458
String base64Bytes = probeContentConfig.getBase64Bytes();
5559
if (ProbeContent.Bytecode.equals(probeConfig.getProbeContent())
56-
&& StringUtils.isNotBlank(base64Bytes)) {
60+
|| StringUtils.isNotBlank(base64Bytes)) {
5761
builder = builder.method(named("getDataFromReq")).intercept(FixedValue.value(base64Bytes));
5862
} else {
5963
builder = builder.visit(MethodCallReplaceVisitorWrapper.newInstance("getDataFromReq",
6064
probeConfig.getShellClassName(), ShellCommonUtil.class.getName()))
61-
.visit(Advice.withCustomMapping().bind(ValueAnnotation.class, name)
65+
.visit(Advice.withCustomMapping().bind(ValueAnnotation.class, probeContentConfig.getReqParamName())
6266
.to(getDataFromReqInterceptor).on(named("getDataFromReq")));
6367
}
6468
return builder;
@@ -69,6 +73,7 @@ private Class<?> getRunnerClass() {
6973
case Command:
7074
return CommandProbe.class;
7175
case Bytecode:
76+
case Filter:
7277
return ByteCodeProbe.class;
7378
case ScriptEngine:
7479
return ScriptEngineProbe.class;

web/app/components/probeshell/main-config-card.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const PROBE_OPTIONS = [
3434
{ value: "Command" as const, label: "command" },
3535
{ value: "Bytecode" as const, label: "bytecode" },
3636
{ value: "ScriptEngine" as const, label: "script" },
37+
{ value: "Filter" as const, label: "filter" },
3738
] as const;
3839

3940
const MIDDLEWARE_OPTIONS = [
@@ -75,7 +76,7 @@ export default function MainConfigCard({ form, servers }: MainConfigCardProps) {
7576

7677
const filteredOptions = useMemo(() => {
7778
const filterMap = {
78-
ResponseBody: ["Command", "Bytecode", "ScriptEngine"],
79+
ResponseBody: ["Command", "Bytecode", "ScriptEngine", "Filter"],
7980
DNSLog: ["JDK", "Server"],
8081
Sleep: ["Server"],
8182
} as const;
@@ -108,10 +109,12 @@ export default function MainConfigCard({ form, servers }: MainConfigCardProps) {
108109

109110
const isBodyMethod = watchedProbeMethod === "ResponseBody";
110111
const isCommandBody = watchedProbeContent === "Command";
112+
const isFilter = watchedProbeContent === "Filter";
111113
const needParam =
112-
isCommandBody ||
113-
watchedProbeContent === "Bytecode" ||
114-
watchedProbeContent === "ScriptEngine";
114+
!isFilter &&
115+
(isCommandBody ||
116+
watchedProbeContent === "Bytecode" ||
117+
watchedProbeContent === "ScriptEngine");
115118
const isSleepMethod = watchedProbeMethod === "Sleep";
116119
const isServerContent = watchedProbeContent === "Server";
117120

web/app/i18n/probeshell/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"probeContent.command": "Command",
88
"probeContent.jdk": "JDK",
99
"probeContent.server": "Server",
10+
"probeContent.filter": "FilterList",
1011
"probeMethod": "ProbeMethod",
1112
"quickUsage.step1": "Select Probe Method, DNSLog, Response, etc.",
1213
"quickUsage.step2": "Select Probe Content, JDK, Server, etc.",

web/app/i18n/probeshell/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"probeContent.command": "命令执行",
88
"probeContent.jdk": "JDK 信息",
99
"probeContent.server": "服务类型",
10+
"probeContent.filter": "Filter 过滤器列表",
1011
"probeMethod": "探测方法",
1112
"quickUsage.step1": "选择探测方法,DNSLog、Response 或者其他",
1213
"quickUsage.step2": "选择探测内容,JDK、服务类型 或者其他",

web/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.9/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",

web/bun.lock

Lines changed: 48 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"title": "打包方式",
3-
"pages": [
4-
"base64",
5-
"jsp",
6-
"biginteger",
7-
"bcel",
8-
"abstract-translet",
9-
"script-engine",
10-
"expression",
11-
"ssti",
12-
"xml-decoder",
13-
"java-deserialize",
14-
"hessian-deserialize",
15-
"h2",
16-
"jar",
17-
"agent-jar"
18-
]
19-
}
2+
"title": "打包方式",
3+
"pages": [
4+
"base64",
5+
"jsp",
6+
"biginteger",
7+
"bcel",
8+
"abstract-translet",
9+
"script-engine",
10+
"expression",
11+
"ssti",
12+
"xml-decoder",
13+
"java-deserialize",
14+
"hessian-deserialize",
15+
"h2",
16+
"jar",
17+
"agent-jar"
18+
]
19+
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"title": "中间件内存马",
3-
"pages": [
4-
"tomcat",
5-
"jetty"
6-
]
7-
}
2+
"title": "中间件内存马",
3+
"pages": ["tomcat", "jetty"]
4+
}

web/content/docs/resbody/meta.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"title": "回显马",
3-
"pages": [
4-
"tomcat",
5-
"jetty",
6-
"undertow",
7-
"resin",
8-
"weblogic",
9-
"websphere",
10-
"glassfish",
11-
"tongweb",
12-
"apusic",
13-
"springwebmvc",
14-
"struct2"
15-
]
16-
}
2+
"title": "回显马",
3+
"pages": [
4+
"tomcat",
5+
"jetty",
6+
"undertow",
7+
"resin",
8+
"weblogic",
9+
"websphere",
10+
"glassfish",
11+
"tongweb",
12+
"apusic",
13+
"springwebmvc",
14+
"struct2"
15+
]
16+
}

0 commit comments

Comments
 (0)