#!/usr/bin/env node /** * TempMail.ing - Disposable Temporary Email Generator & Inbox Scraper * Creator: SAURUS * Base: https://tempmail.ing/ * Saluran: https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C * Note: pliss guys jangan di klaim 100% buatan lu, lu boleh kok modifikasi trs share lagi tapi tolong jangan ilangin header creator sama ch-nya */ import url from 'url'; const BASE_URL = 'https://tempmail.ing'; const API_URL = 'https://api.tempmail.ing/api'; const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'; const headers = { 'User-Agent': USER_AGENT, 'Accept': 'application/json', 'Content-Type': 'application/json', 'Origin': BASE_URL, 'Referer': `${BASE_URL}/`, }; function formatResponse(status, data = null, error = null) { const res = { Creator: 'SAURUS', Saluran: 'https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C', status, }; if (data !== null) { if (typeof data === 'object' && !Array.isArray(data)) { Object.assign(res, data); } else { res.data = data; } } if (error !== null) { res.error = error; } return res; } export async function generateEmail(durationMinutes = 10) { try { const res = await fetch(`${API_URL}/generate`, { method: 'POST', headers, body: JSON.stringify({ durationMinutes }), }); if (!res.ok) { const txt = await res.text().catch(() => ''); throw new Error(`HTTP ${res.status}: ${txt.slice(0, 150)}`); } const json = await res.json(); if (!json.success || !json.email?.address) { throw new Error('Gagal membuat email sementara'); } return formatResponse(true, { address: json.email.address, createdAt: json.email.createdAt, expiresAt: json.email.expiresAt, durationMinutes: json.email.durationMinutes, }); } catch (err) { return formatResponse(false, null, err.message); } } export async function getInbox(address) { try { if (!address) throw new Error('Alamat email wajib diisi'); const res = await fetch(`${API_URL}/emails/${encodeURIComponent(address.trim())}`, { headers, }); if (!res.ok) { const txt = await res.text().catch(() => ''); throw new Error(`HTTP ${res.status}: ${txt.slice(0, 150)}`); } const json = await res.json(); const emails = Array.isArray(json.emails) ? json.emails : []; return formatResponse(true, { address: address.trim(), total: emails.length, emails, }); } catch (err) { return formatResponse(false, null, err.message); } } async function cli() { const args = process.argv.slice(2); const command = (args[0] || '').toLowerCase(); const target = args[1]; if (!command || command === 'help' || command === '--help' || command === '-h') { console.log(` TempMail.ing Scraper CLI - by SAURUS Base: ${BASE_URL} Penggunaan: node index.js generate [durationMinutes] - Buat email sementara baru node index.js inbox - Cek kotak masuk (inbox) email `); return; } try { let result; switch (command) { case 'generate': case 'new': result = await generateEmail(Number(target) || 10); break; case 'inbox': case 'check': result = await getInbox(target); break; default: console.error(`Error: Perintah '${command}' tidak dikenali. Ketik 'node index.js help'.`); process.exit(1); } console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error(JSON.stringify(formatResponse(false, null, err.message), null, 2)); process.exit(1); } } if (process.argv[1] && url.fileURLToPath(import.meta.url) === process.argv[1]) { cli(); }