parent
527f44a565
commit
d6805e5dff
|
|
@ -1010,7 +1010,7 @@ router.get('/project-zero-issues', lazyloadRouteHandler('./routes/project-zero-i
|
|||
router.get('/galaxylab', lazyloadRouteHandler('./routes/galaxylab/index'));
|
||||
|
||||
// NOSEC 安全讯息平台
|
||||
router.get('/nosec/:keykind?', lazyloadRouteHandler('./routes/nosec/index'));
|
||||
// router.get('/nosec/:keykind?', lazyloadRouteHandler('./routes/nosec/index'));
|
||||
|
||||
// discuz
|
||||
// router.get('/discuz/:ver([7|x])/:cid([0-9]{2})/:link(.*)', lazyloadRouteHandler('./routes/discuz/discuz'));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
const baseUrl = 'https://nosec.org/home/ajaxindexdata';
|
||||
const keykinds = {
|
||||
|
|
@ -12,15 +13,34 @@ const keykinds = {
|
|||
tool: '安全工具',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
export const route: Route = {
|
||||
path: '/:keykind?',
|
||||
categories: ['programming'],
|
||||
example: '/nosec/hole',
|
||||
parameters: { keykind: '对应文章分类' },
|
||||
name: 'Posts',
|
||||
maintainers: ['hellodword'],
|
||||
description: ` | 分类 | 标识 |
|
||||
| :------- | :--------- |
|
||||
| 威胁情报 | \`threaten\` |
|
||||
| 安全动态 | \`security\` |
|
||||
| 漏洞预警 | \`hole\` |
|
||||
| 数据泄露 | \`leakage\` |
|
||||
| 专题报告 | \`speech\` |
|
||||
| 技术分析 | \`skill\` |
|
||||
| 安全工具 | \`tool\` |`,
|
||||
handler,
|
||||
};
|
||||
|
||||
async function handler(ctx) {
|
||||
const csrfresponse = await got.get('https://nosec.org/home/index');
|
||||
const $ = cheerio.load(csrfresponse.data);
|
||||
const $ = load(csrfresponse.data);
|
||||
const token = $('meta[name="csrf-token"]').attr('content');
|
||||
const cookies = csrfresponse.headers['set-cookie'].toString();
|
||||
const xsrf_token = cookies.match(/XSRF-TOKEN=[^\s;]+/)[0];
|
||||
const laravel_session = cookies.match(/laravel_session[^\s;]+/)[0];
|
||||
|
||||
const keykind = ctx.params.keykind || '';
|
||||
const keykind = ctx.req.param('keykind') || '';
|
||||
let formdata;
|
||||
let title;
|
||||
let link;
|
||||
|
|
@ -50,7 +70,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const data = response.data.data.threatData.data;
|
||||
|
||||
ctx.state.data = {
|
||||
return {
|
||||
// 源标题
|
||||
title,
|
||||
// 源链接
|
||||
|
|
@ -70,4 +90,4 @@ module.exports = async (ctx) => {
|
|||
author: item.username,
|
||||
})),
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'NOSEC.org',
|
||||
url: 'nosec.org',
|
||||
};
|
||||
Loading…
Reference in New Issue