Elffuss BraidHub

kikocis/osiris public

master · 2.1 KiBRawPermalink
1import { NextResponse } from 'next/server';
2
3// Cyber threat intelligence from public feeds
4// Inspired by WorldMonitor's infrastructure tracking
5
6export async function GET() {
7 try {
8 const results: any = { threats: [], stats: {}, timestamp: new Date().toISOString() };
9
10 // 1. CISA Known Exploited Vulnerabilities (authoritative US govt source)
11 try {
12 const res = await fetch('https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json', {
13
14 });
15 if (res.ok) {
16 const data = await res.json();
17 const recent = (data.vulnerabilities || [])
18 .filter((v: any) => {
19 const added = new Date(v.dateAdded);
20 const daysAgo = (Date.now() - added.getTime()) / (1000 * 60 * 60 * 24);
21 return daysAgo <= 30;
22 })
23 .slice(0, 10)
24 .map((v: any) => ({
25 id: v.cveID,
26 name: v.vulnerabilityName,
27 vendor: v.vendorProject,
28 product: v.product,
29 severity: 'CRITICAL',
30 date: v.dateAdded,
31 due: v.dueDate,
32 source: 'CISA KEV',
33 }));
34 results.threats.push(...recent);
35 results.stats.cisa_total = data.vulnerabilities?.length || 0;
36 }
37 } catch (e) { console.warn('[OSIRIS] Suppressed error:', e instanceof Error ? e.message : e); }
38
39 // 2. Shadowserver honeypot stats (global attack surface)
40 try {
41 const res = await fetch('https://dashboard.shadowserver.org/statistics/combined/map/', {
42
43 headers: { 'Accept': 'application/json' },
44 });
45 if (res.ok) {
46 results.stats.shadowserver = 'active';
47 }
48 } catch {
49 results.stats.shadowserver = 'unavailable';
50 }
51
52 // 3. Aggregate stats
53 results.stats.active_cves = results.threats.length;
54 results.stats.threat_level = results.threats.length >= 8 ? 'CRITICAL' : results.threats.length >= 4 ? 'HIGH' : 'ELEVATED';
55
56 return NextResponse.json(results);
57 } catch {
58 return NextResponse.json({ threats: [], stats: {}, error: 'Failed' }, { status: 500 });
59 }
60}