oculon 0.1.4 → 0.1.6

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.
Files changed (57) hide show
  1. package/README.md +75 -5
  2. package/dist/cli/main.js +297 -0
  3. package/dist/core/evm.d.ts +20 -0
  4. package/dist/core/evm.js +165 -0
  5. package/dist/core/http.js +7 -0
  6. package/dist/core/quota.js +23 -0
  7. package/dist/index.d.ts +36 -0
  8. package/dist/index.js +68 -0
  9. package/dist/mcp.js +81 -2
  10. package/dist/modules/address.d.ts +32 -0
  11. package/dist/modules/address.js +91 -0
  12. package/dist/modules/breach.d.ts +53 -0
  13. package/dist/modules/breach.js +98 -0
  14. package/dist/modules/company.d.ts +53 -0
  15. package/dist/modules/company.js +149 -0
  16. package/dist/modules/hashcheck.d.ts +29 -0
  17. package/dist/modules/hashcheck.js +82 -0
  18. package/dist/modules/headers.d.ts +50 -0
  19. package/dist/modules/headers.js +108 -0
  20. package/dist/modules/honeypot.d.ts +36 -0
  21. package/dist/modules/honeypot.js +53 -0
  22. package/dist/modules/iban.d.ts +30 -0
  23. package/dist/modules/iban.js +82 -0
  24. package/dist/modules/ipintel.d.ts +52 -0
  25. package/dist/modules/ipintel.js +149 -0
  26. package/dist/modules/lookalike.d.ts +34 -0
  27. package/dist/modules/lookalike.js +122 -0
  28. package/dist/modules/personal.d.ts +1 -1
  29. package/dist/modules/personal.js +14 -4
  30. package/dist/modules/phone.d.ts +32 -0
  31. package/dist/modules/phone.js +148 -0
  32. package/dist/modules/ransomware.d.ts +56 -0
  33. package/dist/modules/ransomware.js +85 -0
  34. package/dist/modules/satellites.d.ts +45 -0
  35. package/dist/modules/satellites.js +113 -0
  36. package/dist/modules/utility.d.ts +121 -0
  37. package/dist/modules/utility.js +306 -0
  38. package/dist/sources/threatintel.d.ts +151 -0
  39. package/dist/sources/threatintel.js +256 -0
  40. package/dist/telegram.d.ts +2 -0
  41. package/dist/telegram.js +93 -6
  42. package/dist/web/assets/logo-200.png +0 -0
  43. package/dist/web/burns.d.ts +21 -0
  44. package/dist/web/burns.js +53 -0
  45. package/dist/web/index.html +70 -3
  46. package/dist/web/insights.js +2 -0
  47. package/dist/web/landing.html +1 -1
  48. package/dist/web/legal.html +1 -1
  49. package/dist/web/mcp.html +1 -1
  50. package/dist/web/openapi.js +11 -0
  51. package/dist/web/public.js +13 -1
  52. package/dist/web/server.d.ts +17 -0
  53. package/dist/web/server.js +161 -4
  54. package/dist/web/token.html +97 -0
  55. package/dist/web/token.json +9 -0
  56. package/dist/web/utility.html +225 -0
  57. package/package.json +2 -2
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Minimal EVM cryptography with no dependencies: keccak256 and secp256k1 public-key recovery, enough to
3
+ * check an Ethereum "personal_sign" signature (Sign-In with Ethereum) and turn it into the signer's address.
4
+ * Plain BigInt arithmetic: slow next to native code, but a sign-in needs one recovery.
5
+ */
6
+ const M64 = (1n << 64n) - 1n;
7
+ const RC = [
8
+ 0x0000000000000001n, 0x0000000000008082n, 0x800000000000808an, 0x8000000080008000n, 0x000000000000808bn, 0x0000000080000001n,
9
+ 0x8000000080008081n, 0x8000000000008009n, 0x000000000000008an, 0x0000000000000088n, 0x0000000080008009n, 0x000000008000000an,
10
+ 0x000000008000808bn, 0x800000000000008bn, 0x8000000000008089n, 0x8000000000008003n, 0x8000000000008002n, 0x8000000000000080n,
11
+ 0x000000000000800an, 0x800000008000000an, 0x8000000080008081n, 0x8000000000008080n, 0x0000000080000001n, 0x8000000080008008n,
12
+ ];
13
+ // Rotation offsets r[x][y] of the Keccak specification.
14
+ const ROT = [[0, 36, 3, 41, 18], [1, 44, 10, 45, 2], [62, 6, 43, 15, 61], [28, 55, 25, 21, 56], [27, 20, 39, 8, 14]];
15
+ const rotl = (v, n) => (n === 0 ? v : ((v << BigInt(n)) | (v >> BigInt(64 - n))) & M64);
16
+ function keccakF(A) {
17
+ const C = new Array(5), B = new Array(25);
18
+ for (let round = 0; round < 24; round++) {
19
+ for (let x = 0; x < 5; x++)
20
+ C[x] = A[x] ^ A[x + 5] ^ A[x + 10] ^ A[x + 15] ^ A[x + 20];
21
+ for (let x = 0; x < 5; x++) {
22
+ const d = C[(x + 4) % 5] ^ rotl(C[(x + 1) % 5], 1);
23
+ for (let y = 0; y < 25; y += 5)
24
+ A[x + y] = A[x + y] ^ d;
25
+ }
26
+ for (let x = 0; x < 5; x++)
27
+ for (let y = 0; y < 5; y++)
28
+ B[y + 5 * ((2 * x + 3 * y) % 5)] = rotl(A[x + 5 * y], ROT[x][y]);
29
+ for (let x = 0; x < 5; x++)
30
+ for (let y = 0; y < 25; y += 5)
31
+ A[x + y] = (B[x + y] ^ (~B[((x + 1) % 5) + y] & M64 & B[((x + 2) % 5) + y])) & M64;
32
+ A[0] = A[0] ^ RC[round];
33
+ }
34
+ }
35
+ /** Keccak-256 as used by Ethereum (original Keccak padding, not NIST SHA3-256). */
36
+ export function keccak256(data) {
37
+ const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data;
38
+ const rate = 136;
39
+ const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
40
+ padded.set(bytes);
41
+ padded[bytes.length] = padded[bytes.length] ^ 0x01;
42
+ padded[padded.length - 1] = padded[padded.length - 1] ^ 0x80;
43
+ const A = new Array(25).fill(0n);
44
+ for (let off = 0; off < padded.length; off += rate) {
45
+ for (let i = 0; i < rate / 8; i++) {
46
+ let lane = 0n;
47
+ for (let b = 7; b >= 0; b--)
48
+ lane = (lane << 8n) | BigInt(padded[off + i * 8 + b]);
49
+ A[i] = A[i] ^ lane;
50
+ }
51
+ keccakF(A);
52
+ }
53
+ const out = new Uint8Array(32);
54
+ for (let i = 0; i < 4; i++)
55
+ for (let b = 0; b < 8; b++)
56
+ out[i * 8 + b] = Number((A[i] >> BigInt(8 * b)) & 0xffn);
57
+ return out;
58
+ }
59
+ export const toHex = (b) => [...b].map((x) => x.toString(16).padStart(2, '0')).join('');
60
+ export const fromHex = (h) => { const s = h.replace(/^0x/, ''); if (s.length % 2 || /[^0-9a-f]/i.test(s))
61
+ throw new Error('not hex'); return Uint8Array.from(s.match(/../g) ?? [], (x) => parseInt(x, 16)); };
62
+ // secp256k1
63
+ const P = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;
64
+ const N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
65
+ const GX = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n;
66
+ const GY = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
67
+ const mod = (a, m) => { const r = a % m; return r < 0n ? r + m : r; };
68
+ function pow(b, e, m) { let r = 1n; b = mod(b, m); while (e > 0n) {
69
+ if (e & 1n)
70
+ r = (r * b) % m;
71
+ b = (b * b) % m;
72
+ e >>= 1n;
73
+ } return r; }
74
+ const inv = (a, m) => pow(a, m - 2n, m);
75
+ function add(p, q) {
76
+ if (!p)
77
+ return q;
78
+ if (!q)
79
+ return p;
80
+ if (p[0] === q[0] && mod(p[1] + q[1], P) === 0n)
81
+ return null;
82
+ const l = p[0] === q[0] && p[1] === q[1] ? mod(3n * p[0] * p[0] * inv(2n * p[1], P), P) : mod((q[1] - p[1]) * inv(mod(q[0] - p[0], P), P), P);
83
+ const x = mod(l * l - p[0] - q[0], P);
84
+ return [x, mod(l * (p[0] - x) - p[1], P)];
85
+ }
86
+ function mul(p, k) { let r = null, q = p; k = mod(k, N); while (k > 0n) {
87
+ if (k & 1n)
88
+ r = add(r, q);
89
+ q = add(q, q);
90
+ k >>= 1n;
91
+ } return r; }
92
+ /** Recover the uncompressed public key (64 bytes, x||y) from a message hash and an (r, s, recovery id) signature. */
93
+ export function recoverPublicKey(hash, r, s, recId) {
94
+ if (r <= 0n || r >= N || s <= 0n || s >= N || recId < 0 || recId > 3)
95
+ return null;
96
+ const x = recId >= 2 ? r + N : r;
97
+ if (x >= P)
98
+ return null;
99
+ const y2 = mod(x * x * x + 7n, P);
100
+ let y = pow(y2, (P + 1n) / 4n, P);
101
+ if (mod(y * y, P) !== y2)
102
+ return null;
103
+ if ((y & 1n) !== BigInt(recId & 1))
104
+ y = P - y;
105
+ const e = BigInt('0x' + toHex(hash)) % N;
106
+ const rInv = inv(r, N);
107
+ const Q = add(mul([x, y], mod(s * rInv, N)), mul([GX, GY], mod(-e * rInv, N)));
108
+ if (!Q)
109
+ return null;
110
+ const out = new Uint8Array(64);
111
+ out.set(fromHex(Q[0].toString(16).padStart(64, '0')), 0);
112
+ out.set(fromHex(Q[1].toString(16).padStart(64, '0')), 32);
113
+ return out;
114
+ }
115
+ export const addressOf = (pub64) => '0x' + toHex(keccak256(pub64).slice(12));
116
+ /** The address of a private key (used by tests to build signatures). */
117
+ export function addressFromPrivateKey(priv) {
118
+ const Q = mul([GX, GY], priv);
119
+ const pub = new Uint8Array(64);
120
+ pub.set(fromHex(Q[0].toString(16).padStart(64, '0')), 0);
121
+ pub.set(fromHex(Q[1].toString(16).padStart(64, '0')), 32);
122
+ return addressOf(pub);
123
+ }
124
+ /** A 65-byte Ethereum signature (r, s, v) over a 32-byte hash, low-s. `k` must be a fresh random nonce. Tests use it; Oculon never holds keys. */
125
+ export function signHash(hash, priv, k) {
126
+ const R = mul([GX, GY], k);
127
+ const r = mod(R[0], N);
128
+ const e = BigInt('0x' + toHex(hash)) % N;
129
+ let s = mod(inv(k, N) * (e + r * priv), N);
130
+ let recId = Number(R[1] & 1n) | (R[0] >= N ? 2 : 0);
131
+ if (s > N / 2n) {
132
+ s = N - s;
133
+ recId ^= 1;
134
+ }
135
+ return '0x' + r.toString(16).padStart(64, '0') + s.toString(16).padStart(64, '0') + (27 + recId).toString(16).padStart(2, '0');
136
+ }
137
+ /** The hash Ethereum wallets sign for personal_sign: keccak256("\x19Ethereum Signed Message:\n" + length + message). */
138
+ export function personalHash(message) {
139
+ const msg = new TextEncoder().encode(message);
140
+ const prefix = new TextEncoder().encode(`\x19Ethereum Signed Message:\n${msg.length}`);
141
+ const all = new Uint8Array(prefix.length + msg.length);
142
+ all.set(prefix);
143
+ all.set(msg, prefix.length);
144
+ return keccak256(all);
145
+ }
146
+ /** The lower-case address that signed a personal_sign message, or null if the signature is malformed. */
147
+ export function recoverPersonalSigner(message, signature) {
148
+ let sig;
149
+ try {
150
+ sig = fromHex(signature);
151
+ }
152
+ catch {
153
+ return null;
154
+ }
155
+ if (sig.length !== 65)
156
+ return null;
157
+ const r = BigInt('0x' + toHex(sig.slice(0, 32))), s = BigInt('0x' + toHex(sig.slice(32, 64)));
158
+ let v = sig[64];
159
+ if (v >= 27)
160
+ v -= 27;
161
+ if (s > N / 2n)
162
+ return null; // wallets produce low-s signatures; reject malleated ones
163
+ const pub = recoverPublicKey(personalHash(message), r, s, v);
164
+ return pub ? addressOf(pub) : null;
165
+ }
package/dist/core/http.js CHANGED
@@ -3,6 +3,9 @@ import { takeQuota } from './quota.js';
3
3
  /** Minimum gap between requests per host, following each provider's published guidance. */
