enthec/webappanalyzer
GitHub: enthec/webappanalyzer
维护 Wappalyzer 技术指纹识别规则的 JSON 规范库,通过正则和多维度特征匹配来识别 Web 应用所使用的技术栈及版本信息。
Stars: 459 | Forks: 107
# webappanalyzer
[](https://github.com/enthec/webappanalyzer/actions/workflows/validate.yml)
[](https://opensource.org/license/gpl-3-0/)
## 规范
使用一长串 [regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) 来识别网页上的技术。Wappalyzer 检查 HTML 代码以及 JavaScript 变量、响应头等。
模式(正则表达式)保存在 [`src/technologies/`](https://github.com/enthec/webappanalyzer/blob/master/src/technologies) 中。以下是一个应用程序指纹的示例。
#### 示例
```
{
"Example": {
"description": "A short description of the technology.",
"cats": [
1
],
"cookies": {
"cookie_name": "Example"
},
"dom": {
"#example-id": {
"exists": "",
"attributes": {
"class": "example-class"
},
"properties": {
"example-property": ""
},
"text": "Example text content"
}
},
"dns": {
"MX": [
"example\\.com"
]
},
"icon": "Example.svg",
"cpe": "cpe:2.3:a:example:example:*:*:*:*:*:*:*:*",
"js": {
"Example.method": ""
},
"excludes": [
"Example"
],
"headers": {
"X-Powered-By": "Example"
},
"text": [
"\bexample\b"
],
"css": [
"\\.example-class"
],
"robots": [
"Disallow: /unique-path/"
],
"implies": [
"PHP\\;confidence:50"
],
"requires": [
"WordPress"
],
"requiresCategory": [
6
],
"meta": {
"generator": "(?:Example|Another Example)"
},
"probe": {
"/path": ""
},
"scriptSrc": [
"example-([0-9.]+)\\.js\\;confidence:50\\;version:\\1"
],
"scripts": [
"function webpackJsonpCallback\\(data\\) {"
],
"url": [
"example\\.com"
],
"xhr": [
"example\\.com"
],
"oss": true,
"saas": true,
"pricing": [
"mid",
"freemium"
],
"website": "https://example.com",
"certIssuer": "Example",
}
}
```
## JSON 字段
在 [`schema.json`](https://github.com/enthec/webappanalyzer/blob/main/schema.json) 查看 JSON schema。
## 必需属性
| 字段 | 类型 | 描述 | 示例 |
|-------------|----------|----------------------------------|-------------------------|
| **cats** | `[]int` | 类别 ID | `[1, 6]` |
| **website** | `string` | 应用程序的网站 URL | `"https://example.com"` |
## 可选属性
### 基础
| 字段 | 类型 | 描述 | 示例 |
|-----------------|---------------------|-----------------------------------------------------------|--------------------------------------------------|
| **description** | `string` | 技术的简短描述 | `"short description"` |
| **icon** | `string` | 应用程序图标文件名 | `"Example.svg"` |
| **cpe** | `string` | 应用程序 v2.3 [CPE](https://nvd.nist.gov/products/cpe) | `"cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*"` |
| **saas** | `boolean` | 软件即服务 | `true` |
| **oss** | `boolean` | 开源软件 | `true` |
| **pricing** | [Pricing](#Pricing) | 成本指示符 | `["low", "freemium"]` |
### 暗示、依赖和排斥
| 字段 | 类型 | 描述 | 示例 |
|----------------------|------------|-------------------------------------------------------------------------------------------|-----------------|
| **implies** | `[]string` | 一个应用程序的存在可以暗示另一个应用程序的存在 | `["PHP"]` |
| **requires** | `[]string` | 类似于 implies,但只有在识别出所需技术时才运行检测 | `["WordPress"]` |
| **excludes** | `[]string` | 一个应用程序的存在可以排除另一个应用程序的存在 | `["Apache"]` |
| **requiresCategory** | `[]int` | 类似于 requires,但使用类别 ID | `[6]` |
### 模式
| 字段 | 类型 | 描述 | 正则 | 示例 |
|--------------------------|---------------------|-----------------------------------------------------------------------------------------------|-------|-------------------------------------------------|
| **cookies** | `{string:string}` | Cookies | true | `{"cookie_name": "Cookie value"}` |
| **dom** | [DOM](#DOM) | [Query selectors](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) | false | `["img[src*='example']"]` |
| **dns** | `{string:[]string}` | DNS 记录 | true | `{"MX": ["example\\.com"]}` |
| **js** | `{string:string}` | JavaScript 属性 | true | `{"jQuery.fn.jquery": ""}` |
| **headers** | `{string:string}` | HTTP 响应头 | true | `{"X-Powered-By": "^WordPress$"}` |
| **text** | `[]string` | 匹配纯文本 | true | `["\bexample\b"]` |
| **css** | `[]string` | CSS 规则 | true | `["\\.example-class"]` |
| **probe** | `{string:string}` | 请求 URL 以测试其是否存在或匹配文本内容 | false | `{"/path": "Example text"}` |
| **robots** | `[]string` | Robots.txt 内容 | false | `["Disallow: /unique-path/"]` |
| **url** | `[]string` | 页面的完整 URL | true | `["^https?//.+\\.wordpress\\.com"]` |
| **xhr** | `[]string` | XHR 请求的主机名 | true | `["cdn\\.netlify\\.com"]` |
| **meta** | `{string:string}` | HTML meta 标签 | true | `{"generator": "^WordPress$"}` |
| **scriptSrc** | `[]string` | JavaScript 文件的 URL | true | `["jquery\\.js"]` |
| **scripts** | `[]string` | JavaScript 源代码 | true | `["function webpackJsonpCallback\\(data\\) {"]` |
| ~~**html**~~(已弃用) | `[]string` | HTML 源代码 | true | `["]*href=\"index.html"]` |
| **certIssuer** | `string` | SSL 证书颁发者 | false | `"Let's Encrypt"` |
## 模式
模式本质上是写成字符串形式的 JavaScript 正则表达式,但有一些补充。
### 特性与陷阱
- 由于字符串格式的限制,在使用点号 (`\\.`) 等特殊字符时,必须对转义字符本身进行转义。双引号只需转义一次 (`\"`)。斜杠不需要转义 (`/`)。
- 不支持标志位。正则表达式被视为不区分大小写。
- 捕获组 (`()`) 用于版本检测。在其他情况下,使用非捕获组 (`(?:)`)。
- 尽可能使用字符串的开始和结束锚点 (`^` 和 `$`) 以获得最佳性能。
- 短小或通用的模式可能导致应用程序识别错误。尝试找到唯一的字符串进行匹配。
### 标签
标签(一种非标准语法)可以附加到模式(以及 implies 和 excludes,用 `\\;` 分隔)以存储附加信息。
| 标签 | 描述 | 示例 |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| **confidence** | 指示可能导致误报的可靠性较低的模式。目标是达到 100% 的综合置信度。如果未指定,默认为 100% | `"js": {"Mage": "\\;confidence:50"}` |
| **version** | 使用特殊语法从模式匹配中获取版本号 | `"scriptSrc": "jquery-([0-9.]+)\.js\\;version:\\1"` |
### 版本语法
可以使用捕获组从模式中获取应用程序版本信息。可以使用三元运算符 (`?:`) 计算条件。
| 示例 | 描述 |
|-----------|------------------------------------------------------------------|
| `\\1` | 返回第一个匹配项 |
| `\\1?a:` | 如果第一个匹配项包含值则返回 a,否则不返回任何内容 |
| `\\1?a:b` | 如果第一个匹配项包含值则返回 a,返回 b |
| `\\1?:b` | 如果第一个匹配项包含值则不返回任何内容,否则返回 b |
| `foo\\1` | 返回附加了第一个匹配项的 foo |
## 类型
### DOM
Dom 数据类型可以是:
- `[]string`: [query selectors](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) 列表
- `JSON Object`: **键** 是 [query selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) & **值** 是一个需要以下结构的对象:
- 值要求:
1. {"attributes": {string: `pattern`}}
- `pattern` 可以是正则表达式
- `pattern` 兼容 [tags](#Tags)
- 示例: {"attributes": {"href": "pattern", "src": "pattern"}}
2. {"properties": {string: `pattern`}}
- `pattern` 可以是正则表达式
- `pattern` 兼容 [tags](#Tags)
- 示例: {"attributes": {"href": "pattern", "src": "pattern"}}
3. {"text": `pattern`}
- `pattern` 可以是正则表达式
- `pattern` 兼容 [tags](#Tags)
4. {"exists": ""}
- `value` 是空字符串
- `empty string` 兼容 [tags](#Tags)
```
// example []string
{
"dom": ["img[src*='example']", "form[action*='example.com/forms/']"]
}
```
```
// example JSON Object
{
"dom": {
"link[href*='fonts.g']": {
"attributes": {
"href": "fonts\\.(?:googleapis|google|gstatic)\\.com"
},
"properties": {
"container": ""
},
"text": "GLPI\\s+version\\s+([\\d\\.]+)\\;version:\\1"
},
"style[data-href*='fonts.g']": {
"attributes": {
"data-href": "fonts\\.(?:googleapis|google|gstatic)\\.com"
},
"exists": "\\;confidence:50"
}
}
}
```
### 定价
成本指示符(基于典型计划或平均月价格)和可用的定价模式。仅适用于付费产品。
**其中之一**:
- `low`: 低于 100 美元/月
- `mid`: 100 - 1,000 美元/月之间
- `high`: 高于 1,000 美元/月
**以及以下任意项**:
- `freemium`: 提供免费计划
- `onetime`: 接受一次性付款
- `recurring`: 提供订阅
- `poa`: 询价
- `payg`: 按需付费(例如佣金或基于使用量的费用)
标签:C++17, C2日志可视化, CMS识别, CPE, DOM分析, ESC4, GUI应用, Homebrew安装, HTML解析, HTTP头分析, JavaScript分析, OSINT, Wappalyzer, Web应用分析, Web扫描, Web技术栈, 开源情报, 技术指纹, 指纹识别, 提权防护, 数据可视化, 正则表达式, 特征库, 网络安全, 网页分析工具, 资产发现, 软件清单, 软件识别, 隐私保护