Skip to content

Commit 568dd5f

Browse files
committed
将nuclei标签过滤表达式改为or
1 parent 888f423 commit 568dd5f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log
22

33
<!-- next-header -->
4+
5+
## [2024.10.9] - 2024.10.9
6+
7+
### Fixes
8+
9+
- 将nuclei标签过滤表达式改为or
10+
411
## [2024.8.16] - 2024.8.16
512

613
### Fixes

observer_ward/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl MatchedResult {
125125
} else {
126126
args
127127
.condition
128-
.push(gen_nuclei_tags(&vpf.product, &matcher_result.info.tags));
128+
.extend(gen_nuclei_tags(&vpf.product, &matcher_result.info.tags));
129129
}
130130
nuclei_map.insert(matcher_result.template.clone(), args);
131131
}

observer_ward/src/nuclei.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl NucleiRunner {
100100
}
101101

102102
// 生成nuclei的标签过滤表达式
103-
pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> String {
103+
pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> Vec<String> {
104104
let mut or_condition = Vec::new();
105105
let finger_tags = ["detect", "tech"];
106106
let tags: Vec<String> = tags
@@ -112,15 +112,8 @@ pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> String {
112112
or_condition.push(format!("contains(tags,'{}')", product));
113113
}
114114
// 只留单个的tags,防止误报
115-
if tags.len() == 1 {
116-
or_condition.push(format!("contains(tags,'{}')", tags[0]));
117-
} else {
118-
let mut and_condition = Vec::new();
119-
for tag in tags {
120-
and_condition.push(format!("contains(tags,'{}')", tag));
121-
}
122-
or_condition.push(format!("({})", and_condition.join("&&")));
115+
for tag in tags {
116+
or_condition.push(format!("contains(tags,'{}')", tag));
123117
}
124-
125-
or_condition.join("||")
118+
or_condition
126119
}

0 commit comments

Comments
 (0)