Add files via upload

This commit is contained in:
公明
2025-11-21 23:18:21 +08:00
committed by GitHub
parent d3e48eaf44
commit c6fbd12447
30 changed files with 420 additions and 510 deletions
+85 -42
View File
@@ -1,62 +1,105 @@
name: "api-fuzzer"
command: "ffuf"
command: "python3"
args:
- "-c"
- |
import pathlib
import sys
import textwrap
from urllib.parse import urljoin
import requests
if len(sys.argv) < 2:
sys.stderr.write("缺少 base_url 参数\n")
sys.exit(1)
base_url = sys.argv[1]
endpoints_arg = sys.argv[2] if len(sys.argv) > 2 else ""
methods_arg = sys.argv[3] if len(sys.argv) > 3 else "GET,POST"
wordlist_path = sys.argv[4] if len(sys.argv) > 4 else ""
timeout = float(sys.argv[5]) if len(sys.argv) > 5 and sys.argv[5] else 10.0
methods = [m.strip().upper() for m in methods_arg.split(",") if m.strip()]
if not methods:
methods = ["GET"]
endpoints = []
if endpoints_arg:
endpoints = [ep.strip() for ep in endpoints_arg.split(",") if ep.strip()]
elif wordlist_path:
path = pathlib.Path(wordlist_path)
if not path.is_file():
sys.stderr.write(f"字典文件不存在: {path}\n")
sys.exit(1)
endpoints = [line.strip() for line in path.read_text().splitlines() if line.strip()]
if not endpoints:
sys.stderr.write("未提供端点列表或字典。\n")
sys.exit(1)
results = []
for endpoint in endpoints:
url = urljoin(base_url.rstrip("/") + "/", endpoint.lstrip("/"))
for method in methods:
try:
resp = requests.request(method, url, timeout=timeout, allow_redirects=False)
results.append({
"method": method,
"endpoint": endpoint,
"status": resp.status_code,
"length": len(resp.content),
"redirect": resp.headers.get("Location", "")
})
except requests.RequestException as exc:
results.append({
"method": method,
"endpoint": endpoint,
"error": str(exc)
})
for item in results:
if "error" in item:
print(f"[{item['method']}] {item['endpoint']} -> ERROR: {item['error']}")
else:
redirect = f" -> {item['redirect']}" if item.get("redirect") else ""
print(f"[{item['method']}] {item['endpoint']} -> {item['status']} ({item['length']} bytes){redirect}")
enabled: true
short_description: "API端点模糊测试工具,支持智能参数发现"
description: |
高级API端点模糊测试工具,支持智能参数发现和漏洞评估。
**主要功能:**
- API端点发现
- 参数模糊测试
- 漏洞评估
- 多种HTTP方法支持
**使用场景:**
- API安全测试
- 端点发现
- 参数测试
- 安全评估
基于requests的轻量级API端点探测脚本,可按照提供的端点列表或字典,对多个HTTP方法进行探测并记录状态码与响应长度。
parameters:
- name: "base_url"
type: "string"
description: "API基础URL"
description: "API基础URL,例如 https://api.example.com/"
required: true
flag: "-u"
format: "flag"
position: 0
format: "positional"
- name: "endpoints"
type: "string"
description: "要测试的特定端点(逗号分隔)"
description: "逗号分隔的端点列表(如 /v1/users,/v1/auth/login"
required: false
default: ""
position: 1
format: "positional"
- name: "methods"
type: "string"
description: "HTTP方法逗号分隔)"
description: "HTTP方法列表,逗号分隔(默认 GET,POST"
required: false
default: "GET,POST,PUT,DELETE"
default: "GET,POST"
position: 2
format: "positional"
- name: "wordlist"
type: "string"
description: "端点发现字典"
description: "端点字典文件路径(当未提供endpoints时使用)"
required: false
default: "/usr/share/wordlists/api/api-endpoints.txt"
flag: "-w"
format: "flag"
- name: "additional_args"
position: 3
format: "positional"
- name: "timeout"
type: "string"
description: |
额外的api-fuzzer参数。用于传递未在参数列表中定义的api-fuzzer选项。
**示例值:**
- 根据工具特性添加常用参数示例
**注意事项:**
- 多个参数用空格分隔
- 确保参数格式正确,避免命令注入
- 此参数会直接追加到命令末尾
description: "每个请求的超时时间(秒,默认10)"
required: false
format: "positional"
default: "10"
position: 4
format: "positional"