oculon 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -3
- package/dist/cli/main.js +195 -0
- package/dist/core/http.js +4 -0
- package/dist/core/quota.js +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +43 -0
- package/dist/mcp.js +51 -2
- package/dist/modules/breach.d.ts +53 -0
- package/dist/modules/breach.js +98 -0
- package/dist/modules/company.d.ts +53 -0
- package/dist/modules/company.js +149 -0
- package/dist/modules/hashcheck.d.ts +29 -0
- package/dist/modules/hashcheck.js +82 -0
- package/dist/modules/ipintel.d.ts +52 -0
- package/dist/modules/ipintel.js +149 -0
- package/dist/modules/phone.d.ts +32 -0
- package/dist/modules/phone.js +148 -0
- package/dist/modules/ransomware.d.ts +56 -0
- package/dist/modules/ransomware.js +85 -0
- package/dist/modules/satellites.d.ts +45 -0
- package/dist/modules/satellites.js +113 -0
- package/dist/sources/threatintel.d.ts +151 -0
- package/dist/sources/threatintel.js +256 -0
- package/dist/telegram.js +55 -5
- package/dist/web/index.html +70 -3
- package/dist/web/insights.js +2 -0
- package/dist/web/openapi.js +7 -0
- package/dist/web/public.js +9 -1
- package/dist/web/server.js +32 -1
- package/package.json +2 -2
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threat intelligence sources for IP addresses and file hashes.
|
|
3
|
+
* Keyless: ip-api.com (location, proxy and hosting flags), GreyNoise Community (internet scanners),
|
|
4
|
+
* the Tor Project exit list, Spamhaus DROP (hijacked and criminal networks), PeeringDB (network type),
|
|
5
|
+
* Shodan InternetDB (open ports), CIRCL hashlookup (known files).
|
|
6
|
+
* Free keys: AbuseIPDB (ABUSEIPDB_API_KEY), AlienVault OTX (OTX_API_KEY), IPinfo Lite (IPINFO_TOKEN),
|
|
7
|
+
* VirusTotal (VIRUSTOTAL_API_KEY, non-commercial use), MalwareBazaar and ThreatFox (ABUSECH_AUTH_KEY).
|
|
8
|
+
* A missing key only turns that one source off.
|
|
9
|
+
*/
|
|
10
|
+
import { isIP } from 'node:net';
|
|
11
|
+
import { key, noKey } from '../core/keys.js';
|
|
12
|
+
const nowIso = () => new Date().toISOString();
|
|
13
|
+
/** POST with a response cache keyed by URL and body (abuse.ch answers lookups only over POST). */
|
|
14
|
+
export async function postCached(ctx, url, body, contentType, headers, source, ttlSec) {
|
|
15
|
+
const cacheKey = `post:${url}:${body}`;
|
|
16
|
+
const cached = ctx.store.cacheGet(cacheKey);
|
|
17
|
+
if (cached && Date.now() - cached.fetchedAt < ttlSec * 1000) {
|
|
18
|
+
try {
|
|
19
|
+
return { data: JSON.parse(cached.body), prov: { source, url, status: 'CACHED', fetchedAt: new Date(cached.fetchedAt).toISOString() } };
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
}
|
|
23
|
+
const r = await ctx.http.postBytes(url, new TextEncoder().encode(body), { source, headers: { 'content-type': contentType, ...headers }, timeoutMs: 25_000 });
|
|
24
|
+
if (!r.data)
|
|
25
|
+
return { data: null, prov: r.prov };
|
|
26
|
+
try {
|
|
27
|
+
const text = r.data.toString('utf8');
|
|
28
|
+
const data = JSON.parse(text);
|
|
29
|
+
ctx.store.cachePut(cacheKey, text);
|
|
30
|
+
return { data, prov: r.prov };
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return { data: null, prov: { ...r.prov, status: 'ERROR', note: 'invalid JSON' } };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/* ---------- address helpers ---------- */
|
|
37
|
+
/** IPv4 or IPv6 as a BigInt plus its bit length, for CIDR matching. */
|
|
38
|
+
export function ipToBig(ip) {
|
|
39
|
+
const fam = isIP(ip);
|
|
40
|
+
if (fam === 4) {
|
|
41
|
+
const p = ip.split('.').map(Number);
|
|
42
|
+
return { v: BigInt(((p[0] << 24) >>> 0) + (p[1] << 16) + (p[2] << 8) + p[3]), bits: 32 };
|
|
43
|
+
}
|
|
44
|
+
if (fam === 6) {
|
|
45
|
+
let s = ip.toLowerCase();
|
|
46
|
+
const v4 = /(\d+\.\d+\.\d+\.\d+)$/.exec(s);
|
|
47
|
+
if (v4) {
|
|
48
|
+
const b = ipToBig(v4[1]);
|
|
49
|
+
if (!b)
|
|
50
|
+
return null;
|
|
51
|
+
s = s.replace(v4[1], `${(b.v >> 16n).toString(16)}:${(b.v & 0xffffn).toString(16)}`);
|
|
52
|
+
}
|
|
53
|
+
const [head, tail] = s.split('::');
|
|
54
|
+
const h = head ? head.split(':') : [];
|
|
55
|
+
const t = tail !== undefined ? (tail ? tail.split(':') : []) : [];
|
|
56
|
+
const groups = tail !== undefined ? [...h, ...Array(8 - h.length - t.length).fill('0'), ...t] : h;
|
|
57
|
+
if (groups.length !== 8)
|
|
58
|
+
return null;
|
|
59
|
+
let v = 0n;
|
|
60
|
+
for (const g of groups)
|
|
61
|
+
v = (v << 16n) + BigInt(parseInt(g || '0', 16));
|
|
62
|
+
return { v, bits: 128 };
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
export function inCidr(ip, cidr) {
|
|
67
|
+
const [net, lenS] = cidr.split('/');
|
|
68
|
+
const a = ipToBig(ip);
|
|
69
|
+
const b = ipToBig(net);
|
|
70
|
+
if (!a || !b || a.bits !== b.bits)
|
|
71
|
+
return false;
|
|
72
|
+
const len = lenS === undefined ? a.bits : Number(lenS);
|
|
73
|
+
if (!Number.isInteger(len) || len < 0 || len > a.bits)
|
|
74
|
+
return false;
|
|
75
|
+
const shift = BigInt(a.bits - len);
|
|
76
|
+
return a.v >> shift === b.v >> shift;
|
|
77
|
+
}
|
|
78
|
+
const PRIVATE_RANGES = ['0.0.0.0/8', '10.0.0.0/8', '100.64.0.0/10', '127.0.0.0/8', '169.254.0.0/16', '172.16.0.0/12', '192.0.0.0/24', '192.0.2.0/24', '192.168.0.0/16', '198.18.0.0/15', '198.51.100.0/24', '203.0.113.0/24', '224.0.0.0/3', '::/127', '::ffff:0:0/96', '64:ff9b:1::/48', '100::/64', '2001:db8::/32', 'fc00::/7', 'fe80::/10', 'ff00::/8'];
|
|
79
|
+
/** Private, loopback, documentation, multicast and other addresses that are not on the public internet. */
|
|
80
|
+
export function isPublicIp(ip) {
|
|
81
|
+
if (!isIP(ip))
|
|
82
|
+
return false;
|
|
83
|
+
return !PRIVATE_RANGES.some((r) => inCidr(ip, r));
|
|
84
|
+
}
|
|
85
|
+
export async function ipApi(ctx, ip) {
|
|
86
|
+
// The free endpoint is HTTP only and allows 45 requests a minute, non-commercial use.
|
|
87
|
+
const r = await ctx.http.get(`http://ip-api.com/json/${encodeURIComponent(ip)}?fields=status,message,country,countryCode,regionName,city,lat,lon,isp,org,as,reverse,mobile,proxy,hosting`, { source: 'ip-api', ttlSec: 12 * 3600 });
|
|
88
|
+
const d = r.data;
|
|
89
|
+
if (!d || d.status !== 'success')
|
|
90
|
+
return { data: null, prov: d ? { ...r.prov, status: 'ERROR', note: String(d.message ?? 'lookup failed') } : r.prov };
|
|
91
|
+
const s = (k) => (typeof d[k] === 'string' && d[k] ? d[k] : null);
|
|
92
|
+
const n = (k) => (typeof d[k] === 'number' ? d[k] : null);
|
|
93
|
+
return { data: { country: s('country'), countryCode: s('countryCode'), region: s('regionName'), city: s('city'), lat: n('lat'), lon: n('lon'), isp: s('isp'), org: s('org'), as: s('as'), reverse: s('reverse'), mobile: d.mobile === true, proxy: d.proxy === true, hosting: d.hosting === true }, prov: r.prov };
|
|
94
|
+
}
|
|
95
|
+
export async function greyNoise(ctx, ip) {
|
|
96
|
+
const url = `https://api.greynoise.io/v3/community/${encodeURIComponent(ip)}`;
|
|
97
|
+
const r = await ctx.http.get(url, { source: 'greynoise', ttlSec: 12 * 3600, retries: 1 });
|
|
98
|
+
// GreyNoise answers 404 for an address it has never seen scanning: that is a result, not an outage.
|
|
99
|
+
if (!r.data && r.prov.note === 'HTTP 404')
|
|
100
|
+
return { data: { observed: false, noise: false, riot: false, classification: null, name: null, lastSeen: null, link: null }, prov: { ...r.prov, status: 'LIVE', note: 'not observed scanning the internet' } };
|
|
101
|
+
const d = r.data;
|
|
102
|
+
if (!d)
|
|
103
|
+
return { data: null, prov: r.prov };
|
|
104
|
+
return { data: { observed: d.noise === true || d.riot === true, noise: d.noise === true, riot: d.riot === true, classification: typeof d.classification === 'string' ? d.classification : null, name: typeof d.name === 'string' && d.name !== 'unknown' ? d.name : null, lastSeen: typeof d.last_seen === 'string' ? d.last_seen : null, link: typeof d.link === 'string' ? d.link : null }, prov: r.prov };
|
|
105
|
+
}
|
|
106
|
+
export async function torExits(ctx) {
|
|
107
|
+
const r = await ctx.http.get('https://check.torproject.org/torbulkexitlist', { source: 'tor-exits', as: 'text', ttlSec: 3600 });
|
|
108
|
+
return { data: r.data ? new Set(r.data.split(/\s+/).filter(Boolean)) : null, prov: r.prov };
|
|
109
|
+
}
|
|
110
|
+
const ndjson = (text) => (text ?? '').split('\n').map((l) => { try {
|
|
111
|
+
return JSON.parse(l);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
} }).filter((x) => x !== null);
|
|
116
|
+
export async function spamhausDrop(ctx) {
|
|
117
|
+
const [v4, v6, asn] = await Promise.all(['drop_v4.json', 'drop_v6.json', 'asndrop.json'].map((f) => ctx.http.get(`https://www.spamhaus.org/drop/${f}`, { source: 'spamhaus-drop', as: 'text', ttlSec: 12 * 3600 })));
|
|
118
|
+
const prov = [v4.prov, v6.prov, asn.prov];
|
|
119
|
+
if (!v4.data && !v6.data && !asn.data)
|
|
120
|
+
return { data: null, prov };
|
|
121
|
+
const cidrs = [...ndjson(v4.data), ...ndjson(v6.data)].filter((x) => x.cidr).map((x) => ({ cidr: x.cidr, id: x.sblid ?? '' }));
|
|
122
|
+
const asns = ndjson(asn.data).filter((x) => typeof x.asn === 'number').map((x) => ({ asn: x.asn, name: x.asname ?? '' }));
|
|
123
|
+
return { data: { cidrs, asns }, prov };
|
|
124
|
+
}
|
|
125
|
+
export async function peeringDb(ctx, asn) {
|
|
126
|
+
const r = await ctx.http.get(`https://www.peeringdb.com/api/net?asn=${asn}`, { source: 'peeringdb', ttlSec: 7 * 86_400, retries: 1, keep: (d) => ({ data: (d.data ?? []).slice(0, 1) }) });
|
|
127
|
+
const n = r.data?.data?.[0];
|
|
128
|
+
return { data: n?.name ? { name: n.name, type: n.info_type || null, website: n.website || null, policy: n.policy_general || null } : null, prov: r.prov };
|
|
129
|
+
}
|
|
130
|
+
export async function internetDb(ctx, ip) {
|
|
131
|
+
const r = await ctx.http.get(`https://internetdb.shodan.io/${encodeURIComponent(ip)}`, { source: 'shodan-internetdb', ttlSec: 12 * 3600, retries: 1 });
|
|
132
|
+
// 404 here means "no open ports seen", which is a result.
|
|
133
|
+
if (!r.data && r.prov.note === 'HTTP 404')
|
|
134
|
+
return { data: { ports: [], vulns: [], hostnames: [], tags: [] }, prov: { ...r.prov, status: 'LIVE', note: 'no open ports seen' } };
|
|
135
|
+
const d = r.data;
|
|
136
|
+
return { data: d ? { ports: d.ports ?? [], vulns: d.vulns ?? [], hostnames: d.hostnames ?? [], tags: d.tags ?? [] } : null, prov: r.prov };
|
|
137
|
+
}
|
|
138
|
+
export async function abuseIpDb(ctx, ip) {
|
|
139
|
+
const k = key('ABUSEIPDB_API_KEY');
|
|
140
|
+
if (!k)
|
|
141
|
+
return noKey('abuseipdb', 'ABUSEIPDB_API_KEY');
|
|
142
|
+
const r = await ctx.http.get(`https://api.abuseipdb.com/api/v2/check?ipAddress=${encodeURIComponent(ip)}&maxAgeInDays=90`, { source: 'abuseipdb', ttlSec: 6 * 3600, retries: 1, headers: { Key: k } });
|
|
143
|
+
const d = r.data?.data;
|
|
144
|
+
if (!d)
|
|
145
|
+
return { data: null, prov: r.prov };
|
|
146
|
+
const s = (x) => (typeof x === 'string' && x ? x : null);
|
|
147
|
+
return { data: { score: Number(d.abuseConfidenceScore ?? 0), reports: Number(d.totalReports ?? 0), reporters: Number(d.numDistinctUsers ?? 0), lastReported: s(d.lastReportedAt), usageType: s(d.usageType), isp: s(d.isp), domain: s(d.domain), countryCode: s(d.countryCode), isTor: d.isTor === true, whitelisted: d.isWhitelisted === true }, prov: r.prov };
|
|
148
|
+
}
|
|
149
|
+
/** AlienVault OTX community threat reports ("pulses") that mention an IP, domain or file hash. */
|
|
150
|
+
export async function otx(ctx, type, value) {
|
|
151
|
+
const k = key('OTX_API_KEY');
|
|
152
|
+
if (!k)
|
|
153
|
+
return noKey('otx', 'OTX_API_KEY');
|
|
154
|
+
const r = await ctx.http.get(`https://otx.alienvault.com/api/v1/indicators/${type}/${encodeURIComponent(value)}/general`, {
|
|
155
|
+
source: 'otx',
|
|
156
|
+
ttlSec: 6 * 3600,
|
|
157
|
+
timeoutMs: 25_000,
|
|
158
|
+
retries: 1,
|
|
159
|
+
headers: { 'X-OTX-API-KEY': k },
|
|
160
|
+
keep: (d) => ({ pulse_info: { count: d.pulse_info?.count ?? 0, pulses: (d.pulse_info?.pulses ?? []).slice(0, 6).map((p) => ({ id: p.id, name: p.name, created: p.created, tags: (p.tags ?? []).slice(0, 6) })), related: d.pulse_info?.related }, validation: (d.validation ?? []).slice(0, 3) }),
|
|
161
|
+
});
|
|
162
|
+
if (!r.data)
|
|
163
|
+
return { data: null, prov: r.prov };
|
|
164
|
+
const pi = r.data.pulse_info ?? {};
|
|
165
|
+
const fam = [...(pi.related?.alienvault?.malware_families ?? []), ...(pi.related?.other?.malware_families ?? [])];
|
|
166
|
+
return {
|
|
167
|
+
data: {
|
|
168
|
+
count: pi.count ?? 0,
|
|
169
|
+
pulses: (pi.pulses ?? []).filter((p) => p.name).map((p) => ({ name: p.name, created: p.created ?? null, tags: p.tags ?? [], url: `https://otx.alienvault.com/pulse/${p.id ?? ''}` })),
|
|
170
|
+
whitelisted: (r.data.validation ?? []).some((v) => /whitelist|alexa|majestic|akamai|false_positive/i.test(`${v.source ?? ''} ${v.name ?? ''}`)),
|
|
171
|
+
family: [...new Set(fam.map((f) => String(f)))].slice(0, 6),
|
|
172
|
+
},
|
|
173
|
+
prov: r.prov,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export async function ipInfo(ctx, ip) {
|
|
177
|
+
const k = key('IPINFO_TOKEN');
|
|
178
|
+
if (!k)
|
|
179
|
+
return noKey('ipinfo', 'IPINFO_TOKEN');
|
|
180
|
+
const r = await ctx.http.get(`https://api.ipinfo.io/lite/${encodeURIComponent(ip)}?token=${encodeURIComponent(k)}`, { source: 'ipinfo', ttlSec: 24 * 3600, retries: 1 });
|
|
181
|
+
const d = r.data;
|
|
182
|
+
const s = (x) => (typeof x === 'string' && x ? x : null);
|
|
183
|
+
return { data: d ? { asn: s(d.asn), asName: s(d.as_name), asDomain: s(d.as_domain), country: s(d.country), countryCode: s(d.country_code) } : null, prov: r.prov };
|
|
184
|
+
}
|
|
185
|
+
/** VirusTotal verdicts for an IP address or a file hash (free public API: 4 requests a minute, 500 a day, non-commercial). */
|
|
186
|
+
export async function virusTotal(ctx, kind, value) {
|
|
187
|
+
const k = key('VIRUSTOTAL_API_KEY');
|
|
188
|
+
if (!k)
|
|
189
|
+
return noKey('virustotal', 'VIRUSTOTAL_API_KEY');
|
|
190
|
+
const path = kind === 'ip' ? `ip_addresses/${encodeURIComponent(value)}` : `files/${encodeURIComponent(value)}`;
|
|
191
|
+
const link = kind === 'ip' ? `https://www.virustotal.com/gui/ip-address/${encodeURIComponent(value)}` : `https://www.virustotal.com/gui/file/${encodeURIComponent(value)}`;
|
|
192
|
+
const r = await ctx.http.get(`https://www.virustotal.com/api/v3/${path}`, {
|
|
193
|
+
source: 'virustotal',
|
|
194
|
+
ttlSec: 12 * 3600,
|
|
195
|
+
retries: 1,
|
|
196
|
+
headers: { 'x-apikey': k },
|
|
197
|
+
keep: (d) => {
|
|
198
|
+
const a = d.data?.attributes ?? {};
|
|
199
|
+
return { data: { attributes: { last_analysis_stats: a.last_analysis_stats, reputation: a.reputation, as_owner: a.as_owner, meaningful_name: a.meaningful_name, type_description: a.type_description, size: a.size, first_submission_date: a.first_submission_date, popular_threat_classification: { suggested_threat_label: a.popular_threat_classification?.suggested_threat_label } } } };
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
if (!r.data && r.prov.note === 'HTTP 404')
|
|
203
|
+
return { data: null, prov: { ...r.prov, status: 'LIVE', note: 'not in VirusTotal' } };
|
|
204
|
+
const a = r.data?.data?.attributes;
|
|
205
|
+
if (!a)
|
|
206
|
+
return { data: null, prov: r.prov };
|
|
207
|
+
const st = a.last_analysis_stats ?? {};
|
|
208
|
+
const engines = Object.values(st).reduce((x, y) => x + (Number(y) || 0), 0);
|
|
209
|
+
return {
|
|
210
|
+
data: { malicious: st.malicious ?? 0, suspicious: st.suspicious ?? 0, harmless: st.harmless ?? 0, undetected: st.undetected ?? 0, engines, reputation: typeof a.reputation === 'number' ? a.reputation : null, label: a.popular_threat_classification?.suggested_threat_label ?? null, name: a.meaningful_name ?? null, type: a.type_description ?? null, size: a.size ?? null, firstSeen: a.first_submission_date ? new Date(a.first_submission_date * 1000).toISOString() : null, owner: a.as_owner ?? null, link },
|
|
211
|
+
prov: r.prov,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/** CIRCL hashlookup: is this a known file (NIST NSRL and other software sets), or known malware? */
|
|
215
|
+
export async function circlHash(ctx, algo, hash) {
|
|
216
|
+
const r = await ctx.http.get(`https://hashlookup.circl.lu/lookup/${algo}/${encodeURIComponent(hash)}`, { source: 'circl-hashlookup', ttlSec: 7 * 86_400, retries: 1 });
|
|
217
|
+
if (!r.data && r.prov.note === 'HTTP 404')
|
|
218
|
+
return { data: { known: false, fileName: null, size: null, sources: [], knownMalicious: null, trust: null }, prov: { ...r.prov, status: 'LIVE', note: 'hash not in the known-file sets' } };
|
|
219
|
+
const d = r.data;
|
|
220
|
+
if (!d)
|
|
221
|
+
return { data: null, prov: r.prov };
|
|
222
|
+
const src = [d.source, d['db']].filter((x) => typeof x === 'string');
|
|
223
|
+
const trust = Number(d['hashlookup:trust']);
|
|
224
|
+
return { data: { known: true, fileName: typeof d.FileName === 'string' ? d.FileName : null, size: d.FileSize != null ? Number(d.FileSize) || null : null, sources: [...new Set(src)], knownMalicious: typeof d.KnownMalicious === 'string' ? d.KnownMalicious : null, trust: Number.isFinite(trust) ? trust : null }, prov: r.prov };
|
|
225
|
+
}
|
|
226
|
+
export async function malwareBazaar(ctx, hash) {
|
|
227
|
+
const k = key('ABUSECH_AUTH_KEY');
|
|
228
|
+
if (!k)
|
|
229
|
+
return noKey('malwarebazaar', 'ABUSECH_AUTH_KEY');
|
|
230
|
+
const r = await postCached(ctx, 'https://mb-api.abuse.ch/api/v1/', new URLSearchParams({ query: 'get_info', hash }).toString(), 'application/x-www-form-urlencoded', { 'Auth-Key': k }, 'malwarebazaar', 12 * 3600);
|
|
231
|
+
if (!r.data)
|
|
232
|
+
return { data: null, prov: r.prov };
|
|
233
|
+
const x = r.data.query_status === 'ok' ? r.data.data?.[0] : undefined;
|
|
234
|
+
if (!x)
|
|
235
|
+
return { data: null, prov: { ...r.prov, note: r.data.query_status === 'hash_not_found' ? 'not a known malware sample' : r.data.query_status } };
|
|
236
|
+
const s = (v) => (typeof v === 'string' && v ? v : null);
|
|
237
|
+
const sha = s(x.sha256_hash) ?? hash;
|
|
238
|
+
return { data: { sha256: sha, fileName: s(x.file_name), fileType: s(x.file_type), signature: s(x.signature), firstSeen: s(x.first_seen), lastSeen: s(x.last_seen), tags: Array.isArray(x.tags) ? x.tags.slice(0, 8) : [], delivery: s(x.delivery_method), link: `https://bazaar.abuse.ch/sample/${encodeURIComponent(sha)}/` }, prov: r.prov };
|
|
239
|
+
}
|
|
240
|
+
/** ThreatFox indicators of compromise: an IP:port, domain or file hash used by a malware family. */
|
|
241
|
+
export async function threatFox(ctx, kind, value) {
|
|
242
|
+
const k = key('ABUSECH_AUTH_KEY');
|
|
243
|
+
if (!k)
|
|
244
|
+
return noKey('threatfox', 'ABUSECH_AUTH_KEY');
|
|
245
|
+
const body = kind === 'hash' ? { query: 'search_hash', hash: value } : { query: 'search_ioc', search_term: value, exact_match: false };
|
|
246
|
+
const r = await postCached(ctx, 'https://threatfox-api.abuse.ch/api/v1/', JSON.stringify(body), 'application/json', { 'Auth-Key': k }, 'threatfox', 6 * 3600);
|
|
247
|
+
if (!r.data)
|
|
248
|
+
return { data: null, prov: r.prov };
|
|
249
|
+
if (r.data.query_status !== 'ok' || !Array.isArray(r.data.data))
|
|
250
|
+
return { data: [], prov: { ...r.prov, note: r.data.query_status === 'no_result' ? 'no matching indicators' : r.data.query_status } };
|
|
251
|
+
return {
|
|
252
|
+
data: r.data.data.slice(0, 10).map((x) => ({ ioc: String(x.ioc ?? value), threat: typeof x.threat_type_desc === 'string' ? x.threat_type_desc : typeof x.threat_type === 'string' ? x.threat_type : null, malware: typeof x.malware_printable === 'string' ? x.malware_printable : null, confidence: x.confidence_level != null ? Number(x.confidence_level) : null, firstSeen: typeof x.first_seen === 'string' ? x.first_seen : null, link: `https://threatfox.abuse.ch/ioc/${encodeURIComponent(String(x.id ?? ''))}/` })),
|
|
253
|
+
prov: r.prov,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
export const unavailable = (source, url, note) => ({ source, url, status: 'UNAVAILABLE', fetchedAt: nowIso(), note });
|
package/dist/telegram.js
CHANGED
|
@@ -21,9 +21,9 @@ export function formatSignal(s) {
|
|
|
21
21
|
return `<b>[${Math.round(s.score)}] ${esc(s.title)}</b> <code>${esc(s.module)}</code>${ev ? `\n${ev}` : ''}`;
|
|
22
22
|
}
|
|
23
23
|
/** Commands anyone may use when the bot is public. Everything else stays with the allowlisted chats. */
|
|
24
|
-
export const PUBLIC_COMMANDS = new Set(['/start', '/help', '/scam', '/url', '/factcheck', '/recall', '/email', '/travel', '/airport', '/country', '/papers', '/audit', '/monitor', '/monitors', '/unmonitor', '/cve', '/vulns', '/hazards', '/blackout', '/cloud', '/space', '/air', '/radar', '/signals', '/alerts', '/ask']);
|
|
24
|
+
export const PUBLIC_COMMANDS = new Set(['/start', '/help', '/scam', '/url', '/factcheck', '/recall', '/email', '/travel', '/airport', '/country', '/papers', '/audit', '/monitor', '/monitors', '/unmonitor', '/cve', '/vulns', '/hazards', '/blackout', '/cloud', '/space', '/air', '/radar', '/signals', '/alerts', '/ask', '/ip', '/hash', '/ransomware', '/company', '/breaches', '/phone', '/satellite']);
|
|
25
25
|
/** Commands that start many upstream calls or an LLM get a tighter budget. */
|
|
26
|
-
const HEAVY = new Set(['/factcheck', '/papers', '/travel', '/country', '/ask', '/scam', '/audit', '/radar']);
|
|
26
|
+
const HEAVY = new Set(['/factcheck', '/papers', '/travel', '/country', '/ask', '/scam', '/audit', '/radar', '/ip', '/hash', '/company']);
|
|
27
27
|
export const PUBLIC_HELP = [
|
|
28
28
|
'<b>Oculon</b>: check anything, every answer sourced.',
|
|
29
29
|
'',
|
|
@@ -39,7 +39,13 @@ export const PUBLIC_HELP = [
|
|
|
39
39
|
'/country <name> — country brief',
|
|
40
40
|
'/papers <topic> — research brief',
|
|
41
41
|
'/audit <npm:name@ver ...> — dependency vulnerabilities',
|
|
42
|
-
'/
|
|
42
|
+
'/phone <+number> — who is calling? premium-rate and callback-scam warnings',
|
|
43
|
+
'/company <name, LEI or EU VAT> — is this supplier real?',
|
|
44
|
+
'/breaches [domain] — newest data breaches, or one domain',
|
|
45
|
+
'/ip <address or domain> — abuse reports, scanners, Tor, threat reports',
|
|
46
|
+
'/hash <md5|sha1|sha256> — is this file known malware?',
|
|
47
|
+
'/ransomware [country, sector or name] — ransomware leak-site claims',
|
|
48
|
+
'/cve <id> · /vulns · /hazards · /blackout · /cloud · /space · /air <place> · /satellite · /radar',
|
|
43
49
|
'',
|
|
44
50
|
'/monitor <request> — watch anything, e.g. /monitor internet outages in Iran',
|
|
45
51
|
'/monitors — your monitors · /unmonitor <id> — remove one',
|
|
@@ -62,6 +68,7 @@ export const HELP = [
|
|
|
62
68
|
'/monitor <request> — watch anything in plain words, e.g. /monitor internet outages in Iran',
|
|
63
69
|
'/recall <VIN, "2018 Honda Accord" or product> — vehicle and product recalls',
|
|
64
70
|
'/email <domain> — can someone spoof email from this domain?',
|
|
71
|
+
'/phone · /company · /breaches · /ip · /hash · /ransomware · /satellite — caller, supplier, breach and threat checks',
|
|
65
72
|
'/airport <JFK|EGLL> — airport weather, delays and ground stops',
|
|
66
73
|
'/country <name> — economy, leaders, currency, travel advice, headlines',
|
|
67
74
|
'/papers <topic> — research brief: most cited and newest papers',
|
|
@@ -419,6 +426,49 @@ export class TelegramBot {
|
|
|
419
426
|
const fixes = d.fixes.slice(0, 3).map((x, i) => `${i + 1}. ${esc(x)}`).join('\n');
|
|
420
427
|
return { html: `<b>${esc(d.domain)}</b>: <b>${esc(d.verdict.toUpperCase())}</b> (score ${d.score}/100)\nSPF ${esc(d.spf.all ?? (d.spf.record ? 'present' : 'missing'))} · DMARC ${esc(d.dmarc.policy ? `p=${d.dmarc.policy}` : 'missing')} · DKIM ${d.dkim.selectorsFound.length ? 'found' : 'not found'}${fixes ? `\n\n${fixes}` : ''}` };
|
|
421
428
|
}
|
|
429
|
+
case '/ip': {
|
|
430
|
+
if (!arg)
|
|
431
|
+
return needArg('185.220.101.1');
|
|
432
|
+
const d = (await o.ipCheck(arg.split(/\s+/)[0])).result;
|
|
433
|
+
const where = d.location ? [d.location.city, d.location.country].filter(Boolean).join(', ') : '';
|
|
434
|
+
return { html: `<b>${esc(d.ip)}</b>${d.resolvedFrom ? ` (${esc(d.resolvedFrom)})` : ''}: <b>${esc(d.verdict.toUpperCase())}</b> · risk ${d.risk}/100\n${esc([d.network.asn, d.network.name].filter(Boolean).join(' '))}${where ? ` · ${esc(where)}` : ''}\n${d.reasons.map((x) => `• ${esc(x)}`).join('\n') || 'No source reports abuse.'}` };
|
|
435
|
+
}
|
|
436
|
+
case '/hash': {
|
|
437
|
+
if (!arg)
|
|
438
|
+
return needArg('sha256 hash');
|
|
439
|
+
const d = (await o.hashCheck(arg.split(/\s+/)[0])).result;
|
|
440
|
+
return { html: `<b>${esc(d.verdict.toUpperCase())}</b>${d.family ? ` · ${esc(d.family)}` : ''}\n<code>${esc(d.hash)}</code>\n${d.reasons.map((x) => `• ${esc(x)}`).join('\n')}${d.virustotal ? `\n<a href="${esc(d.virustotal.link)}">VirusTotal</a>` : ''}` };
|
|
441
|
+
}
|
|
442
|
+
case '/ransomware': {
|
|
443
|
+
const d = (await o.ransomware(arg)).result;
|
|
444
|
+
const items = d.victims.slice(0, 8).map((v) => `• ${v.url ? `<a href="${esc(v.url)}">${esc(v.victim.slice(0, 60))}</a>` : esc(v.victim.slice(0, 60))} <i>${esc(v.group)}${v.country ? ` · ${esc(v.country)}` : ''} · ${esc((v.discovered ?? '').slice(0, 10))}</i>`).join('\n');
|
|
445
|
+
return { html: `<b>${d.query ? `Ransomware claims: ${esc(d.query)}` : 'Newest ransomware claims'}</b> (${d.total})\n${items || 'None found.'}\n<i>Claims by criminal groups; they can be wrong.</i>` };
|
|
446
|
+
}
|
|
447
|
+
case '/company': {
|
|
448
|
+
if (!arg)
|
|
449
|
+
return needArg('NL004495445B01');
|
|
450
|
+
const d = (await o.companyCheck(arg)).result;
|
|
451
|
+
const vat = d.vat ? `<b>VAT ${esc(d.vat.country + d.vat.number)}: ${d.vat.valid ? 'VALID' : 'NOT VALID'}</b>${d.vat.name ? `\n${esc(d.vat.name)}` : ''}\n` : '';
|
|
452
|
+
const recs = d.records.slice(0, 3).map((x) => `• <a href="${esc(x.url)}">${esc(x.name)}</a> <i>${esc(x.status ?? '')} · ${esc(x.country ?? '')}${x.parent ? ` · parent ${esc(x.parent.name)}` : ''}</i>`).join('\n');
|
|
453
|
+
return { html: `${vat}${recs}${d.warnings.length ? `\n${d.warnings.map((w) => `! ${esc(w)}`).join('\n')}` : ''}`.trim() || 'Nothing found.' };
|
|
454
|
+
}
|
|
455
|
+
case '/breaches': {
|
|
456
|
+
const d = (await o.breaches(arg)).result;
|
|
457
|
+
const items = d.breaches.slice(0, 8).map((b) => `• <b>${esc(b.title)}</b> <i>${esc(b.breachDate ?? '')} · ${b.accounts.toLocaleString('en-US')} accounts</i>`).join('\n');
|
|
458
|
+
return { html: `<b>${d.query ? `Breaches: ${esc(d.query)}` : 'Newest breaches'}</b>${d.query ? ` (${d.total})` : ''}\n${items || 'None found.'}\n<i>Source: Have I Been Pwned (CC BY 4.0)</i>` };
|
|
459
|
+
}
|
|
460
|
+
case '/phone': {
|
|
461
|
+
if (!arg)
|
|
462
|
+
return needArg('+1 876 555 0100');
|
|
463
|
+
const d = (await o.phoneCheck(arg)).result;
|
|
464
|
+
return { html: `<b>${esc(d.e164)}</b>: <b>${esc(d.risk.toUpperCase())} RISK</b>\n${esc([d.country, d.lineType, d.carrier].filter(Boolean).join(' · '))}${d.warnings.length ? `\n${d.warnings.map((w) => `! ${esc(w)}`).join('\n')}` : ''}\n${esc(d.advice[0] ?? '')}` };
|
|
465
|
+
}
|
|
466
|
+
case '/satellite': {
|
|
467
|
+
const d = (await o.satellites(arg)).result;
|
|
468
|
+
if (d.mode === 'recent')
|
|
469
|
+
return { html: `<b>Launched in the last 30 days</b> (${d.total} objects)\n${d.launches.slice(0, 10).map((l) => `• ${esc(l.id)} ${esc(l.names.join(', '))} (${l.objects})`).join('\n')}` };
|
|
470
|
+
return { html: d.objects.length ? d.objects.slice(0, 4).map((x) => `<b>${esc(x.name)}</b> NORAD ${x.norad}${x.status ? ` · ${esc(x.status)}` : ''}${x.orbit ? `\n${x.orbit.regime} ${x.orbit.perigeeKm}-${x.orbit.apogeeKm} km · ${x.orbit.periodMin} min · ${x.orbit.inclination}°` : ''}`).join('\n\n') : esc(d.note) };
|
|
471
|
+
}
|
|
422
472
|
case '/airport': {
|
|
423
473
|
if (!arg)
|
|
424
474
|
return needArg('JFK');
|
|
@@ -861,12 +911,12 @@ export class TelegramBot {
|
|
|
861
911
|
const me = await this.call('getMe', {});
|
|
862
912
|
this.log(`bot @${me.username} running; ${this.opts.allowedChats.length} allowed chat(s)`);
|
|
863
913
|
if (this.isPublic) {
|
|
864
|
-
await this.call('setMyCommands', { commands: ['scam', 'url', 'factcheck', 'recall', 'email', 'travel', 'airport', 'country', 'papers', 'audit', 'monitor', 'monitors', 'unmonitor', 'cve', 'hazards', 'blackout', 'alerts', 'help'].map((c) => ({ command: c, description: `Oculon ${c}` })) }).catch(() => { });
|
|
914
|
+
await this.call('setMyCommands', { commands: ['scam', 'url', 'factcheck', 'recall', 'email', 'phone', 'company', 'breaches', 'ip', 'hash', 'ransomware', 'travel', 'airport', 'country', 'papers', 'audit', 'monitor', 'monitors', 'unmonitor', 'cve', 'hazards', 'blackout', 'alerts', 'help'].map((c) => ({ command: c, description: `Oculon ${c}` })) }).catch(() => { });
|
|
865
915
|
}
|
|
866
916
|
for (const chat of this.opts.allowedChats)
|
|
867
917
|
await this.call('setMyCommands', {
|
|
868
918
|
scope: { type: 'chat', chat_id: Number(chat) },
|
|
869
|
-
commands: ['ask', 'scam', 'monitors', 'unmonitor', 'url', 'factcheck', 'travel', 'audit', 'monitor', 'recall', 'email', 'airport', 'country', 'papers', 'case', 'brief', 'report', 'narratives', 'health', 'impact', 'contradict', 'sanctions', 'watch', 'fence', 'markets', 'launches', 'rewind', 'deployer', 'scoops', 'rh', 'ships', 'radar', 'signals', 'dossier', 'hype', 'footprint', 'plane', 'mil', 'events', 'lights', 'image', 'wallet', 'token', 'space', 'air', 'score', 'cloud', 'bgp', 'vulns', 'cve', 'regs', 'defi', 'squawk', 'filings', 'fires', 'sentinel', 'radar_image', 'darkships', 'vessel', 'blackout', 'hazards', 'podcast', 'exposure', 'social', 'calendar', 'connect', 'live', 'feedback', 'alerts'].filter((c) => onchainEnabled() || !/^(deployer|rh|wallet|token|defi|protocol)$/.test(c)).map((c) => ({ command: c, description: `Oculon ${c}` })),
|
|
919
|
+
commands: ['ask', 'scam', 'monitors', 'unmonitor', 'url', 'factcheck', 'travel', 'audit', 'monitor', 'recall', 'email', 'phone', 'company', 'breaches', 'ip', 'hash', 'ransomware', 'satellite', 'airport', 'country', 'papers', 'case', 'brief', 'report', 'narratives', 'health', 'impact', 'contradict', 'sanctions', 'watch', 'fence', 'markets', 'launches', 'rewind', 'deployer', 'scoops', 'rh', 'ships', 'radar', 'signals', 'dossier', 'hype', 'footprint', 'plane', 'mil', 'events', 'lights', 'image', 'wallet', 'token', 'space', 'air', 'score', 'cloud', 'bgp', 'vulns', 'cve', 'regs', 'defi', 'squawk', 'filings', 'fires', 'sentinel', 'radar_image', 'darkships', 'vessel', 'blackout', 'hazards', 'podcast', 'exposure', 'social', 'calendar', 'connect', 'live', 'feedback', 'alerts'].filter((c) => onchainEnabled() || !/^(deployer|rh|wallet|token|defi|protocol)$/.test(c)).map((c) => ({ command: c, description: `Oculon ${c}` })),
|
|
870
920
|
}).catch(() => { });
|
|
871
921
|
if (this.opts.watchMinutes && this.opts.watchMinutes > 0) {
|
|
872
922
|
this.scheduler = startScheduler(this.oculon, {
|
package/dist/web/index.html
CHANGED
|
@@ -563,6 +563,16 @@ nav button { white-space: nowrap; }
|
|
|
563
563
|
<option value="airport">Airport status (JFK, EGLL…)</option>
|
|
564
564
|
<option value="country">Country brief</option>
|
|
565
565
|
<option value="papers">Research papers (topic)</option>
|
|
566
|
+
<option value="phone">Who is calling? (phone number)</option>
|
|
567
|
+
<option value="password">Has my password leaked?</option>
|
|
568
|
+
<option value="breaches">Data breaches (domain, or empty for newest)</option>
|
|
569
|
+
<option value="company">Is this supplier real? (name, LEI or EU VAT)</option>
|
|
570
|
+
</optgroup>
|
|
571
|
+
<optgroup label="Threat intel">
|
|
572
|
+
<option value="ip">IP address check (IP or domain)</option>
|
|
573
|
+
<option value="hash">File hash check (MD5, SHA-1, SHA-256)</option>
|
|
574
|
+
<option value="ransomware">Ransomware claims (country, sector, name, or empty)</option>
|
|
575
|
+
<option value="satellites">Satellites (name, NORAD number, or empty for new launches)</option>
|
|
566
576
|
</optgroup>
|
|
567
577
|
<optgroup label="Investigate">
|
|
568
578
|
<option value="dossier">Dossier (company, person)</option>
|
|
@@ -923,7 +933,7 @@ function handleMapClick(e) {
|
|
|
923
933
|
const waitMap = setInterval(() => { if (map) { map.on('click', handleMapClick); clearInterval(waitMap); } }, 300);
|
|
924
934
|
|
|
925
935
|
/* investigate */
|
|
926
|
-
const placeholders = { scam: 'USPS: your package is on hold, pay the $1.99 fee within 24 hours at usps-redelivery-help.top/track', recall: '2018 Honda Accord', emailsec: 'example.com', airport: 'JFK', country: 'Argentina', papers: 'solid-state battery', url: 'paypa1-secure-login.top/verify', factcheck: 'The Great Wall of China is visible from space', audit: 'npm:lodash@4.17.15 npm:request pypi:requests==2.19.0', travel: 'Lisbon', dossier: 'Nvidia', hype: 'ai agent', footprint: 'openai.com', lights: 'Gaza Strip', aircraft: 'N628TS', image: 'Kyoto', /*onchain*/wallet: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', token: '0xdac17f958d2ee523a2206206994597c13d831ec7', /*/onchain*/air: 'New Delhi', space: '(no input needed)', /*onchain*/robinhood: '(no input needed)', deployer: '0x… token or deployer', /*/onchain*/launches: 'OpenAI', markets: '(no input needed)', rewind: '2026-11-12', sanctions: 'IMO 1234567 or 0x… or exact name', health: 'Nvidia', impact: '(empty = current quakes and storms)', contradictions: 'Anthropic IPO' };
|
|
936
|
+
const placeholders = { phone: '+1 876 555 0100', password: 'type a password (it never leaves your browser)', breaches: '(empty = newest breaches) or adobe.com', company: 'NL004495445B01', ip: '185.220.101.1', hash: '094fd325049b8a9cf6d3e5ef2a6d4cc6a567d7d49c35f8bb8dd9e3c6acf3d78d', ransomware: '(empty = newest claims) or Healthcare, DE, a company', satellites: '(empty = new launches) or ISS, 25544', scam: 'USPS: your package is on hold, pay the $1.99 fee within 24 hours at usps-redelivery-help.top/track', recall: '2018 Honda Accord', emailsec: 'example.com', airport: 'JFK', country: 'Argentina', papers: 'solid-state battery', url: 'paypa1-secure-login.top/verify', factcheck: 'The Great Wall of China is visible from space', audit: 'npm:lodash@4.17.15 npm:request pypi:requests==2.19.0', travel: 'Lisbon', dossier: 'Nvidia', hype: 'ai agent', footprint: 'openai.com', lights: 'Gaza Strip', aircraft: 'N628TS', image: 'Kyoto', /*onchain*/wallet: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', token: '0xdac17f958d2ee523a2206206994597c13d831ec7', /*/onchain*/air: 'New Delhi', space: '(no input needed)', /*onchain*/robinhood: '(no input needed)', deployer: '0x… token or deployer', /*/onchain*/launches: 'OpenAI', markets: '(no input needed)', rewind: '2026-11-12', sanctions: 'IMO 1234567 or 0x… or exact name', health: 'Nvidia', impact: '(empty = current quakes and storms)', contradictions: 'Anthropic IPO' };
|
|
927
937
|
const usd = (x) => (x == null ? '?' : '$' + Math.round(x).toLocaleString('en-US'));
|
|
928
938
|
|
|
929
939
|
/* brief: tiny, safe Markdown renderer (escape first, then headings, bold, links, bullets) */
|
|
@@ -1070,10 +1080,49 @@ $('#ask-go').onclick = async () => {
|
|
|
1070
1080
|
finally { $('#ask-go').disabled = false; }
|
|
1071
1081
|
};
|
|
1072
1082
|
$('#ask-q').addEventListener('keydown', (e) => { if (e.key === 'Enter') $('#ask-go').click(); });
|
|
1073
|
-
$('#inv-kind').onchange = () => { $('#inv-q').placeholder = placeholders[$('#inv-
|
|
1083
|
+
$('#inv-kind').onchange = () => { const k = $('#inv-kind').value; $('#inv-q').placeholder = placeholders[k]; $('#inv-q').type = k === 'password' ? 'password' : 'text'; if (k === 'password') $('#inv-q').value = ''; };
|
|
1074
1084
|
const spark = (xs) => { const m = Math.max(...xs, 1e-9); return `<span class="spark">${xs.map((x) => `<i style="height:${Math.max(2, Math.round((x / m) * 28))}px" title="${esc(x)}"></i>`).join('')}</span>`; };
|
|
1075
1085
|
const sigList = (s) => (s.length ? `<h3>Signals</h3>${s.map(renderSignal).join('')}` : '');
|
|
1086
|
+
const link = (u, t) => `<a href="${safeUrl(u)}" target="_blank" rel="noopener noreferrer">${esc(t)}</a>`;
|
|
1087
|
+
const tonePill = (t, txt) => `<span class="pill ${t}">${esc(txt)}</span>`;
|
|
1076
1088
|
const views = {
|
|
1089
|
+
ip: (r) => {
|
|
1090
|
+
const d = r.result;
|
|
1091
|
+
const t = d.verdict === 'malicious' ? 'bad' : d.verdict === 'suspicious' ? 'warn' : 'ok';
|
|
1092
|
+
const row = (k, v) => (v ? `<tr><td>${k}</td><td>${v}</td></tr>` : '');
|
|
1093
|
+
const flags = Object.entries(d.flags).filter(([, v]) => v).map(([k]) => `<span class="chip">${esc(k === 'knownGood' ? 'known benign' : k)}</span>`).join('');
|
|
1094
|
+
return `<h3>${esc(d.ip)}${d.resolvedFrom ? ` <span class="meta">${esc(d.resolvedFrom)}</span>` : ''} ${tonePill(t, d.verdict)} <span class="meta">risk ${d.risk}/100</span></h3>${flags ? `<p>${flags}</p>` : ''}<table>${row('Network', esc([d.network.asn, d.network.name].filter(Boolean).join(' ')) + (d.network.type ? ` <span class="meta">${esc(d.network.type)}</span>` : ''))}${row('Location', d.location ? esc([d.location.city, d.location.region, d.location.country].filter(Boolean).join(', ')) : '')}${row('Reverse DNS', esc(d.network.reverse || ''))}${row('AbuseIPDB', d.abuseipdb ? `${d.abuseipdb.reports} reports · confidence ${d.abuseipdb.score}%` : '')}${row('VirusTotal', d.virustotal ? `${d.virustotal.malicious} of ${d.virustotal.engines} engines flag it · ${link(d.virustotal.link, 'open')}` : '')}${row('GreyNoise', d.greynoise ? (d.greynoise.noise ? `scanning, ${esc(d.greynoise.classification || 'unknown')}` : d.greynoise.riot ? 'known benign service' : 'not seen scanning') : '')}${row('OTX', d.otx ? `${d.otx.count} threat report${d.otx.count === 1 ? '' : 's'}` : '')}${row('Open ports', d.ports && d.ports.ports.length ? esc(d.ports.ports.slice(0, 16).join(', ')) + (d.ports.vulns.length ? ` <span class="err">${d.ports.vulns.length} known CVEs</span>` : '') : '')}</table>${d.reasons.length ? `<h3>Why</h3><ul class="ev">${d.reasons.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : ''}<h3>What to do</h3><ul class="ev">${d.advice.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>`;
|
|
1095
|
+
},
|
|
1096
|
+
hash: (r) => {
|
|
1097
|
+
const d = r.result;
|
|
1098
|
+
const t = d.verdict === 'malicious' ? 'bad' : d.verdict === 'suspicious' ? 'warn' : d.verdict === 'known good' ? 'ok' : '';
|
|
1099
|
+
return `<h3>${tonePill(t, d.verdict)} ${d.family ? `<b>${esc(d.family)}</b>` : ''} <span class="meta">${esc(d.algorithm)}</span></h3><p class="meta"><code>${esc(d.hash)}</code>${d.name ? `<br>${esc(d.name)}` : ''}</p><ul class="ev">${d.reasons.map((x) => `<li>${esc(x)}</li>`).join('')}</ul><p>${[d.bazaar && link(d.bazaar.link, 'MalwareBazaar'), d.virustotal && link(d.virustotal.link, 'VirusTotal')].filter(Boolean).join(' · ')}</p><h3>What to do</h3><ul class="ev">${d.advice.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>`;
|
|
1100
|
+
},
|
|
1101
|
+
ransomware: (r) => {
|
|
1102
|
+
const d = r.result;
|
|
1103
|
+
const tally = (xs) => xs.map((x) => `<span class="chip">${esc(x.name)} ${x.count}</span>`).join('');
|
|
1104
|
+
return `<h3>${d.query ? `Ransomware claims: ${esc(d.query)}` : 'Newest ransomware claims'} <span class="meta">${d.total} found</span></h3>${d.byGroup.length ? `<p class="meta">Groups ${tally(d.byGroup.slice(0, 6))}</p>` : ''}${d.byCountry.length && d.mode !== 'country' ? `<p class="meta">Countries ${tally(d.byCountry.slice(0, 6))}</p>` : ''}${d.victims.length ? `<ul class="ev">${d.victims.slice(0, 25).map((v) => `<li><b>${v.url ? link(v.url, v.victim) : esc(v.victim)}</b> <span class="pill bad">${esc(v.group)}</span> <span class="meta">${esc([v.country, v.sector, (v.discovered || v.attacked || '').slice(0, 10)].filter(Boolean).join(' · '))}</span>${v.description ? `<div class="meta">${esc(v.description)}</div>` : ''}</li>`).join('')}</ul>` : '<p>No claims found.</p>'}<p class="meta">${esc(d.note)}</p>`;
|
|
1105
|
+
},
|
|
1106
|
+
company: (r) => {
|
|
1107
|
+
const d = r.result;
|
|
1108
|
+
const vat = d.vat ? `<h3>VAT ${esc(d.vat.country + d.vat.number)} ${tonePill(d.vat.valid ? 'ok' : 'bad', d.vat.valid ? 'valid' : 'not valid')}</h3>${d.vat.name ? `<p><b>${esc(d.vat.name)}</b>${d.vat.address ? `<br><span class="meta">${esc(d.vat.address)}</span>` : ''}</p>` : ''}` : '';
|
|
1109
|
+
const recs = d.records.map((x) => `<li><b>${link(x.url, x.name)}</b> ${tonePill(x.status === 'ACTIVE' ? 'ok' : 'warn', (x.status || '?').toLowerCase())} ${x.registration && x.registration !== 'ISSUED' ? tonePill('warn', 'LEI ' + x.registration.toLowerCase()) : ''}<div class="meta">LEI ${esc(x.lei)}${x.registeredAs ? ' · reg. ' + esc(x.registeredAs) : ''}${x.created ? ' · since ' + esc(x.created) : ''}</div>${x.address ? `<div class="meta">${esc(x.address)}</div>` : ''}${x.parent ? `<div class="meta">Ultimate parent: ${esc(x.parent.name)}</div>` : ''}</li>`).join('');
|
|
1110
|
+
return `${vat}${d.warnings.length ? `<ul class="ev">${d.warnings.map((w) => `<li class="err">${esc(w)}</li>`).join('')}</ul>` : ''}${recs ? `<h3>LEI register</h3><ul class="ev">${recs}</ul>` : ''}<p class="meta">${esc(d.note)}</p>`;
|
|
1111
|
+
},
|
|
1112
|
+
breaches: (r) => {
|
|
1113
|
+
const d = r.result;
|
|
1114
|
+
return `<h3>${d.query ? `Breaches: ${esc(d.query)} ${tonePill(d.total ? 'bad' : 'ok', d.total ? d.total + ' found' : 'none found')}` : 'Newest breaches'}</h3>${d.breaches.length ? `<ul class="ev">${d.breaches.map((b) => `<li><b>${link(b.url, b.title)}</b> <span class="meta">${esc(b.breachDate || '')} · ${b.accounts.toLocaleString('en-US')} accounts${b.domain ? ' · ' + esc(b.domain) : ''}</span><div class="meta">${esc(b.dataClasses.join(', '))}</div><div>${esc(b.description)}</div></li>`).join('')}</ul>` : ''}<p class="meta">${esc(d.note)}</p>`;
|
|
1115
|
+
},
|
|
1116
|
+
phone: (r) => {
|
|
1117
|
+
const d = r.result;
|
|
1118
|
+
const t = d.risk === 'high' ? 'bad' : d.risk === 'medium' ? 'warn' : 'ok';
|
|
1119
|
+
return `<h3>${esc(d.e164)} ${tonePill(t, d.risk + ' risk')}${d.valid === false ? ' ' + tonePill('bad', 'not valid') : ''}</h3><p>${esc([d.country, d.location, d.lineType, d.carrier].filter(Boolean).join(' · '))}</p>${d.warnings.length ? `<ul class="ev">${d.warnings.map((w) => `<li class="err">${esc(w)}</li>`).join('')}</ul>` : ''}<h3>What to do</h3><ul class="ev">${d.advice.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>`;
|
|
1120
|
+
},
|
|
1121
|
+
satellites: (r) => {
|
|
1122
|
+
const d = r.result;
|
|
1123
|
+
if (d.mode === 'recent') return `<h3>Launched in the last 30 days <span class="meta">${d.total} objects</span></h3><table><tr><th>launch</th><th>objects</th><th>names</th></tr>${d.launches.map((l) => `<tr><td>${esc(l.id)}</td><td class="num">${l.objects}</td><td>${esc(l.names.join(', '))}</td></tr>`).join('')}</table><p class="meta">${esc(d.note)}</p>`;
|
|
1124
|
+
return d.objects.length ? `<ul class="ev">${d.objects.map((x) => `<li><b>${link(x.url, x.name)}</b> <span class="meta">NORAD ${x.norad} · ${esc(x.intlId)}</span>${x.status ? ' ' + tonePill(x.status === 'operational' ? 'ok' : '', x.status) : ''}${x.orbit ? `<div>${esc(x.orbit.regime)} · ${x.orbit.perigeeKm}-${x.orbit.apogeeKm} km · ${x.orbit.periodMin} min · ${x.orbit.inclination}°</div>` : ''}<div class="meta">${esc([x.owner && 'owner ' + x.owner, x.type, x.launchDate && 'launched ' + x.launchDate, x.decayed && 'decayed ' + x.decayed].filter(Boolean).join(' · '))}</div></li>`).join('')}</ul><p class="meta">${esc(d.note)}</p>` : `<p>${esc(d.note)}</p>`;
|
|
1125
|
+
},
|
|
1077
1126
|
scam: (r) => {
|
|
1078
1127
|
const d = r.result;
|
|
1079
1128
|
const tone = d.verdict === 'likely scam' ? 'bad' : d.verdict === 'suspicious' ? 'warn' : 'ok';
|
|
@@ -1223,7 +1272,25 @@ $('#inv-go').onclick = async () => {
|
|
|
1223
1272
|
if (q.startsWith('(')) q = '';
|
|
1224
1273
|
const out = $('#inv-out');
|
|
1225
1274
|
if (kind === 'image') { out.innerHTML = `<p class="meta">Loading satellite image of ${esc(q)}…</p><img class="sat" alt="Satellite image of ${esc(q)}" src="/api/image?place=${encodeURIComponent(q)}">`; return; }
|
|
1226
|
-
|
|
1275
|
+
if (kind === 'password') {
|
|
1276
|
+
// k-anonymity: hash here, send 5 characters of the SHA-1, match the rest in this browser.
|
|
1277
|
+
const pw = $('#inv-q').value;
|
|
1278
|
+
if (!pw) { out.innerHTML = '<p class="err">Type a password first.</p>'; return; }
|
|
1279
|
+
if (!crypto.subtle) { out.innerHTML = '<p class="err">This browser cannot hash here (it needs a secure https page).</p>'; return; }
|
|
1280
|
+
$('#inv-go').disabled = true;
|
|
1281
|
+
out.innerHTML = '<p class="meta">Checking…</p>';
|
|
1282
|
+
try {
|
|
1283
|
+
const buf = await crypto.subtle.digest('SHA-1', new TextEncoder().encode(pw));
|
|
1284
|
+
const hex = [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, '0')).join('').toUpperCase();
|
|
1285
|
+
const r = await api('/api/pwned?prefix=' + hex.slice(0, 5));
|
|
1286
|
+
const hit = r.suffixes.find(([s]) => s === hex.slice(5));
|
|
1287
|
+
const n = hit ? hit[1] : 0;
|
|
1288
|
+
out.innerHTML = `<h3><span class="pill ${n ? 'bad' : 'ok'}">${n ? 'leaked' : 'not found'}</span> ${n ? `<span class="meta">seen ${n.toLocaleString('en-US')} times in data breaches</span>` : '<span class="meta">not in any known breach</span>'}</h3><ul class="ev">${n ? '<li>Stop using this password everywhere you use it, starting with email and banking.</li><li>Use a password manager to make a different password for every site, and turn on two-factor sign-in.</li>' : '<li>Still use it on one site only, and keep two-factor sign-in on.</li>'}</ul><p class="meta">Your password never left this browser: only the first 5 characters of its SHA-1 hash (${esc(hex.slice(0, 5))}) were sent, and the match happened here. Data: Have I Been Pwned, Pwned Passwords.</p>`;
|
|
1289
|
+
} catch (err) { out.innerHTML = `<p class="err">${esc(err.message)}</p>`; }
|
|
1290
|
+
finally { $('#inv-go').disabled = false; }
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
const param = { phone: 'number', breaches: 'domain', company: 'q', ip: 'ip', hash: 'hash', ransomware: 'q', satellites: 'q', scam: 'message', recall: 'q', emailsec: 'domain', airport: 'code', country: 'name', papers: 'topic', url: 'url', factcheck: 'claim', audit: 'packages', travel: 'place', dossier: 'name', hype: 'topic', footprint: 'domain', lights: 'place', aircraft: 'q', /*onchain*/wallet: 'address', token: 'address', /*/onchain*/air: 'place', space: 'x', /*onchain*/robinhood: 'x', deployer: 'address', /*/onchain*/launches: 'company', markets: 'x', rewind: 'date', sanctions: 'q', health: 'company', impact: 'place', contradictions: 'topic' }[kind];
|
|
1227
1294
|
$('#inv-go').disabled = true;
|
|
1228
1295
|
out.innerHTML = '<p class="meta">Working… some sources are rate-limited and take a while.</p>';
|
|
1229
1296
|
try {
|
package/dist/web/insights.js
CHANGED
|
@@ -84,6 +84,8 @@ const KEY_GROUPS = [
|
|
|
84
84
|
['Companies', ['ADZUNA_APP_KEY', 'COURTLISTENER_TOKEN', 'COMPANIES_HOUSE_API_KEY', 'BRANDFETCH_API_KEY']],
|
|
85
85
|
['Social and audio', ['APIFY_TOKEN', 'YOUTUBE_API_KEY', 'BLUESKY_APP_PASSWORD', 'DEEPGRAM_API_KEY']],
|
|
86
86
|
['Web security', ['URLSCAN_API_KEY', 'SAFE_BROWSING_KEY', 'ABUSECH_AUTH_KEY']],
|
|
87
|
+
['Threat intel', ['ABUSEIPDB_API_KEY', 'OTX_API_KEY', 'IPINFO_TOKEN', 'VIRUSTOTAL_API_KEY']],
|
|
88
|
+
['Phone', ['NUMVERIFY_API_KEY']],
|
|
87
89
|
['Fact checks', ['GOOGLE_API_KEY']],
|
|
88
90
|
['Telegram bot', ['TELEGRAM_BOT_TOKEN']],
|
|
89
91
|
];
|
package/dist/web/openapi.js
CHANGED
|
@@ -6,6 +6,13 @@ const E = [
|
|
|
6
6
|
['/api/factcheck', 'factCheck', 'Fact check a claim or a news link against published fact checks and current reporting.', [{ name: 'claim', desc: 'Claim text or article URL', example: 'The Great Wall of China is visible from space', required: true }]],
|
|
7
7
|
['/api/recall', 'recall', 'Vehicle recalls by VIN or "year make model", or product recalls by name (NHTSA, CPSC, FDA).', [{ name: 'q', desc: 'VIN, vehicle or product', example: '2018 Honda Accord', required: true }]],
|
|
8
8
|
['/api/emailsec', 'emailSecurity', 'Can someone spoof email from this domain? SPF, DMARC, DKIM, MTA-STS, DNSSEC, with fixes.', [{ name: 'domain', desc: 'Domain', example: 'example.com', required: true }]],
|
|
9
|
+
['/api/phone', 'phoneCheck', 'Who is calling? Country, line type, carrier, premium-rate and callback-scam warnings for a phone number.', [{ name: 'number', desc: 'Phone number in international format', example: '+1 876 555 0100', required: true }, { name: 'country', desc: 'ISO country code for a national number', example: 'US' }]],
|
|
10
|
+
['/api/company', 'companyCheck', 'Is this supplier real? EU VAT number (VIES), LEI or company name (GLEIF): status, address, ultimate parent.', [{ name: 'q', desc: 'Company name, LEI or EU VAT number', example: 'NL004495445B01', required: true }]],
|
|
11
|
+
['/api/breaches', 'dataBreaches', 'Newest data breaches in Have I Been Pwned, or every breach of one domain.', [{ name: 'domain', desc: 'Domain or company (optional)', example: 'adobe.com' }]],
|
|
12
|
+
['/api/ip', 'ipCheck', 'Who runs this IP, and is it known for abuse? AbuseIPDB, GreyNoise, OTX, VirusTotal, ThreatFox, Spamhaus DROP, Tor, open ports.', [{ name: 'ip', desc: 'IP address or domain', example: '185.220.101.1', required: true }]],
|
|
13
|
+
['/api/hash', 'hashCheck', 'Is this file known malware or a known good file? MD5, SHA-1 or SHA-256.', [{ name: 'hash', desc: 'File hash in hex', example: '094fd325049b8a9cf6d3e5ef2a6d4cc6a567d7d49c35f8bb8dd9e3c6acf3d78d', required: true }]],
|
|
14
|
+
['/api/ransomware', 'ransomwareClaims', 'Ransomware leak-site claims: newest, or by country code, sector, company or domain.', [{ name: 'q', desc: 'Country code, sector, company or domain (optional)', example: 'Healthcare' }]],
|
|
15
|
+
['/api/satellites', 'satellites', 'Satellites launched in the last 30 days, or one object\'s orbit, owner and status.', [{ name: 'q', desc: 'Satellite name or NORAD number (optional)', example: '25544' }]],
|
|
9
16
|
['/api/travel', 'travelRisk', 'Travel risk for the coming week: official advice, weather, air, outbreaks, disasters, quakes, outages.', [{ name: 'place', desc: 'City or country', example: 'Lisbon', required: true }]],
|
|
10
17
|
['/api/airport', 'airportStatus', 'Airport weather (METAR, TAF), FAA delays and ground stops, nearby emergency squawks.', [{ name: 'code', desc: 'IATA or ICAO code, or name', example: 'JFK', required: true }]],
|
|
11
18
|
['/api/country', 'countryBrief', 'Country brief: economy, IMF outlook, leaders, currency, travel advice, outages, headlines.', [{ name: 'name', desc: 'Country name or ISO code', example: 'Argentina', required: true }]],
|
package/dist/web/public.js
CHANGED
|
@@ -43,9 +43,17 @@ export const PUBLIC_API = new Set([
|
|
|
43
43
|
'/api/airport',
|
|
44
44
|
'/api/share',
|
|
45
45
|
'/api/scam',
|
|
46
|
+
'/api/ip',
|
|
47
|
+
'/api/hash',
|
|
48
|
+
'/api/ransomware',
|
|
49
|
+
'/api/company',
|
|
50
|
+
'/api/pwned',
|
|
51
|
+
'/api/breaches',
|
|
52
|
+
'/api/phone',
|
|
53
|
+
'/api/satellites',
|
|
46
54
|
]);
|
|
47
55
|
/** Endpoints that start outside work (a CLI process or several upstream calls) get a tighter budget. */
|
|
48
|
-
const HEAVY = new Set(['/api/console', '/api/rhtoken', '/api/verify', '/api/url', '/api/travel', '/api/audit', '/api/recall', '/api/emailsec', '/api/country', '/api/airport', '/api/scam']);
|
|
56
|
+
const HEAVY = new Set(['/api/console', '/api/rhtoken', '/api/verify', '/api/url', '/api/travel', '/api/audit', '/api/recall', '/api/emailsec', '/api/country', '/api/airport', '/api/scam', '/api/ip', '/api/hash', '/api/company', '/api/phone']);
|
|
49
57
|
/** Signals from these modules describe the owner's own watchlist, cases, fences, votes or raw social streams. */
|
|
50
58
|
const PRIVATE_MODULES = new Set(['meerkat', 'case', 'fence', 'feedback', 'live']);
|
|
51
59
|
export function publicSignals(list) {
|
package/dist/web/server.js
CHANGED
|
@@ -82,7 +82,21 @@ export function consoleArgv(input) {
|
|
|
82
82
|
return null;
|
|
83
83
|
const [cmd, a1, a2, a3] = parts;
|
|
84
84
|
const onchain = onchainEnabled();
|
|
85
|
-
const bare = ['bgp', 'vulns', 'hazards', 'cloud', 'squawk', 'blackout', 'regs', 'calendar', 'quota', 'help', ...(onchain ? ['rh', 'defi'] : [])];
|
|
85
|
+
const bare = ['bgp', 'vulns', 'hazards', 'cloud', 'squawk', 'blackout', 'regs', 'calendar', 'quota', 'help', 'ransomware', 'breaches', 'satellite', ...(onchain ? ['rh', 'defi'] : [])];
|
|
86
|
+
if (cmd === 'ip' && parts.length === 2 && /^([\d.]{7,15}|[0-9a-f:]{2,39}|[a-z0-9.-]+\.[a-z]{2,})$/i.test(a1))
|
|
87
|
+
return ['ip', a1.toLowerCase()];
|
|
88
|
+
if (cmd === 'hash' && parts.length === 2 && /^([a-f0-9]{32}|[a-f0-9]{40}|[a-f0-9]{64})$/i.test(a1))
|
|
89
|
+
return ['hash', a1.toLowerCase()];
|
|
90
|
+
if (cmd === 'phone' && parts.length === 2 && /^\+\d{7,15}$/.test(a1))
|
|
91
|
+
return ['phone', a1];
|
|
92
|
+
if (cmd === 'breaches' && parts.length === 2 && /^[a-z0-9.-]+\.[a-z]{2,}$/i.test(a1))
|
|
93
|
+
return ['breaches', a1.toLowerCase()];
|
|
94
|
+
if (cmd === 'ransomware' && parts.length === 2 && /^[\p{L}\d.-]{2,40}$/u.test(a1))
|
|
95
|
+
return ['ransomware', a1];
|
|
96
|
+
if (cmd === 'satellite' && parts.length === 2 && /^[\w()-]{3,30}$/.test(a1))
|
|
97
|
+
return ['satellite', a1];
|
|
98
|
+
if (cmd === 'company' && parts.length === 2 && /^[A-Z0-9]{8,20}$/i.test(a1))
|
|
99
|
+
return ['company', a1.toUpperCase()];
|
|
86
100
|
if (parts.length === 1 && bare.includes(cmd))
|
|
87
101
|
return [cmd];
|
|
88
102
|
if (onchain && cmd === 'deployer' && parts.length === 2 && HEX_ADDR.test(a1))
|
|
@@ -246,6 +260,23 @@ export const ROUTES = {
|
|
|
246
260
|
throw e instanceof HttpError ? e : new HttpError(400, e.message);
|
|
247
261
|
}
|
|
248
262
|
},
|
|
263
|
+
'/api/ip': async (q, o) => slim(await o.ipCheck(need(q, 'ip', 253))),
|
|
264
|
+
'/api/hash': async (q, o) => slim(await o.hashCheck(need(q, 'hash', 64))),
|
|
265
|
+
'/api/ransomware': async (q, o) => slim(await o.ransomware((q.get('q') ?? '').slice(0, 80))),
|
|
266
|
+
'/api/company': async (q, o) => slim(await o.companyCheck(need(q, 'q', 120))),
|
|
267
|
+
// Password checks hash in the browser and send only 5 characters of the SHA-1; the server never sees the password.
|
|
268
|
+
'/api/pwned': async (q, o) => {
|
|
269
|
+
const prefix = need(q, 'prefix', 5);
|
|
270
|
+
if (!/^[0-9a-f]{5}$/i.test(prefix))
|
|
271
|
+
throw new HttpError(400, 'prefix must be the first 5 hex characters of a SHA-1 hash');
|
|
272
|
+
const r = await o.pwnedRange(prefix);
|
|
273
|
+
if (!r.data)
|
|
274
|
+
throw new HttpError(502, `Pwned Passwords is not answering right now (${r.prov.note ?? r.prov.status})`);
|
|
275
|
+
return { prefix: prefix.toUpperCase(), suffixes: [...r.data], provenance: [r.prov] };
|
|
276
|
+
},
|
|
277
|
+
'/api/breaches': async (q, o) => slim(await o.breaches((q.get('domain') ?? '').slice(0, 120))),
|
|
278
|
+
'/api/phone': async (q, o) => slim(await o.phoneCheck(need(q, 'number', 32), q.get('country') ? { country: q.get('country').slice(0, 2) } : {})),
|
|
279
|
+
'/api/satellites': async (q, o) => slim(await o.satellites((q.get('q') ?? '').slice(0, 60))),
|
|
249
280
|
'/api/papers': async (q, o) => slim(await o.papers(need(q, 'topic', 200), q.get('years') ? { years: Number(q.get('years')) || 3 } : {})),
|
|
250
281
|
'/api/country': async (q, o) => {
|
|
251
282
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oculon",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "OSINT engine you can run, script and plug into agents:
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "OSINT engine you can run, script and plug into agents: 80+ live tools for scams, links, IPs, malware, outages, CVEs and research, each result with its sources. CLI, SDK, MCP server and web app. Zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osint",
|
|
7
7
|
"open-source-intelligence",
|