Security News Module
개요
한국 보안 뉴스 소스 11곳에서 뉴스를 자동으로 수집하고, Gemini API로 요약한 후 Notion과 Tistory에 발행하는 모듈입니다.
주기: 1시간마다 자동 실행
워크플로우
CODEBLOCK0
주요 기능
1. 뉴스 수집 (Collection)
11개 한국 보안 뉴스 소스:
| 소스 | URL | 타입 |
|---|
| KRCERT | https://www.krcert.or.kr | 공식 |
| NCSC |
https://www.ncsc.go.kr | 공식 |
| Boho | https://www.boho.or.kr | 공식 |
| Dailysec | https://dailysecu.com | 민간 |
| KISA | https://www.kisa.or.kr | 공식 |
| K-shield | https://k-shield.or.kr | 공식 |
| KrCert | https://krcert.or.kr | 공식 |
| Notice | 내부 소스 | 내부 |
| Boho2 | https://boho.or.kr | 공식 |
| Krcert2 | https://www.krcert.or.kr | 공식 |
| Ncsc2 | https://ncsc.go.kr | 공식 |
2. 키워드 필터링 (Filtering)
보안 관련 키워드:
CODEBLOCK1
3. Gemini API 요약 (Summarization)
요약 구조:
CODEBLOCK2
4. Notion 발행 (Notion Publishing)
- - 자동 저장: 수집된 뉴스 자동 저장
- 태그 분류: 키워드 기반 자동 태그
- 상태 관리: New → Read → Archived
5. Tistory 발행 (Tistory Publishing)
- - 선택적 발행: 중요 뉴스만 발행
- 자동 포맷팅: 마크다운 → HTML 변환
- 카테고리 분류: 자동 카테고리 할당
설치 방법
1. 저장소 클론
CODEBLOCK3
2. 의존성 설치
CODEBLOCK4
3. 환경 변수 설정
CODEBLOCK5
INLINECODE0 파일 수정:
CODEBLOCK6
사용법
수동 실행
CODEBLOCK7
스케줄러 등록
OpenClaw 스케줄러에 등록하여 자동 실행:
CODEBLOCK8
설정 파일
config.py
CODEBLOCK9
파일 구조
CODEBLOCK10
Notion 데이터베이스 설정
필드 구성
- -
Title (제목) - INLINECODE3 (140자 요약)
- INLINECODE4 (상세 분석)
- INLINECODE5 (출처)
- INLINECODE6 (원문 링크)
- INLINECODE7 (다중 선택)
- INLINECODE8 (발행일)
- INLINECODE9 (선택: New, Read, Archived)
예시 출력
수집된 뉴스
CODEBLOCK11
실행 통계
최근 실행 결과 (2026-03-08 11:58)
CODEBLOCK12
문제 해결
뉴스 수집 실패
CODEBLOCK13
Gemini API 오류
CODEBLOCK14
Notion 연결 오류
CODEBLOCK15
의존성
- - Python 3.11+
- Gemini API
- Notion API (선택)
- Tistory API (선택)
- BeautifulSoup4
- Requests
API 키 발급
Gemini API
- 1. https://makersuite.google.com/app/apikey 접속
- API 키 생성
- 키 복사
Notion API (선택)
- 1. https://www.notion.so/my-integrations 접속
- 새 통합 생성
- API 키 복사
- 데이터베이스에 통합 연결
Tistory API (선택)
- 1. https://www.tistory.com/guide/api/register 접속
- 앱 등록
- Access Token 발급
라이선스
MIT License
참고
- - 저장소: https://github.com/rebugui/securitynewsaggregator
- 메인 저장소: https://github.com/rebugui/OpenClaw
Security News Module
概述
这是一个从11个韩国安全新闻源自动收集新闻,使用Gemini API进行摘要,然后发布到Notion和Tistory的模块。
周期:每小时自动执行
工作流程
并行爬取11个安全新闻源
├─ KRCERT(韩国互联网振兴院)
├─ NCSC(国家网络安全中心)
├─ Boho(保护国家)
├─ Dailysec
├─ KISA
├─ K-shield
├─ KrCert
├─ Notice
├─ Boho2
├─ Krcert2
└─ Ncsc2
↓
基于关键词过滤(安全相关关键词)
↓
Gemini API摘要(140字摘要 + 详细分析)
↓
Notion数据库存储
↓
Tistory博客发布(可选)
主要功能
1. 新闻收集(Collection)
11个韩国安全新闻源:
| 源 | URL | 类型 |
|---|
| KRCERT | https://www.krcert.or.kr | 官方 |
| NCSC |
https://www.ncsc.go.kr | 官方 |
| Boho | https://www.boho.or.kr | 官方 |
| Dailysec | https://dailysecu.com | 民间 |
| KISA | https://www.kisa.or.kr | 官方 |
| K-shield | https://k-shield.or.kr | 官方 |
| KrCert | https://krcert.or.kr | 官方 |
| Notice | 内部源 | 内部 |
| Boho2 | https://boho.or.kr | 官方 |
| Krcert2 | https://www.krcert.or.kr | 官方 |
| Ncsc2 | https://ncsc.go.kr | 官方 |
2. 关键词过滤(Filtering)
安全相关关键词:
python
keywords = [
漏洞, 恶意代码, 黑客, 勒索软件,
安全, 入侵, 攻击, 加密,
认证, 防火墙, 恶意, 钓鱼,
间谍软件, 特洛伊木马, 僵尸网络
]
3. Gemini API摘要(Summarization)
摘要结构:
[140字摘要]
[详细分析]
4. Notion发布(Notion Publishing)
- - 自动保存:自动保存收集的新闻
- 标签分类:基于关键词的自动标签
- 状态管理:New → Read → Archived
5. Tistory发布(Tistory Publishing)
- - 选择性发布:仅发布重要新闻
- 自动格式化:Markdown → HTML转换
- 分类管理:自动分配分类
安装方法
1. 克隆仓库
bash
git clone --recursive https://github.com/rebugui/OpenClaw.git
cd OpenClaw/submodules/security
newsaggregator
2. 安装依赖
bash
pip install -r requirements.txt
3. 设置环境变量
bash
cp .env.example .env
修改.env文件:
bash
Gemini API
GEMINI
APIKEY=your
geminiapi_key
Notion API(可选)
NOTION
APIKEY=your
notionapi_key
NOTION
DATABASEID=your
databaseid
Tistory API(可选)
TISTORY
ACCESSTOKEN=your
accesstoken
TISTORY
BLOGNAME=your
blogname
使用方法
手动执行
bash
单次执行
python security
newsaggregator.py --once
守护模式(持续执行)
python security
newsaggregator.py
仅收集特定源
python security
newsaggregator.py --sources krcert,ncsc
注册调度器
注册到OpenClaw调度器以自动执行:
yaml
config.yaml
jobs:
- id: security
newsaggregator
name: Security News Aggregator - 每1小时收集安全新闻
enabled: true
module: security
newsaggregator.security
newsaggregator
function: main
is_async: false
working
dir: submodules/securitynews_aggregator
trigger:
type: interval
hours: 1
配置文件
config.py
python
新闻源设置
NEWS_SOURCES = {
krcert: {
url: https://www.krcert.or.kr,
type: rss,
enabled: True
},
ncsc: {
url: https://www.ncsc.go.kr,
type: web,
enabled: True
},
# ...
}
关键词过滤
KEYWORDS = [
漏洞, 恶意代码, 黑客, 勒索软件,
安全, 入侵, 攻击, 加密
]
Gemini设置
GEMINI_MODEL = gemini-2.0-flash-exp
GEMINI
MAXTOKENS = 1000
GEMINI_TEMPERATURE = 0.7
Notion设置
NOTION_ENABLED = True
NOTION
DATABASEID = your
databaseid
Tistory设置
TISTORY_ENABLED = False
TISTORY
BLOGNAME = your
blogname
文件结构
securitynewsaggregator/
├── securitynewsaggregator.py # 主执行文件
├── config.py # 配置文件
├── .env.example # 环境变量示例
├── requirements.txt # 依赖
│
├── modules/ # 功能模块
│ ├── collectors/ # 新闻收集器
│ │ ├── krcert_collector.py
│ │ ├── ncsc_collector.py
│ │ └── ...
│ ├── summarizer.py # Gemini摘要
│ ├── notion_publisher.py # Notion发布
│ └── tistory_publisher.py # Tistory发布
│
├── data/ # 数据存储
│ └── news_cache.json
│
└── logs/ # 日志
└── aggregator.log
Notion数据库设置
字段构成
- - Title(标题)
- Summary(140字摘要)
- Content(详细分析)
- Source(来源)
- URL(原文链接)
- Tags(多选)
- Published(发布日期)
- Status(选择:New, Read, Archived)
示例输出
收集的新闻
markdown
新型勒索软件攻击韩国企业
摘要:新型勒索软件变种开始针对韩国企业发起攻击...
详细分析:
- - 背景:近期勒索软件攻击不断增加...
- 主要内容:该勒索软件...
- 启示:企业需要加强安全防护...
- 应对方案:定期备份、安全补丁...
标签:#勒索软件 #韩国 #企业攻击
来源:KRCERT
原文:https://www.krcert.or.kr/...
执行统计
最近执行结果(2026-03-08 11:58)
✅ 收集新闻:169条
✅ URL转换完成:137条
✅ 基于关键词过滤:处理169条
✅ Gemini摘要完成
✅ Notion存储完成
问题解决
新闻收集失败
bash
查看日志
tail -f logs/aggregator.log
测试特定源
python security
newsaggregator.py --test krcert
Gemini API错误
bash
检查API密钥
echo $GEMINI
APIKEY
检查API配额
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp?key=$GEMINI
APIKEY
Notion连接错误
bash
检查Notion API密钥
curl -X POST https://api.notion.com/v1/databases/{database_id}/query \
-H Authorization: Bearer {token} \
-H Notion-Version: 2022-06-28
依赖
- - Python 3.11+
- Gemini API
- Notion API(可选)
- Tistory API(可选)
- BeautifulSoup4
- Requests
API密钥申请
Gemini API
- 1. 访问 https://makersuite.google.com/app/apikey
- 创建API密钥
- 复制密钥
Notion API(可选)
- 1. 访问 https://www.notion.so/my-integrations
- 创建新集成
- 复制API