PhishTrap
收藏资源简介:
PhishTrap 是一个高质量、可复现的钓鱼 URL 检测数据集,由 Sai Dutta Abhishek Dash 构建并维护。数据集包含 19,954 条 URL,其中钓鱼 URL 与合法 URL 各占 50%(各 9,977 条),类别完全平衡。每条 URL 提取了 16 个基于 URL 结构的特征,包括 6 个原始特征(URL 长度、连字符数、数字数、子域名数、是否为可信顶级域、协议是否存在)和 10 个扩展特征(特殊字符数、Shannon 熵、路径深度、域长度、域名是否为 IP、是否包含 @ 符号、是否包含双斜杠重定向、顶级域长度、查询参数数量、路径长度)。数据来源:钓鱼 URL 来自 Phishing.Database(每日 PyFunceble 验证,496,576 个域名)和 OpenPhish(15 分钟更新一次);合法 URL 来自 Tranco top 10K(聚合 CrUX、Cloudflare、Umbrella、Majestic 等排名)。数据经过跨来源去重、合法域名与钓鱼域名交叉过滤,确保无重叠。数据集按 70/15/15 划分为训练集、验证集和测试集,并提供 CSV 和 Parquet 两种格式,采用 MIT 许可证。数据集支持自动更新:每 6 小时通过 GitHub Actions 流水线从实时源抓取最新钓鱼 URL,合并去重,修剪过期条目(超过 60 天未确认的钓鱼 URL 被移除),重新提取特征,平衡类别,并重新划分。流水线包含严格的验证机制(缺失值检查、NaN/Inf 检查、重复检查、类别平衡检查、预上传验证和后上传验证),并记录每次构建的元数据。该数据集适用于二分类任务(检测钓鱼 URL),也可用于 URL 特征工程、机器学习模型训练与评估。
PhishTrap is a high-quality, reproducible phishing URL detection dataset built and maintained by Sai Dutta Abhishek Dash. It contains 19,954 URLs, with an equal split of 50% phishing and 50% legitimate URLs (9,977 each), ensuring perfect class balance. Each URL is represented by 16 URL-structure-based features, including 6 raw features (URL length, number of hyphens, number of digits, number of subdomains, whether it is a trusted top-level domain, whether a protocol exists) and 10 extended features (number of special characters, Shannon entropy, path depth, domain length, whether the domain is an IP, whether it contains @, whether it contains double-slash redirection, top-level domain length, number of query parameters, path length). Data sources: phishing URLs from Phishing.Database (daily PyFunceble verification, 496,576 domains) and OpenPhish (updated every 15 minutes); legitimate URLs from Tranco top 10K (aggregating rankings from CrUX, Cloudflare, Umbrella, Majestic, etc.). The data undergoes cross-source deduplication and cross-filtering between legitimate and phishing domains to ensure no overlap. The dataset is split into training/validation/test sets at 70/15/15 ratios and is available in CSV and Parquet formats under the MIT license. The dataset supports automatic updates: every 6 hours, a GitHub Actions pipeline fetches the latest phishing URLs from real-time sources, merges and deduplicates them, removes expired entries (phishing URLs not confirmed for over 60 days), re-extracts features, balances classes, and re-splits. The pipeline includes strict validation mechanisms (missing value check, NaN/Inf check, duplicate check, class balance check, pre-upload and post-upload validation) and logs metadata for each build. This dataset is suitable for binary classification tasks (phishing URL detection), as well as URL feature engineering, machine learning model training and evaluation.
PhishTrap 数据集概述
基本信息
- 数据集名称:PhishTrap
- 许可证:MIT
- 语言:英语
- 标签:网络安全、钓鱼检测、URL检测、机器学习、分类、安全
- 数据规模:10K < n < 100K
数据集简介
PhishTrap 是一个精选的钓鱼 URL 检测数据集,专注于可复现性。该数据集包含 19,954 条 URL 样本,其中钓鱼 URL 和合法 URL 各占 50%(即 9,977 条)。数据集的特性仅从 URL 结构提取,不依赖第三方查询或页面内容。
核心统计
| 属性 | 值 |
|---|---|
| 总样本数 | 19,954 |
| 钓鱼 URL | 9,977 (50%) |
| 合法 URL | 9,977 (50%) |
| 特征数 | 16 |
| 训练/验证/测试集划分 | 70/15/15 |
| 数据格式 | CSV, Parquet |
| 许可证 | MIT |
特征说明
原始6个特征(URL结构)
| 特征 | 描述 |
|---|---|
url_length |
URL总字符数 |
hyphen_count |
URL中连字符数量 |
digit_count |
URL中数字数量 |
subdomain_count |
子域名数量 |
trusted_tld |
若TLD为.com/.org/.net/.edu/.gov则为1 |
protocol_exists |
若存在http/https则为1 |
扩展10个特征(深层信号)
| 特征 | 描述 |
|---|---|
special_char_count |
特殊字符数量(如@, -, _, .等) |
entropy |
URL字符串的香农熵 |
path_depth |
路径段数量 |
domain_length |
域名部分长度 |
is_domain_ip |
若域名为IP地址则为1 |
has_at_symbol |
若URL包含@则为1 |
has_double_slash_redirect |
若协议后出现//则为1 |
tld_length |
顶级域名长度 |
query_param_count |
查询参数数量 |
path_length |
路径部分长度 |
数据来源
钓鱼 URL 来源
| 来源 | 域名数 | 验证方式 |
|---|---|---|
| Phishing.Database | 496,576 | PyFunceble每日测试 (MIT) |
| OpenPhish | 300+(最新feed) | 15分钟更新周期 |
钓鱼域名至少出现在一个已验证来源中,跨来源进行去重。
合法 URL 来源
| 来源 | 域名数 | 原因 |
|---|---|---|
| Tranco top 10K | 10,000 | 聚合CrUX + Cloudflare + Umbrella + Majestic |
合法域名会与钓鱼集合进行过滤以移除重叠部分。
标签说明
0= 合法1= 钓鱼
使用示例
使用 Hugging Face Datasets
python from datasets import load_dataset
dataset = load_dataset("saidutta69/PhishTrap") train = dataset["train"] val = dataset["val"] test = dataset["test"]
使用 Pandas
python import pandas as pd
df = pd.read_csv("hf://datasets/saidutta69/PhishTrap/data/phishtrap_full.csv")
自动更新管道
PhishTrap 通过自动化管道持续刷新,每6小时重建一次数据集,从实时feed中获取最新钓鱼URL。完整管道为开源项目,可在 GitHub 上获取(github.com/instax-dutta/PhishTrap)。
管道架构
GitHub Actions (cron, 每6小时) │ ├─ 1. 获取钓鱼URL ── OpenPhish (15分钟feed) + Phishing.Database + PhishStats ├─ 2. 获取合法域名 ── Tranco top 10K ├─ 3. 与现有数据合并 ── 规范去重(忽略scheme/port/trailing-slash) ├─ 4. 清除过期数据 ── 超过60天未确认的钓鱼URL被丢弃 ├─ 5. 提取16个特征 ── 所有版本使用相同特征集 ├─ 6. 50/50重新平衡 ── 分层采样 ├─ 7. 70/15/15划分 ── 训练/验证/测试 └─ 8. 验证并上传 ── 上传前门控 + 上传后验证 → Hugging Face
质量保证
- 新鲜度追踪:每行记录
first_seen、last_seen和collected_at时间戳 - 规范去重:
http://evil.com、https://evil.com/和http://evil.com:80通过canonical_url列归为一行 - 新证据优先:若合法Tranco域名后出现在钓鱼feed中,钓鱼标签将覆盖
- 过期清理:超过60天未确认的钓鱼URL自动移除
- 来源保留:
source列记录每个报告的feed - 来源韧性:每次获取3次指数退避重试,不可达来源跳过而不致命
- 上传前验证:检查缺失特征、NaN/inf值、重复数据和类别平衡
- 上传后验证:下载上传文件并重新验证
- 构建元数据:记录构建ID、日期、类别/来源分布和schema版本
- 无部分状态:每次运行原子替换整个
data/文件夹
运行管道
bash export HF_TOKEN=hf_xxx # 必需,从HF账户设置获取 python run_pipeline.py # 增量刷新 python run_pipeline.py --force-full # 从头重建 python run_pipeline.py --max-samples 20000 # 更大数据集 python run_pipeline.py --dry-run # 获取/合并/清理/重平衡,不上传
数据集优势
- 交叉验证来源:每个域名来自信誉良好的feed
- 无数据泄漏:训练/验证/测试集分离且无重叠
- 干净特征:16个基于URL的特征,推理时无需第三方API调用
- 可复现性:方法完全文档化,可随时重新运行管道
引用信息
bibtex @misc{saidutta69_2026_phishtrap, author = {Sai Dutta Abhishek Dash}, title = {PhishTrap: High-Quality Phishing URL Dataset}, year = {2026}, publisher = {Hugging Face}, howpublished = {url{https://huggingface.co/datasets/saidutta69/PhishTrap}} }
数据集基于 Phishing.Database、OpenPhish 和 Tranco 构建,采用 MIT 许可证。




