Skip to content

Commit

Permalink
将nuclei标签过滤表达式改为or
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-kali-team committed Oct 9, 2024
1 parent 888f423 commit 568dd5f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log

<!-- next-header -->

## [2024.10.9] - 2024.10.9

### Fixes

- 将nuclei标签过滤表达式改为or

## [2024.8.16] - 2024.8.16

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion observer_ward/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl MatchedResult {
} else {
args
.condition
.push(gen_nuclei_tags(&vpf.product, &matcher_result.info.tags));
.extend(gen_nuclei_tags(&vpf.product, &matcher_result.info.tags));
}
nuclei_map.insert(matcher_result.template.clone(), args);
}
Expand Down
15 changes: 4 additions & 11 deletions observer_ward/src/nuclei.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl NucleiRunner {
}

// 生成nuclei的标签过滤表达式
pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> String {
pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> Vec<String> {
let mut or_condition = Vec::new();
let finger_tags = ["detect", "tech"];
let tags: Vec<String> = tags
Expand All @@ -112,15 +112,8 @@ pub fn gen_nuclei_tags(product: &str, tags: &[String]) -> String {
or_condition.push(format!("contains(tags,'{}')", product));
}
// 只留单个的tags,防止误报
if tags.len() == 1 {
or_condition.push(format!("contains(tags,'{}')", tags[0]));
} else {
let mut and_condition = Vec::new();
for tag in tags {
and_condition.push(format!("contains(tags,'{}')", tag));
}
or_condition.push(format!("({})", and_condition.join("&&")));
for tag in tags {
or_condition.push(format!("contains(tags,'{}')", tag));
}

or_condition.join("||")
or_condition
}

0 comments on commit 568dd5f

Please sign in to comment.