Skip to content

Commit

Permalink
feat: opt chaitin valuable
Browse files Browse the repository at this point in the history
  • Loading branch information
zema1 committed Nov 1, 2024
1 parent 5a60adf commit ab048cc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 名称 | 地址 | 推送策略 |
|----------------------------|-------------------------------------------------------------------------------------------------|--------------------------------------------------|
| 阿里云漏洞库 | https://avd.aliyun.com/high-risk/list | 等级为高危或严重 |
| 长亭漏洞库 | https://stack.chaitin.com/vuldb/index | 等级为高危或严重 |
| 长亭漏洞库 | https://stack.chaitin.com/vuldb/index | 等级为高危或严重**并且**标题含中文 |
| OSCS开源安全情报预警 | https://www.oscs1024.com/cm | 等级为高危或严重**并且**包含 `预警` 标签 |
| 奇安信威胁情报中心 | https://ti.qianxin.com/ | 等级为高危严重**并且**包含 `奇安信CERT验证` `POC公开` `技术细节公布`标签之一 |
| 微步在线研究响应中心(公众号) | https://x.threatbook.com/v5/vulIntelligence | 等级为高危或严重 |
Expand Down
14 changes: 14 additions & 0 deletions grab/chaitin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/zema1/watchvuln/util"
"strings"
"time"
"unicode"

"github.com/imroc/req/v3"
"github.com/kataras/golog"
Expand Down Expand Up @@ -96,6 +97,10 @@ func (t *ChaitinCrawler) IsValuable(info *VulnInfo) bool {
if info.Severity != High && info.Severity != Critical {
return false
}

if !ContainsChinese(info.Title) {
return false
}
return true
}

Expand All @@ -120,3 +125,12 @@ type ChaitinResp struct {
} `json:"data"`
Code int `json:"code"`
}

func ContainsChinese(s string) bool {
for _, r := range s {
if unicode.Is(unicode.Han, r) {
return true
}
}
return false
}
7 changes: 7 additions & 0 deletions grab/chaitin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ func TestChaitin(t *testing.T) {
}
assert.Equal(count, 45)
}

func TestChineseCharacter(t *testing.T) {
assert := require.New(t)
assert.False(ContainsChinese("hello"))
assert.False(ContainsChinese("CVE-2023-0101"))
assert.True(ContainsChinese("CyberPanel upgrademysqlstatus 远程命令执行漏洞"))
}

0 comments on commit ab048cc

Please sign in to comment.