增加:安全客 相关漏洞cve,安全资讯 (#998)

- 最新漏洞cve报告
- 360网络安全周报订阅
- 其他内容分类订阅
This commit is contained in:
Shadow 2018-10-30 21:42:19 +08:00 committed by DIYgod
parent b355a3e857
commit 280a90b5c0
4 changed files with 83 additions and 0 deletions

View File

@ -630,6 +630,24 @@ GitHub 官方也提供了一些 RSS:
> 极客时间专栏需要付费订阅, RSS 仅做更新提醒, 不含付费内容.
### 安全客
::: tip 提示
官方提供了混合的主页资讯 RSS: https://api.anquanke.com/data/v1/rss
:::
<route name="最新漏洞列表" author="qwertyuiop6" example="/aqk/vul" path="/aqk/vul"/>
<route name="分类订阅" author="qwertyuiop6" example="/aqk/week" path="/aqk/:category" :paramsDesc="['分类订阅']">
| 360 网络安全周报 | 活动 |  知识  |  资讯  |  招聘  |
| ---------------- | -------- | --------- | -------- | -------- |
| week | activity | knowledge | news | job |
</route>
### LinkedKeeper
<route name="博文" author="imlonghao" example="/linkedkeeper/sub/1" path="/linkedkeeper/:type/:id?" :paramsDesc="['博文分类, 为 URL 中 `.action` 的文件名', '分区或标签的 ID, 对应 URL 中的 `sid``tid`']"/>

View File

@ -428,6 +428,10 @@ router.get('/linkedkeeper/:type/:id?', require('./routes/linkedkeeper/index'));
// 开源中国
router.get('/oschina/news', require('./routes/oschina/news'));
// 安全客
router.get('/aqk/vul', require('./routes/aqk/vul'));
router.get('/aqk/:category', require('./routes/aqk/category'));
// 腾讯大家
router.get('/dajia', require('./routes/tencent/dajia/index'));

22
routes/aqk/category.js Normal file
View File

@ -0,0 +1,22 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const api = 'https://api.anquanke.com/data/v1/posts?size=10&page=1&category=';
const type = ctx.params.category;
const host = 'https://www.anquanke.com';
const res = await axios.get(`${api}${type}`);
const dataArray = res.data.data;
const items = dataArray.map((item) => ({
title: item.title,
description: item.desc,
pubDate: item.date,
link: `${host}/${type === 'week' ? 'week' : 'post'}/id/${item.id}`,
}));
ctx.state.data = {
title: `安全客-${dataArray[0].category_name}`,
link: 'https://www.anquanke.com',
item: items,
};
};

39
routes/aqk/vul.js Normal file
View File

@ -0,0 +1,39 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'https://www.anquanke.com';
const response = await axios.get(`${url}/vul`);
const $ = cheerio.load(response.data);
const list = $('table>tbody>tr').get();
const items = list.map((i) => {
const item = $(i);
const title = item.find('td:first-child a').text();
const cve = item.find('td:nth-child(2)').text();
const pla = item
.find('.vul-type-item')
.text()
.replace(/\s+/g, '');
const date = item
.find('td:nth-last-child(2)')
.text()
.replace(/\s+/g, '');
const href = item.find('a').attr('href');
return {
title: `${title}${cve}${pla !== '未知' ? pla : ''}`,
description: `编号:${cve} | 平台:${pla}`,
pubDate: date,
link: `${url}${href}`,
};
});
ctx.state.data = {
title: '安全客-漏洞cve报告',
link: 'https://www.anquanke.com/vul',
item: items,
};
};