-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0eb58c
commit d874086
Showing
92 changed files
with
2,148 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
use std::collections::{BTreeMap, HashSet}; | ||
use engine::info::{Info, Severity, VPF}; | ||
use engine::matchers::{Condition, Favicon, Matcher, MatcherType, Part, Word}; | ||
use engine::request::Requests; | ||
use engine::template::Template; | ||
use serde::{Deserialize, Serialize}; | ||
use crate::hans_to_pinyin; | ||
// 旧版指纹,数据结构 | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct WebFingerPrintRequest { | ||
/// 请求路径 | ||
pub path: String, | ||
/// 请求方法 | ||
pub request_method: String, | ||
/// 请求头 | ||
pub request_headers: BTreeMap<String, String>, | ||
/// 请求数据,base64编码后的 | ||
pub request_data: String, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct WebFingerPrintMatch { | ||
/// 匹配状态码 | ||
pub status_code: u16, | ||
/// 匹配favicon的hash列表 | ||
#[serde(default)] | ||
pub favicon_hash: Vec<String>, | ||
/// 匹配的请求头 | ||
pub headers: BTreeMap<String, String>, | ||
/// 匹配的关键词列表 | ||
pub keyword: Vec<String>, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct V3WebFingerPrint { | ||
/// 组件名称 | ||
#[serde(default)] | ||
pub name: String, | ||
/// 权重 | ||
#[serde(default)] | ||
pub priority: u32, | ||
pub fingerprint: Vec<WebFingerPrint>, | ||
} | ||
|
||
/// 单个指纹结构 | ||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct WebFingerPrint { | ||
/// 指纹的自定义请求 | ||
#[serde(flatten)] | ||
pub fingerprint: WebFingerPrintRequest, | ||
/// 匹配部分 | ||
#[serde(flatten)] | ||
pub match_rules: WebFingerPrintMatch, | ||
} | ||
|
||
impl Into<Template> for V3WebFingerPrint { | ||
fn into(self) -> Template { | ||
let mut info = Info { | ||
name: self.name.to_lowercase().clone(), | ||
severity: Severity::Info, | ||
author: vec!["cn-kali-team".to_string()], | ||
tags: vec![ | ||
"detect".to_string(), | ||
"tech".to_string(), | ||
], | ||
..Info::default() | ||
}; | ||
info.set_vpf(VPF { | ||
vendor: "00_unknown".to_string(), | ||
product: self.name.clone(), | ||
framework: None, | ||
verified: false, | ||
}); | ||
let mut index = Requests::default_web_index(); | ||
index.http[0].operators.matchers = v3_finger_to_matcher(&self.fingerprint); | ||
Template { | ||
id: hans_to_pinyin(&self.name).to_lowercase(), | ||
info, | ||
flow: None, | ||
requests: index, | ||
self_contained: false, | ||
stop_at_first_match: false, | ||
variables: Default::default(), | ||
} | ||
} | ||
} | ||
|
||
fn v3_finger_to_matcher(finger: &Vec<WebFingerPrint>) -> Vec<Matcher> { | ||
let mut ms = Vec::new(); | ||
let mut or_word = HashSet::new(); | ||
let mut header = HashSet::new(); | ||
let mut favicon = HashSet::new(); | ||
for wfp in finger.iter() { | ||
header.extend(wfp.match_rules.headers.iter().map(|(k, v)| format!("{}: {}", k.to_lowercase(), v.trim_end_matches("*").to_lowercase())).collect::<Vec<String>>()); | ||
favicon.extend(wfp.match_rules.favicon_hash.clone()); | ||
if wfp.match_rules.keyword.len() > 1 { | ||
// 多个必须AND关系 | ||
ms.push(Matcher { | ||
matcher_type: MatcherType::Word(Word { words: wfp.match_rules.keyword.clone() }), | ||
condition: Condition::And, | ||
..Matcher::default() | ||
}) | ||
} else { | ||
if !wfp.match_rules.favicon_hash.is_empty() { | ||
continue; | ||
} | ||
or_word.extend(wfp.match_rules.keyword.clone()); | ||
// 单个OR,或者空 | ||
} | ||
} | ||
if !header.is_empty() { | ||
ms.push(Matcher { | ||
part: Part::Header, | ||
matcher_type: MatcherType::Word(Word { words: header.into_iter().map(|x| x).collect() }), | ||
..Matcher::default() | ||
}) | ||
} | ||
if !favicon.is_empty() { | ||
ms.push(Matcher { | ||
matcher_type: MatcherType::Favicon(Favicon { hash: favicon.into_iter().map(|x| x).collect() }), | ||
..Matcher::default() | ||
}) | ||
} | ||
if !or_word.is_empty() { | ||
ms.push(Matcher { | ||
matcher_type: MatcherType::Word(Word { words: or_word.into_iter().map(|x| x).collect() }), | ||
condition: Condition::Or, | ||
..Matcher::default() | ||
}) | ||
} | ||
return ms; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
id: apollo-adminservice | ||
info: | ||
name: apollo-adminservice | ||
author: cn-kali-team | ||
tags: detect,tech | ||
severity: info | ||
metadata: | ||
product: apollo-adminservice | ||
vendor: 00_unknown | ||
verified: false | ||
http: | ||
- method: GET | ||
path: | ||
- '{{BaseURL}}/' | ||
matchers: | ||
- type: word | ||
words: | ||
- 'content-length: 19' | ||
part: header | ||
- type: word | ||
words: | ||
- apollo-adminservice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
id: casbin | ||
info: | ||
name: casbin | ||
author: cn-kali-team | ||
tags: detect,tech | ||
severity: info | ||
metadata: | ||
product: Casbin | ||
vendor: 00_unknown | ||
verified: false | ||
http: | ||
- method: GET | ||
path: | ||
- '{{BaseURL}}/' | ||
matchers: | ||
- type: word | ||
words: | ||
- <title>casdoor | ||
- casdoor/manifest.json | ||
condition: and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
id: cisco-ios-xe | ||
info: | ||
name: cisco-ios-xe | ||
author: cn-kali-team | ||
tags: detect,tech | ||
severity: info | ||
metadata: | ||
product: CISCO-IOS-XE | ||
vendor: 00_unknown | ||
verified: false | ||
http: | ||
- method: GET | ||
path: | ||
- '{{BaseURL}}/' | ||
matchers: | ||
- type: favicon | ||
hash: | ||
- d2962d133fd209cf567d05d1683f3fc1 | ||
- type: word | ||
words: | ||
- <script>window.onload=function(){ url ='/webui';window.location.href=url;}</script> | ||
- <script>window.onload=function(){ url ='/webui/';window.location.href=url;}</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
id: dahua-zhi-hui-yuan-qu-zong-he-guan-li-ping-tai | ||
info: | ||
name: dahua-智慧园区综合管理平台 | ||
author: cn-kali-team | ||
tags: detect,tech | ||
severity: info | ||
metadata: | ||
product: dahua-智慧园区综合管理平台 | ||
vendor: 00_unknown | ||
verified: false | ||
http: | ||
- method: GET | ||
path: | ||
- '{{BaseURL}}/' | ||
matchers: | ||
- type: word | ||
words: | ||
- <li id="DSS-help"> | ||
- <span>DSS助手</span> | ||
condition: and | ||
- type: word | ||
words: | ||
- Created by IntelliJ IDEA. | ||
- /WPMS | ||
condition: and | ||
- type: word | ||
words: | ||
- Created by IntelliJ IDEA. | ||
- Selene | ||
condition: and | ||
- type: word | ||
words: | ||
- '"include/styles/common/favicon.ico' | ||
- portal/login_init.action | ||
condition: and | ||
- type: word | ||
words: | ||
- /WPMS/asset/common/css/base.css |
Oops, something went wrong.