4
4
  const HOST_GAP_MS = {
5
5
  'crt.sh': 2000,
6
+ 'api.honeypot.is': 600,
7
+ 'mempool.space': 300,
8
+ 'api.mainnet-beta.solana.com': 300,
6
9
  'api.gdeltproject.org': 5500,
7
10
  'export.arxiv.org': 3100,
8
11
  'api.github.com': 1500,
@@ -56,6 +59,10 @@ const HOST_GAP_MS = {
56
59
  'api.osv.dev': 100,
57
60
  'www.4byte.directory': 500,
58
61
  'api.semanticscholar.org': 1100, // 1 request per second with a key
62
+ 'www.virustotal.com': 15_500, // public API: 4 requests a minute
63
+ 'ip-api.com': 1400, // 45 requests a minute
64
+ 'api.greynoise.io': 1000,
65
+ 'www.peeringdb.com': 3100, // anonymous: 20 requests a minute
59
66
  };
60
67
  const chains = new Map();
61
68
  async function throttle(host) {
@@ -63,6 +63,29 @@ export const DAILY_BUDGET = {
63
63
  apify: 40,
64
64
  deepgram: 30, // transcriptions per day
65
65
  'shodan-internetdb': 2000,
66
+ // IP, hash, phone, breach, company and satellite checks.
67
+ abuseipdb: 900, // 1,000/day free
68
+ virustotal: 450, // 500/day public API (and 4/minute, see the host gap)
69
+ otx: 5000,
70
+ ipinfo: 1500, // 50,000/month Lite
71
+ numverify: 3, // 100/month free; the offline check still answers
72
+ greynoise: 40, // community API is rate limited for unauthenticated use
73
+ 'ip-api': 5000, // 45/minute
74
+ peeringdb: 500,
75
+ 'tor-exits': 50,
76
+ 'spamhaus-drop': 30,
77
+ 'circl-hashlookup': 3000,
78
+ malwarebazaar: 2000,
79
+ threatfox: 2000,
80
+ 'ransomware-live': 1000,
81
+ 'pwned-passwords': 20_000,
82
+ 'honeypot-is': 1500, // keyless, be gentle
83
+ 'mempool-space': 3000,
84
+ 'solana-rpc': 3000, // public RPC, rate limited per IP
85
+ hibp: 200,
86
+ gleif: 3000,
87
+ vies: 1000,
88
+ celestrak: 200, // asks for at most one fetch of the same data per two hours
66
89
  };
67
90
  const envName = (source) => `OCULON_QUOTA_${source.toUpperCase().replace(/[^A-Z0-9]/g, '_')}`;
68
91
  export function budgetFor(source) {
package/dist/index.d.ts CHANGED
@@ -232,6 +232,42 @@ export declare class Oculon {
232
232
  country(name: string): Promise<ModuleResult<import("./modules/country.js").CountryBrief>>;
233
233
  /** Is this message a scam? Checks its links, sender domain and known scam patterns. */
234
234
  scamCheck(message: string): Promise<ModuleResult<import("./modules/scam.js").ScamCheck>>;
235
+ /** Who runs this IP (or domain), and is it known for abuse? AbuseIPDB, GreyNoise, OTX, VirusTotal, ThreatFox, Spamhaus DROP, Tor. */
236
+ ipCheck(ipOrDomain: string): Promise<ModuleResult<import("./modules/ipintel.js").IpCheck>>;
237
+ /** Is this file hash (MD5, SHA-1, SHA-256) known malware or a known good file? */
238
+ hashCheck(hash: string): Promise<ModuleResult<import("./modules/hashcheck.js").HashCheck>>;
239
+ /** Ransomware leak-site claims: newest, or by country code, sector, company or domain (ransomware.live). */
240
+ ransomware(query?: string): Promise<ModuleResult<import("./modules/ransomware.js").RansomwareResult>>;
241
+ /** Company identity: EU VAT number (VIES), LEI or name (GLEIF), with status and ultimate parent. */
242
+ companyCheck(nameLeiOrVat: string): Promise<ModuleResult<import("./modules/company.js").CompanyCheck>>;
243
+ /** Is this password in known breaches? Only 5 characters of its SHA-1 hash leave the machine. */
244
+ passwordCheck(password: string): Promise<ModuleResult<import("./modules/breach.js").PasswordCheck>>;
245
+ /** Pwned Passwords suffix counts for a 5-character SHA-1 prefix (for checks that hash on the client). */
246
+ pwnedRange(prefix: string): Promise<import("./core/types.js").Sourced<Map<string, number>>>;
247
+ /** Newest breaches in Have I Been Pwned, or the breaches of one domain or company. */
248
+ breaches(domain?: string): Promise<ModuleResult<import("./modules/breach.js").BreachList>>;
249
+ /** Phone number check: country, line type, carrier, premium-rate and callback-scam warnings. */
250
+ phoneCheck(number: string, opts?: {
251
+ country?: string;
252
+ }): Promise<ModuleResult<import("./modules/phone.js").PhoneCheck>>;
253
+ /** IBAN check, offline: country, length, mod-97 check digits, bank code, and a warning when the account country differs from the supplier's. */
254
+ ibanCheck(iban: string, opts?: {
255
+ country?: string;
256
+ }): Promise<ModuleResult<import("./modules/iban.js").IbanCheck>>;
257
+ /** Raw email headers: SPF, DKIM and DMARC results, the delivery path, the origin IP and spoofing signs. */
258
+ headerCheck(rawHeaders: string): Promise<ModuleResult<import("./modules/headers.js").HeaderReport>>;
259
+ /** Lookalike domains of a brand that exist in DNS, and new certificates naming the brand (crt.sh). */
260
+ lookalikes(domain: string): Promise<ModuleResult<import("./modules/lookalike.js").LookalikeReport>>;
261
+ /** Can this token be sold? Buy and sell simulation with taxes (honeypot.is): Ethereum, BNB Chain, Base. */
262
+ honeypotCheck(address: string, opts?: {
263
+ chain?: string;
264
+ }): Promise<ModuleResult<import("./modules/honeypot.js").HoneypotReport>>;
265
+ /** Crypto address without keys: chain from format, OFAC sanctions, balance and activity from free explorers. */
266
+ addressCheck(address: string, opts?: {
267
+ network?: string;
268
+ }): Promise<ModuleResult<import("./modules/address.js").AddressReport>>;
269
+ /** Satellites: launches of the last 30 days, or one object's orbit, owner and status (CelesTrak). */
270
+ satellites(query?: string): Promise<ModuleResult<import("./modules/satellites.js").SatResult>>;
235
271
  /** Airport status: METAR and TAF, FAA delays and ground stops (US), emergency squawks nearby. */
236
272
  airport(code: string): Promise<ModuleResult<import("./modules/airport.js").AirportStatus>>;
237
273
  /** Today's brief (stored once per day; refresh to rewrite). */
package/dist/index.js CHANGED
@@ -63,6 +63,18 @@ import { papers } from './modules/papers.js';
63
63
  import { countryBrief } from './modules/country.js';
64
64
  import { airportStatus } from './modules/airport.js';
65
65
  import { scamCheck } from './modules/scam.js';
66
+ import { ipCheck } from './modules/ipintel.js';
67
+ import { hashCheck } from './modules/hashcheck.js';
68
+ import { ransomware } from './modules/ransomware.js';
69
+ import { companyCheck } from './modules/company.js';
70
+ import { breaches, passwordCheck, pwnedRange } from './modules/breach.js';
71
+ import { phoneCheck } from './modules/phone.js';
72
+ import { ibanCheck } from './modules/iban.js';
73
+ import { headerCheck } from './modules/headers.js';
74
+ import { lookalikes } from './modules/lookalike.js';
75
+ import { honeypotCheck } from './modules/honeypot.js';
76
+ import { addressCheck } from './modules/address.js';
77
+ import { satellites } from './modules/satellites.js';
66
78
  export class Oculon {
67
79
  ctx;
68
80
  constructor(opts = {}) {
@@ -352,6 +364,62 @@ export class Oculon {
352
364
  scamCheck(message) {
353
365
  return scamCheck(this.ctx, message);
354
366
  }
367
+ /** Who runs this IP (or domain), and is it known for abuse? AbuseIPDB, GreyNoise, OTX, VirusTotal, ThreatFox, Spamhaus DROP, Tor. */
368
+ ipCheck(ipOrDomain) {
369
+ return ipCheck(this.ctx, ipOrDomain);
370
+ }
371
+ /** Is this file hash (MD5, SHA-1, SHA-256) known malware or a known good file? */
372
+ hashCheck(hash) {
373
+ return hashCheck(this.ctx, hash);
374
+ }
375
+ /** Ransomware leak-site claims: newest, or by country code, sector, company or domain (ransomware.live). */
376
+ ransomware(query = '') {
377
+ return ransomware(this.ctx, query);
378
+ }
379
+ /** Company identity: EU VAT number (VIES), LEI or name (GLEIF), with status and ultimate parent. */
380
+ companyCheck(nameLeiOrVat) {
381
+ return companyCheck(this.ctx, nameLeiOrVat);
382
+ }
383
+ /** Is this password in known breaches? Only 5 characters of its SHA-1 hash leave the machine. */
384
+ passwordCheck(password) {
385
+ return passwordCheck(this.ctx, password);
386
+ }
387
+ /** Pwned Passwords suffix counts for a 5-character SHA-1 prefix (for checks that hash on the client). */
388
+ pwnedRange(prefix) {
389
+ return pwnedRange(this.ctx, prefix);
390
+ }
391
+ /** Newest breaches in Have I Been Pwned, or the breaches of one domain or company. */
392
+ breaches(domain = '') {
393
+ return breaches(this.ctx, domain);
394
+ }
395
+ /** Phone number check: country, line type, carrier, premium-rate and callback-scam warnings. */
396
+ phoneCheck(number, opts = {}) {
397
+ return phoneCheck(this.ctx, number, opts);
398
+ }
399
+ /** IBAN check, offline: country, length, mod-97 check digits, bank code, and a warning when the account country differs from the supplier's. */
400
+ ibanCheck(iban, opts = {}) {
401
+ return ibanCheck(this.ctx, iban, opts);
402
+ }
403
+ /** Raw email headers: SPF, DKIM and DMARC results, the delivery path, the origin IP and spoofing signs. */
404
+ headerCheck(rawHeaders) {
405
+ return headerCheck(this.ctx, rawHeaders);
406
+ }
407
+ /** Lookalike domains of a brand that exist in DNS, and new certificates naming the brand (crt.sh). */
408
+ lookalikes(domain) {
409
+ return lookalikes(this.ctx, domain);
410
+ }
411
+ /** Can this token be sold? Buy and sell simulation with taxes (honeypot.is): Ethereum, BNB Chain, Base. */
412
+ honeypotCheck(address, opts = {}) {
413
+ return honeypotCheck(this.ctx, address, opts);
414
+ }
415
+ /** Crypto address without keys: chain from format, OFAC sanctions, balance and activity from free explorers. */
416
+ addressCheck(address, opts = {}) {
417
+ return addressCheck(this.ctx, address, opts);
418
+ }
419
+ /** Satellites: launches of the last 30 days, or one object's orbit, owner and status (CelesTrak). */
420
+ satellites(query = '') {
421
+ return satellites(this.ctx, query);
422
+ }
355
423
  /** Airport status: METAR and TAF, FAA delays and ground stops (US), emergency squawks nearby. */
356
424
  airport(code) {
357
425
  return airportStatus(this.ctx, code);
package/dist/mcp.js CHANGED
@@ -7,7 +7,7 @@ import { createInterface } from 'node:readline';
7
7
  import { Oculon, summarizeProvenance } from './index.js';
8
8
  import { ONCHAIN_TOOLS, onchainEnabled } from './core/features.js';
9
9
  import { availableKinds } from './modules/monitor.js';
10
- export const SERVER_INFO = { name: 'oculon', version: '0.1.4' };
10
+ export const SERVER_INFO = { name: 'oculon', version: '0.1.6' };
11
11
  const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
12
12
  const str = (d) => ({ type: 'string', description: d });
13
13
  const num = (d) => ({ type: 'number', description: d });
@@ -255,6 +255,84 @@ export const TOOLS = [
255
255
  inputSchema: schema({ domain: str('Domain or email address, e.g. "example.com"') }, ['domain']),
256
256
  run: async (o, a) => compact(await o.emailSecurity(String(a.domain))),
257
257
  },
258
+ {
259
+ name: 'oculon_ip_check',
260
+ description: 'Who runs this IP address, and is it known for abuse? Pass an IPv4 or IPv6 address, or a domain (its first address is checked). Returns network (ASN, owner, type), location, flags (Tor exit, proxy, hosting, internet scanner, known benign service), AbuseIPDB reports, GreyNoise scanner status, AlienVault OTX threat reports, VirusTotal engine verdicts, ThreatFox malware infrastructure, Spamhaus DROP listing and open ports, with a verdict (malicious, suspicious, no known abuse), a 0-100 risk and the reasons.',
261
+ inputSchema: schema({ ip: str('IP address or domain, e.g. "185.220.101.1"') }, ['ip']),
262
+ run: async (o, a) => compact(await o.ipCheck(String(a.ip))),
263
+ },
264
+ {
265
+ name: 'oculon_hash_check',
266
+ description: 'Is this file known malware, a known good file, or unknown? Pass an MD5, SHA-1 or SHA-256 hash. Checks CIRCL hashlookup (NIST NSRL and other known-software sets), MalwareBazaar, ThreatFox, AlienVault OTX and VirusTotal, and returns a verdict, the malware family when known, the reasons and what to do.',
267
+ inputSchema: schema({ hash: str('MD5, SHA-1 or SHA-256 in hex') }, ['hash']),
268
+ run: async (o, a) => compact(await o.hashCheck(String(a.hash))),
269
+ },
270
+ {
271
+ name: 'oculon_ransomware',
272
+ description: 'Ransomware leak-site claims collected by ransomware.live. Leave query empty for the newest claims, or pass a two-letter country code ("DE"), a sector ("Healthcare", "Manufacturing") or a company name or domain. Returns victims with group, country, sector and dates, plus counts by group, country and sector. These are claims by criminals and can be wrong.',
273
+ inputSchema: schema({ query: str('Optional: country code, sector, company or domain') }, []),
274
+ run: async (o, a) => compact(await o.ransomware(a.query ? String(a.query) : '')),
275
+ },
276
+ {
277
+ name: 'oculon_company_lookup',
278
+ description: 'Is this company or supplier real? Pass an EU VAT number (checked live in the European Commission VIES service: valid or not, registered name and address), a 20-character LEI, or a company name (Global LEI Index: legal name, registered address, status, registration number, ultimate parent). Useful before paying an invoice from a new supplier.',
279
+ inputSchema: schema({ query: str('Company name, LEI, or EU VAT number such as "NL004495445B01"') }, ['query']),
280
+ run: async (o, a) => compact(await o.companyCheck(String(a.query))),
281
+ },
282
+ {
283
+ name: 'oculon_password_check',
284
+ description: 'Has this password appeared in known data breaches (Have I Been Pwned Pwned Passwords)? Only the first 5 characters of its SHA-1 hash are sent; the match is done locally and the password is never stored. Pass the password, or "sha1:<40 hex>" if you already have the hash. Local only: this tool is not offered on the remote server.',
285
+ inputSchema: schema({ password: str('The password, or "sha1:<hash>"') }, ['password']),
286
+ run: async (o, a) => compact(await o.passwordCheck(String(a.password))),
287
+ },
288
+ {
289
+ name: 'oculon_breaches',
290
+ description: 'Data breaches from Have I Been Pwned: leave domain empty for the newest breaches, or pass a domain or company name for all of its breaches, with date, accounts affected and the kinds of data exposed.',
291
+ inputSchema: schema({ domain: str('Optional: domain or company name, e.g. "adobe.com"') }, []),
292
+ run: async (o, a) => compact(await o.breaches(a.domain ? String(a.domain) : '')),
293
+ },
294
+ {
295
+ name: 'oculon_phone_check',
296
+ description: 'Who is behind this phone number? Pass it in international format (+44 20 7946 0958), or a national number with country. Returns country, line type (mobile, landline, VoIP, premium rate), carrier and location when known, and warnings for premium-rate numbers, UK 070 personal numbers and the Caribbean "one ring" callback-scam area codes. Never looks up the owner.',
297
+ inputSchema: schema({ number: str('Phone number'), country: str('ISO country code for a national number, e.g. "US"') }, ['number']),
298
+ run: async (o, a) => compact(await o.phoneCheck(String(a.number), a.country ? { country: String(a.country) } : {})),
299
+ },
300
+ {
301
+ name: 'oculon_iban_check',
302
+ description: 'Check an IBAN before paying an invoice, fully offline: country, length, ISO 13616 mod-97 check digits and the bank code. Pass the supplier country to flag an account held in another country, a common sign of invoice fraud. A valid IBAN does not prove who owns the account.',
303
+ inputSchema: schema({ iban: str('The IBAN, spaces allowed'), country: str('Optional: the supplier\'s ISO country code, e.g. "NL"') }, ['iban']),
304
+ run: async (o, a) => compact(await o.ibanCheck(String(a.iban), a.country ? { country: String(a.country) } : {})),
305
+ },
306
+ {
307
+ name: 'oculon_email_headers',
308
+ description: 'Analyze the raw headers of a suspicious email: SPF, DKIM and DMARC results recorded by the receiving server, the Received path, the origin IP and its country, and spoofing signs (From differs from the envelope sender, Reply-To elsewhere, a display name posing as an address). Returns a verdict and risk.',
309
+ inputSchema: schema({ headers: str('The raw message headers, as shown by "Show original"') }, ['headers']),
310
+ run: async (o, a) => compact(await o.headerCheck(String(a.headers))),
311
+ },
312
+ {
313
+ name: 'oculon_lookalike_domains',
314
+ description: 'Find lookalike domains of a brand that a phisher could use: typos, swapped letters, homoglyphs, extra words and other endings that exist in DNS (with mail servers), plus certificates issued in the last 90 days for any name containing the brand (Certificate Transparency).',
315
+ inputSchema: schema({ domain: str('The real domain, e.g. "example.com"') }, ['domain']),
316
+ run: async (o, a) => compact(await o.lookalikes(String(a.domain))),
317
+ },
318
+ {
319
+ name: 'oculon_honeypot_check',
320
+ description: 'Can this token be sold? Simulates a buy and a sell on the token\'s main pool and replays recent holders\' sells (honeypot.is): honeypot verdict, buy and sell tax, holders who could not sell, unpublished or upgradeable contracts. Chains: eth, bsc, base.',
321
+ inputSchema: schema({ address: str('Token contract address (0x...)'), chain: str('eth, bsc or base (default eth)') }, ['address']),
322
+ run: async (o, a) => compact(await o.honeypotCheck(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
323
+ },
324
+ {
325
+ name: 'oculon_address_check',
326
+ description: 'Check a crypto address before sending funds, without API keys: chain from the address format (Bitcoin, EVM, Solana, Tron), US OFAC sanctions, and balance, transaction count and labels from free explorers (mempool.space, Blockscout, Solana RPC). Flags unused addresses and contracts posing as wallets.',
327
+ inputSchema: schema({ address: str('Crypto address'), network: str('Optional for 0x addresses: "robinhood" for Robinhood Chain, default Ethereum') }, ['address']),
328
+ run: async (o, a) => compact(await o.addressCheck(String(a.address), a.network ? { network: String(a.network) } : {})),
329
+ },
330
+ {
331
+ name: 'oculon_satellites',
332
+ description: 'Satellites from CelesTrak. Leave query empty for everything launched in the last 30 days, grouped by launch. Or pass a satellite name ("ISS", "starlink-1007") or NORAD catalog number for its orbit (perigee, apogee, period, inclination, regime), owner, launch date and status.',
333
+ inputSchema: schema({ query: str('Optional: satellite name or NORAD number') }, []),
334
+ run: async (o, a) => compact(await o.satellites(a.query ? String(a.query) : '')),
335
+ },
258
336
  {
259
337
  name: 'oculon_papers',
260
338
  description: 'Research brief on a topic: the most cited papers of recent years, the newest relevant ones, papers per year (is the field growing?), PubMed counts for medical topics, and a short overview that cites the numbered papers. Sources: OpenAlex, PubMed, Semantic Scholar.',
@@ -579,7 +657,8 @@ export const TOOLS = [
579
657
  },
580
658
  ];
581
659
  /** Tools that change the shared watchlist, fences or plugins; not offered to anonymous remote clients. */
582
- const REMOTE_HIDDEN = new Set(['oculon_watch_add', 'oculon_fence_add', 'oculon_watch_run', 'oculon_case_new', 'oculon_stamp_proofs', 'oculon_resolve_forecasts', 'oculon_auto_forecast', 'oculon_forecast']);
660
+ // Tools that change the shared watchlist, plus the password check: a password should never travel to a public server.
661
+ const REMOTE_HIDDEN = new Set(['oculon_watch_add', 'oculon_fence_add', 'oculon_watch_run', 'oculon_case_new', 'oculon_stamp_proofs', 'oculon_resolve_forecasts', 'oculon_auto_forecast', 'oculon_forecast', 'oculon_password_check']);
583
662
  /** Tools this build offers: on-chain tools are left out unless OCULON_ONCHAIN=1. */
584
663
  export function activeTools() {
585
664
  return onchainEnabled() ? TOOLS : TOOLS.filter((t) => !ONCHAIN_TOOLS.has(t.name));
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Crypto address check without API keys: which chain the address belongs to (from its format), whether it is
3
+ * on the US OFAC sanctions list, and its age, balance and activity from free explorers (mempool.space for
4
+ * Bitcoin, Blockscout for Ethereum and Robinhood Chain, the public Solana RPC). Useful before you send
5
+ * funds to an address someone gave you in a chat.
6
+ */
7
+ import type { Ctx } from '../core/context.js';
8
+ import type { ModuleResult } from '../core/types.js';
9
+ export interface AddressReport {
10
+ address: string;
11
+ chain: 'bitcoin' | 'evm' | 'solana' | 'tron' | 'unknown';
12
+ format: string;
13
+ network: string | null;
14
+ activity: {
15
+ txCount: number | null;
16
+ balance: string | null;
17
+ firstSeen: string | null;
18
+ isContract: boolean | null;
19
+ label: string | null;
20
+ } | null;
21
+ sanctioned: boolean | null;
22
+ sanctionHits: string[];
23
+ warnings: string[];
24
+ advice: string[];
25
+ }
26
+ export declare function detectChain(a: string): {
27
+ chain: AddressReport['chain'];
28
+ format: string;
29
+ };
30
+ export declare function addressCheck(ctx: Ctx, input: string, opts?: {
31
+ network?: string;
32
+ }): Promise<ModuleResult<AddressReport>>;
@@ -0,0 +1,91 @@
1
+ import { screen } from './sanctions.js';
2
+ const B58 = /^[1-9A-HJ-NP-Za-km-z]+$/;
3
+ export function detectChain(a) {
4
+ if (/^0x[0-9a-fA-F]{40}$/.test(a))
5
+ return { chain: 'evm', format: 'EVM (Ethereum, Base, Robinhood Chain and other EVM chains)' };
6
+ if (/^(bc1|tb1)[02-9ac-hj-np-z]{11,71}$/.test(a.toLowerCase()))
7
+ return { chain: 'bitcoin', format: a.toLowerCase().startsWith('bc1p') ? 'Bitcoin Taproot (bech32m)' : 'Bitcoin SegWit (bech32)' };
8
+ if (/^[13][1-9A-HJ-NP-Za-km-z]{25,34}$/.test(a))
9
+ return { chain: 'bitcoin', format: a.startsWith('1') ? 'Bitcoin legacy (P2PKH)' : 'Bitcoin script (P2SH)' };
10
+ if (/^T[1-9A-HJ-NP-Za-km-z]{33}$/.test(a))
11
+ return { chain: 'tron', format: 'Tron (TRC-20 USDT lives here)' };
12
+ if (B58.test(a) && a.length >= 32 && a.length <= 44)
13
+ return { chain: 'solana', format: 'Solana' };
14
+ return { chain: 'unknown', format: 'not a recognized address format' };
15
+ }
16
+ export async function addressCheck(ctx, input, opts = {}) {
17
+ const address = input.trim();
18
+ if (!address)
19
+ throw new Error('give a crypto address');
20
+ const { chain, format } = detectChain(address);
21
+ if (chain === 'unknown')
22
+ throw new Error(`not a crypto address: ${address.slice(0, 60)}`);
23
+ const provenance = [];
24
+ const warnings = [];
25
+ let activity = null;
26
+ let network = null;
27
+ if (chain === 'bitcoin') {
28
+ network = 'Bitcoin';
29
+ const r = await ctx.http.get(`https://mempool.space/api/address/${address}`, { source: 'mempool-space', ttlSec: 600 });
30
+ provenance.push(r.prov);
31
+ const s = r.data?.chain_stats;
32
+ if (s)
33
+ activity = { txCount: s.tx_count ?? 0, balance: `${(((s.funded_txo_sum ?? 0) - (s.spent_txo_sum ?? 0)) / 1e8).toFixed(8)} BTC`, firstSeen: null, isContract: false, label: null };
34
+ }
35
+ else if (chain === 'evm') {
36
+ const rh = /^(rh|robinhood)$/i.test(opts.network ?? '');
37
+ network = rh ? 'Robinhood Chain' : 'Ethereum';
38
+ const base = rh ? 'https://api.blockscout.com/4663/api/v2' : 'https://eth.blockscout.com/api/v2';
39
+ const r = await ctx.http.get(`${base}/addresses/${address}`, { source: 'blockscout', ttlSec: 900 });
40
+ provenance.push(r.prov);
41
+ const c = await ctx.http.get(`${base}/addresses/${address}/counters`, { source: 'blockscout', ttlSec: 900 });
42
+ provenance.push(c.prov);
43
+ if (r.data || r.prov.note === 'HTTP 404') {
44
+ const d = r.data ?? {};
45
+ activity = { txCount: c.data?.transactions_count ? Number(c.data.transactions_count) : 0, balance: d.coin_balance ? `${(Number(BigInt(d.coin_balance) / 10n ** 12n) / 1e6).toFixed(6)} ETH` : '0 ETH', firstSeen: null,
46
+ // A wallet with an EIP-7702 delegation also has code, but no creator: only deployed contracts have one.
47
+ isContract: d.is_contract === undefined ? null : Boolean(d.is_contract && d.creator_address_hash),
48
+ label: d.ens_domain_name ?? d.public_tags?.[0]?.display_name ?? d.name ?? null };
49
+ }
50
+ }
51
+ else if (chain === 'solana') {
52
+ network = 'Solana';
53
+ const r = await ctx.http.postBytes('https://api.mainnet-beta.solana.com', new TextEncoder().encode(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getBalance', params: [address] })), { source: 'solana-rpc', headers: { 'content-type': 'application/json' }, timeoutMs: 20_000 });
54
+ provenance.push(r.prov);
55
+ let lamports = null;
56
+ try {
57
+ lamports = r.data ? Number(JSON.parse(r.data.toString('utf8')).result?.value ?? NaN) : null;
58
+ }
59
+ catch {
60
+ lamports = null;
61
+ }
62
+ if (lamports !== null && Number.isFinite(lamports))
63
+ activity = { txCount: null, balance: `${(lamports / 1e9).toFixed(6)} SOL`, firstSeen: null, isContract: null, label: null };
64
+ }
65
+ else {
66
+ network = 'Tron';
67
+ }
68
+ if (activity && activity.txCount === 0)
69
+ warnings.push('this address has never been used: double-check it with the person you are paying through another channel');
70
+ if (activity?.isContract)
71
+ warnings.push('this is a smart contract, not a personal wallet: sending to it directly can lose the funds');
72
+ // Sanctions: the US OFAC SDN list includes crypto addresses (Bitcoin, EVM, Tron and more).
73
+ let sanctioned = null;
74
+ const hits = [];
75
+ try {
76
+ const s = await screen(ctx, address);
77
+ provenance.push(...s.provenance.slice(0, 2));
78
+ sanctioned = s.result.verdict === 'SANCTIONED';
79
+ for (const h of s.result.hits.slice(0, 3))
80
+ hits.push(JSON.stringify(h).slice(0, 160));
81
+ if (sanctioned)
82
+ warnings.unshift('this address is on the US OFAC sanctions list: sending to it can be illegal');
83
+ else if (s.result.verdict === 'EXPOSED')
84
+ warnings.push('this address has traded directly with a sanctioned address');
85
+ }
86
+ catch { /* the list is optional here */ }
87
+ const advice = warnings.length
88
+ ? ['Do not send funds until you have confirmed the address with the recipient through a channel you already trust.']
89
+ : ['Nothing alarming found. Still send a small test amount first, and never send to an address someone pushes on you in a chat.'];
90
+ return { module: 'address', input: address, generatedAt: ctx.now().toISOString(), result: { address, chain, format, network, activity, sanctioned, sanctionHits: hits, warnings, advice }, signals: [], provenance };
91
+ }
@@ -0,0 +1,53 @@
1
+ import type { Ctx } from '../core/context.js';
2
+ import type { ModuleResult, Sourced } from '../core/types.js';
3
+ export interface PasswordCheck {
4
+ pwned: boolean;
5
+ count: number;
6
+ prefix: string;
7
+ advice: string[];
8
+ }
9
+ export interface Breach {
10
+ name: string;
11
+ title: string;
12
+ domain: string | null;
13
+ breachDate: string | null;
14
+ addedDate: string | null;
15
+ accounts: number;
16
+ dataClasses: string[];
17
+ verified: boolean;
18
+ spamList: boolean;
19
+ malware: boolean;
20
+ description: string;
21
+ url: string;
22
+ }
23
+ export interface BreachList {
24
+ query: string | null;
25
+ total: number;
26
+ breaches: Breach[];
27
+ note: string;
28
+ }
29
+ export declare const sha1Hex: (s: string) => string;
30
+ /** Suffix counts for one 5-character SHA-1 prefix; padding rows (count 0) are dropped. */
31
+ export declare function pwnedRange(ctx: Ctx, prefix: string): Promise<Sourced<Map<string, number>>>;
32
+ /** Is this password in known breaches? Pass the password itself, or "sha1:<40 hex>". */
33
+ export declare function passwordCheck(ctx: Ctx, password: string): Promise<ModuleResult<PasswordCheck>>;
34
+ interface RawBreach {
35
+ Name?: string;
36
+ Title?: string;
37
+ Domain?: string;
38
+ BreachDate?: string;
39
+ AddedDate?: string;
40
+ PwnCount?: number;
41
+ DataClasses?: string[];
42
+ IsVerified?: boolean;
43
+ IsSensitive?: boolean;
44
+ IsRetired?: boolean;
45
+ IsSpamList?: boolean;
46
+ IsMalware?: boolean;
47
+ IsFabricated?: boolean;
48
+ Description?: string;
49
+ }
50
+ export declare function toBreach(x: RawBreach): Breach;
51
+ /** Newest breaches, or the breaches of one domain or company name. Sensitive, retired and fabricated breaches are left out. */
52
+ export declare function breaches(ctx: Ctx, input?: string): Promise<ModuleResult<BreachList>>;
53
+ export {};