/** * InboxKitten Temporary Email Scraper & Mail Reader * Author: Vamz Spectre (VamxAPI) * Target: https://inboxkitten.com * Description: * Serverless disposable email client for InboxKitten. * Check public inboxes, read metadata, and extract full HTML body. * * Usage CLI: * curl -sL "https://code.vamxapi.my.id/snippet/raw/inboxkitten" -o inboxkitten.js * node inboxkitten.js list demo * node inboxkitten.js get us-west1 */ const HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' }; const BASE = 'https://inboxkitten.com/api/v1/mail'; async function listInbox(recipient) { const clean = (recipient || '').replace(/@.*$/, '').trim(); if (!clean) throw new Error('Recipient name is required (e.g. demo)'); const res = await fetch(`${BASE}/list?recipient=${encodeURIComponent(clean)}`, { headers: HEADERS }); if (!res.ok) throw new Error(`InboxKitten list failed: ${res.status}`); const data = await res.json(); return { status: true, author: 'Vamz Spectre', provider: 'inboxkitten.com', recipient: `${clean}@inboxkitten.com`, count: data.length, messages: data.map(m => ({ id: m.id, timestamp: m.timestamp ? new Date(m.timestamp * 1000).toISOString() : null, sender: m.message?.headers?.from || m.envelope?.sender, subject: m.message?.headers?.subject || '(No Subject)', storage: m.storage })) }; } async function getMessage(region, key) { if (!region || !key) throw new Error('region and key are required'); const [metaRes, htmlRes] = await Promise.all([ fetch(`${BASE}/getKey?region=${encodeURIComponent(region)}&key=${encodeURIComponent(key)}`, { headers: HEADERS }), fetch(`${BASE}/getHtml?region=${encodeURIComponent(region)}&key=${encodeURIComponent(key)}`, { headers: HEADERS }) ]); const meta = metaRes.ok ? await metaRes.json() : {}; const html = htmlRes.ok ? await htmlRes.text() : ''; return { status: true, author: 'Vamz Spectre', provider: 'inboxkitten.com', metadata: meta, htmlBody: html }; } // CLI Runner if (require.main === module) { const action = (process.argv[2] || 'list').toLowerCase(); const arg1 = process.argv[3] || 'demo'; const arg2 = process.argv[4]; (async () => { try { let result; if (action === 'get') { result = await getMessage(arg1, arg2); } else { result = await listInbox(arg1); } console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); } })(); } module.exports = { listInbox, getMessage };