Chain scan paced for the nodereal public key (burst 12, 1.1/s) and the three log filters run side by side; website scan reads named contract pages and site code context; PolHunter missions prepared (not live)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+28
-2
@@ -15,7 +15,7 @@ const COMMON = new Set(['0x0000000000000000000000000000000000000000', '0x0000000
|
||||
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f', '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359', '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
|
||||
'0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
|
||||
'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
'0x4200000000000000000000000000000000000006', '0x10ed43c718714eb63d5aa57b78b54704e256024e', '0xca11bde05977b3631167028862be2a173976ca11']);
|
||||
'0x4200000000000000000000000000000000000006', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', '0x10ed43c718714eb63d5aa57b78b54704e256024e', '0xca11bde05977b3631167028862be2a173976ca11']);
|
||||
|
||||
function privateIp(ip) {
|
||||
if (net.isIPv4(ip)) {
|
||||
@@ -107,7 +107,33 @@ async function scan(url, opts) {
|
||||
}
|
||||
for (const a of res.text.match(ADDR_RE) || []) bump(a, 3, 'visible text');
|
||||
for (const a of html.match(ADDR_RE) || []) bump(a, 1, 'page HTML');
|
||||
for (const a of (scripts.match(ADDR_RE) || []).slice(0, 3000)) bump(a, 0.5, 'site scripts');
|
||||
// in the site's own code, the words just before an address say what it is (NEXT_PUBLIC_..._ADDRESS, contract: 0x..) or that
|
||||
// it is wallet-library plumbing (paymaster, multicall, permit2, router) that is never the project contract
|
||||
{ const re = new RegExp(ADDR_RE.source, 'g'); let m, n = 0;
|
||||
while ((m = re.exec(scripts)) && n++ < 4000) {
|
||||
const ctx = scripts.slice(Math.max(0, m.index - 90), m.index);
|
||||
let s = 0.5;
|
||||
if (/(_ADDRESS|_ADDR|CONTRACT|contract|[Vv]ault|[Pp]roxy|[Pp]ool)[^,;]{0,40}$/.test(ctx)) s += 3;
|
||||
if (/(paymaster|wallet_|multicall|[Pp]ermit2?|[Rr]outer|WETH|[Ff]actory|[Ee]ntry[Pp]oint|[Ee]ns|safe[A-Z_]|chainlink|[Oo]racle)[^,;]{0,40}$/.test(ctx)) s -= 2;
|
||||
bump(m[0], s, s > 2 ? 'site code, named as the contract' : 'site scripts');
|
||||
} }
|
||||
// nothing on the front page: open up to 2 of the site's own pages named like a contract / ledger / proof page (public pages only)
|
||||
if (!res.explorerLinks.length && ![...score.values()].some(s => s.score >= 3)) {
|
||||
const base = new URL(page.url()); const seenP = new Set([base.pathname]);
|
||||
const subs = links.filter(l => { try { const x = new URL(l); return x.hostname === base.hostname && /contract|ledger|proof|verify|audit|transparen|smart/i.test(x.pathname) && !seenP.has(x.pathname) && seenP.add(x.pathname); } catch (e) { return false; } }).slice(0, 2);
|
||||
for (const sl of subs) {
|
||||
try {
|
||||
await page.goto(sl, { waitUntil: 'domcontentloaded', timeout: 20000 }); await page.waitForLoadState('networkidle', { timeout: 6000 }).catch(() => {});
|
||||
const t2 = String(await page.evaluate(() => document.body ? document.body.innerText : '').catch(() => '')).slice(0, 8000);
|
||||
const l2 = await page.evaluate(() => Array.from(document.querySelectorAll('a[href]')).map(a => a.href).slice(0, 1000)).catch(() => []);
|
||||
const pth = new URL(sl).pathname;
|
||||
for (const l of l2) { let lu; try { lu = new URL(l); } catch (e) { continue; } const host = lu.hostname.replace(/^www\./, ''); const ch = EXPLORERS[host]; const m = lu.pathname.match(/\/(address|token)\/(0x[a-fA-F0-9]{40})/);
|
||||
if (ch && m) { res.explorerLinks.push({ chain: ch, address: m[2].toLowerCase(), url: l.slice(0, 300), page: pth }); bump(m[2], 6, 'explorer link on ' + pth); res.chainHints[ch] = (res.chainHints[ch] || 0) + 3; } }
|
||||
for (const a of t2.match(ADDR_RE) || []) bump(a, 3, 'visible text on ' + pth);
|
||||
res.text += '\n\n[Page ' + pth + ']\n' + t2.slice(0, 5000); res.pagesRead = (res.pagesRead || []).concat([pth]);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
for (const [ch, re] of Object.entries(CHAIN_WORDS)) { const n = (res.text.match(re) || []).length; if (n) res.chainHints[ch] = (res.chainHints[ch] || 0) + n; }
|
||||
res.addresses = [...score.values()].sort((a, b) => b.score - a.score).slice(0, 25).map(s => ({ address: s.address, score: Math.round(s.score * 10) / 10, seen: [...s.seen] }));
|
||||
res.abi = parseHumanAbi(scripts + html);
|
||||
|
||||
Reference in New Issue
Block a user