mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 19:59:54 +08:00
feat: RSS of cve.mitre.org (#4599)
This commit is contained in:
@@ -4,6 +4,12 @@ pageClass: routes
|
||||
|
||||
# Programming
|
||||
|
||||
## cve.mitre.org
|
||||
|
||||
### Search Result
|
||||
|
||||
<Route author="fengkx" example="/cve/search/PostgreSQL" path="/cve/search/:keyword" :paramsDesc="['keyword'] >
|
||||
|
||||
## GitHub
|
||||
|
||||
::: tip
|
||||
|
||||
@@ -18,6 +18,12 @@ pageClass: routes
|
||||
|
||||
> AlgoCasts 需要付费订阅, RSS 仅做更新提醒, 不含付费内容.
|
||||
|
||||
## cve.mitre.org
|
||||
|
||||
### 搜索结果
|
||||
|
||||
<Route author="fengkx" example="/cve/search/PostgreSQL" path="/cve/search/:keyword" :paramsDesc="['关键词'] >
|
||||
|
||||
## Dockone
|
||||
|
||||
### 周报
|
||||
|
||||
@@ -2607,4 +2607,7 @@ router.get('/unit-image/films/:type?', require('./routes/unit-image/films'));
|
||||
// digic-picture
|
||||
router.get('/digic-pictures/:menu/:tags?', require('./routes/digic-pictures/index'));
|
||||
|
||||
// cve.mitre.org
|
||||
router.get('/cve/search/:keyword', require('./routes/cve/search'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
26
lib/routes/cve/search.js
Normal file
26
lib/routes/cve/search.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
const { keyword } = ctx.params;
|
||||
const link = `https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=${keyword}`;
|
||||
const body = await got(link).text();
|
||||
const $ = cheerio.load(body);
|
||||
const rows = $('#TableWithRules').find('tbody').first().find('tr').get().slice(0, 10);
|
||||
const item = rows.map((row) => {
|
||||
const [cveName, description] = $(row).find('td').get().map($);
|
||||
return {
|
||||
title: cveName.text(),
|
||||
link: 'https://cve.mitre.org' + cveName.find('a').first().attr('href'),
|
||||
description: description.text(),
|
||||
guid: this.link,
|
||||
};
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `CVE search result ${keyword}`,
|
||||
link,
|
||||
description: this.title,
|
||||
item,
|
||||
};
|
||||
await next();
|
||||
};
|
||||
Reference in New Issue
Block a user