cognis-digital/osintpulse

GitHub: cognis-digital/osintpulse

一个零依赖的开源情报(OSINT)每周摘要引擎,能够从配置来源抓取、去重、排序并生成带日期的 Markdown/JSON 简报。

Stars: 0 | Forks: 0

# osintpulse **一个 OSINT 每周摘要引擎。** `osintpulse` 会从配置的 来源(RSS/Atom feed URL 和实时网页搜索查询)中抓取信息,并进行规范化和 去重处理,然后根据时效性和关键词相关性进行排名, 最终生成一份带日期的 Markdown 和 JSON 报告。 它可以在提供的 items fixture 上**完全离线**运行(因此生成的摘要具有 可重现性,且测试套件完全不需要访问网络),并且可以 **选择性地**通过 `--live` 标志来拉取实时 feed。 仅用于防御性/分析性目的:对开源 items 进行聚合、排名和报告。 - 维护者:**Cognis Digital** - 许可证:**COCL 1.0** - Python:**3.10+**,仅使用标准库(无运行时依赖) ## 安装说明 ``` git clone https://github.com/cognis-digital/osintpulse cd osintpulse pip install -e . # 用于测试: pip install -e ".[dev]" ``` 这将安装 `osintpulse` 命令行工具。 ## 功能 - `osintpulse build ` — 生成带日期的摘要,按主题进行分组, 排名的 item 会显示日期、来源、标题以及该 item 的“排名原因”说明。默认输出 Markdown;使用 `--json` 输出 JSON; 使用 `--out DIR` 将写入 `digest-YYYY-MM-DD.md`/`.json` 文件。 - `osintpulse rank --keywords a,b,c` — 根据时效性衰减 + 关键词相关性对 item 进行评分和排序;支持表格或 `--json` 格式。 - `osintpulse dedupe ` — 根据规范化的 链接/标题对 item 进行去重;支持表格或 `--json` 格式。 - 配置 schema 包含主题、每个主题的关键词以及每个主题的来源 (feed 和/或查询)。 - 详尽的评分公式(时效性半衰期 + 饱和关键词权重)。 - 可选的 `--live` feed 获取(使用标准库 `urllib` + `xml.etree`);网页搜索 查询来源没有内置后端,将被报告为已跳过,因此 该工具绝不会伪造结果。 - 内置 `examples/`(包含一个 `config.json` 和一个精心制作的 `items.json`),因此每个 命令开箱即用,支持离线运行。 ## 配置 schema ``` { "title": "Weekly Infrastructure & Cyber Pulse", "half_life_days": 3.0, "topics": [ { "name": "Grid & Energy Security", "keywords": ["grid", "substation", "transformer"], "sources": [ { "feed": "https://example.org/feeds/energy-security.xml" }, { "query": "north american grid reliability advisory" } ] } ] } ``` 来源可以是 `feed`(RSS/Atom URL)或 `query`(网页搜索字符串)。 ## Items schema 每个 item 都是一个 JSON 对象。未知字段将被忽略;缺失字段将采用合理的 默认值。日期接受 ISO 8601 或 RFC-8222(RSS `pubDate`)格式。 ``` { "title": "Regional grid operator flags transformer shortage", "link": "https://example.org/news/transformer-shortage", "source": "Example Grid Wire", "summary": "Long lead times on large power transformers ...", "published": "2026-06-18T13:00:00Z", "topic": "Grid & Energy Security" } ``` ## 评分公式 每个 item 的得分在 `[0, 1]` 之间,由两个信号组合得出。 **1. 时效性衰减**(指数半衰期): ``` recency = 0.5 ** (age_days / half_life_days) ``` 最新的 item 得分约为 1.0;刚好经过一个半衰期的 item 得分为 0.5;两个 半衰期 → 0.25。未注明日期的 item 会获得一个中性下限值(`0.25`),因此它们不会 被静默丢弃。未来日期的 item 将被强制归零计算时长。 **2. 关键词相关性**(饱和加权命中计数): ``` raw_hits = sum over keywords of (2.0 * title_matches + 1.0 * summary_matches) keyword = 1 - 1 / (1 + raw_hits) # 0 hits -> 0, grows toward (never reaching) 1 ``` 标题匹配的权重是摘要匹配的 2 倍。多词关键词按 连续短语进行匹配。饱和形式极大地奖励了前几次匹配, 同时防止了堆砌关键词的 item 占据主导地位。 **最终得分:** ``` score = 0.55 * recency + 0.45 * keyword ``` 权重总和为 1.0,确保得分保持在 `[0, 1]` 范围内。排序规则为按得分 降序排列,然后按发布日期降序排列(未注明日期的排在最后),最后按标题排列。 ## 使用示例及实际输出 ### build(离线,Markdown) ``` osintpulse build examples/config.json --items examples/items.json --now 2026-06-19T00:00:00Z ``` ``` # Weekly Infrastructure & Cyber Pulse **Date:** 2026-06-19 **Items:** 9 **Topics:** 3 **Recency half-life:** 3 days ## Grid & Energy Security *Keywords: grid, substation, transformer, blackout, energy, power* 1. [Regional grid operator flags transformer shortage ahead of summer peak](https://example.org/news/transformer-shortage) - **Source:** Mirror Aggregator | **Date:** 2026-06-18T15:30:00Z | **Score:** 0.882 - **Why ranked:** 0.4d old (recency 0.92); 5 keyword hits (kw 0.83) - Duplicate copy of the transformer-shortage story carried by an aggregator. 2. [Blackout drill tests substation isolation procedures in coastal county](https://example.org/news/blackout-drill) - **Source:** Coastal Utility Brief | **Date:** 2026-06-15T09:00:00Z | **Score:** 0.575 - **Why ranked:** 3.6d old (recency 0.43); 4 keyword hits (kw 0.80) ... ``` (具体得分取决于 `--now` 参数;省略 `--now` 则使用当前时间。) ### rank ``` osintpulse rank examples/items.json --keywords ransomware,scada,exploit --now 2026-06-19T00:00:00Z ``` ``` # SCORE DATE SOURCE TITLE -------------------------------------------------------------------------------- 1 0.814 2026-06-17 ICS Watch New ransomware variant targets SCADA historian databases 2 0.306 2026-06-16 ICS Watch Advisory: authentication bypass vulnerability in industrial gateway firmware ... ``` ### dedupe ``` osintpulse dedupe examples/items.json ``` 关于 transformer 短缺故事的两份副本(其中一份带有 `utm_source` 跟踪参数)被合并为一个单一 item;运行报告会指出移除了多少个 重复项。 ### Live 模式(需手动开启,需要网络) ``` osintpulse build examples/config.json --live --out out/ ``` 通过网络获取每个 `feed` 来源;`query` 来源将在 **Notes**(备注)部分被列为已跳过。测试套件从不执行此模式。 ## 开发 ``` pip install -e ".[dev]" python -m pytest # on Windows: PYTHONUTF8=1 python -m pytest ``` ## 许可证 许可证:**COCL 1.0**。
标签:ESC4, OSINT, Python, 实时处理, 情报收集, 无后门, 漏洞研究, 自动化报告, 逆向工具