/** * Temp Mail Scraper (Literal Pure / Raw Output) * Providers: Mail.tm & Guerrilla Mail * Author: Vamz Spectre (Vamx) * * Menghasilkan output murni (raw JSON) langsung dari upstream tanpa modifikasi/filter. * * Penggunaan CLI: * node tempmail.js # Menjalankan demo lengkap & cetak output murni * node tempmail.js domains # List domain aktif murni * node tempmail.js create [username] [domain] [pwd] # Buat email & token baru murni * node tempmail.js token # Dapatkan JWT token murni * node tempmail.js inbox # Cek inbox murni (Mail.tm) * node tempmail.js message # Baca email detail murni * node tempmail.js guerrilla-create # Buat email Guerrilla murni * node tempmail.js guerrilla-inbox # Cek inbox Guerrilla murni * node tempmail.js guerrilla-message # Baca pesan Guerrilla murni */ const crypto = require("crypto"); const MAILTM_BASE = "https://api.mail.tm"; const GUERRILLA_BASE = "https://api.guerrillamail.com/ajax.php"; const 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"; /** * 1. Mail.tm - Get Active Domains (Murni) */ async function getMailTmDomains() { const res = await fetch(`${MAILTM_BASE}/domains`, { headers: { "User-Agent": USER_AGENT, Accept: "application/json" }, }); if (!res.ok) { const errText = await res.text(); throw new Error(`Failed to get domains (${res.status}): ${errText}`); } return await res.json(); } /** * 2. Mail.tm - Create Account (Murni) */ async function createMailTmAccount(address, password) { const res = await fetch(`${MAILTM_BASE}/accounts`, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT, Accept: "application/json", }, body: JSON.stringify({ address, password }), }); const data = await res.json(); if (!res.ok) { throw new Error(`Failed to create account (${res.status}): ${JSON.stringify(data)}`); } return data; } /** * 3. Mail.tm - Get Auth Token (Murni) */ async function getMailTmToken(address, password) { const res = await fetch(`${MAILTM_BASE}/token`, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT, Accept: "application/json", }, body: JSON.stringify({ address, password }), }); const data = await res.json(); if (!res.ok) { throw new Error(`Failed to get token (${res.status}): ${JSON.stringify(data)}`); } return data; } /** * 4. Mail.tm - Get Account Info / Me (Murni) */ async function getMailTmMe(token) { const res = await fetch(`${MAILTM_BASE}/me`, { headers: { Authorization: `Bearer ${token}`, "User-Agent": USER_AGENT, Accept: "application/json", }, }); const data = await res.json(); if (!res.ok) { throw new Error(`Failed to get account info (${res.status}): ${JSON.stringify(data)}`); } return data; } /** * 5. Mail.tm - Get Messages / Inbox (Murni) */ async function getMailTmMessages(token, page = 1) { const res = await fetch(`${MAILTM_BASE}/messages?page=${page}`, { headers: { Authorization: `Bearer ${token}`, "User-Agent": USER_AGENT, Accept: "application/json", }, }); const data = await res.json(); if (!res.ok) { throw new Error(`Failed to get messages (${res.status}): ${JSON.stringify(data)}`); } return data; } /** * 6. Mail.tm - Get Single Message Detail (Murni) */ async function getMailTmMessage(token, messageId) { const res = await fetch(`${MAILTM_BASE}/messages/${messageId}`, { headers: { Authorization: `Bearer ${token}`, "User-Agent": USER_AGENT, Accept: "application/json", }, }); const data = await res.json(); if (!res.ok) { throw new Error(`Failed to get message (${res.status}): ${JSON.stringify(data)}`); } return data; } /** * 7. Mail.tm - Delete Message (Murni) */ async function deleteMailTmMessage(token, messageId) { const res = await fetch(`${MAILTM_BASE}/messages/${messageId}`, { method: "DELETE", headers: { Authorization: `Bearer ${token}`, "User-Agent": USER_AGENT, }, }); if (res.status === 204) { return { success: true, statusCode: 204, message: "Message deleted successfully." }; } const data = await res.json().catch(() => ({})); return { success: res.ok, statusCode: res.status, data }; } /** * 8. Guerrilla Mail - Get Address (Murni) */ async function getGuerrillaAddress(lang = "en") { const res = await fetch(`${GUERRILLA_BASE}?f=get_email_address&lang=${lang}`, { headers: { "User-Agent": USER_AGENT, Accept: "application/json" }, }); return await res.json(); } /** * 9. Guerrilla Mail - Check Inbox (Murni) */ async function checkGuerrillaInbox(sidToken, seq = 0) { const res = await fetch(`${GUERRILLA_BASE}?f=check_email&seq=${seq}&sid_token=${sidToken}`, { headers: { "User-Agent": USER_AGENT, Accept: "application/json" }, }); return await res.json(); } /** * 10. Guerrilla Mail - Fetch Email Detail (Murni) */ async function fetchGuerrillaEmail(sidToken, emailId) { const res = await fetch(`${GUERRILLA_BASE}?f=fetch_email&email_id=${emailId}&sid_token=${sidToken}`, { headers: { "User-Agent": USER_AGENT, Accept: "application/json" }, }); return await res.json(); } // Module Exports if (typeof module !== "undefined" && module.exports) { module.exports = { getMailTmDomains, createMailTmAccount, getMailTmToken, getMailTmMe, getMailTmMessages, getMailTmMessage, deleteMailTmMessage, getGuerrillaAddress, checkGuerrillaInbox, fetchGuerrillaEmail, }; } // CLI Execution Handler if (require.main === module) { const args = process.argv.slice(2); const command = args[0] ? args[0].toLowerCase() : "demo"; (async () => { try { if (command === "domains") { console.log("=== [Mail.tm] GET /domains (Output Murni) ==="); const rawDomains = await getMailTmDomains(); console.log(JSON.stringify(rawDomains, null, 2)); } else if (command === "create") { const username = args[1] || `user_${crypto.randomBytes(4).toString("hex")}`; let domain = args[2]; if (!domain) { const domData = await getMailTmDomains(); domain = domData["hydra:member"]?.[0]?.domain || "uberip.com"; } const password = args[3] || `Vamx${crypto.randomBytes(4).toString("hex")}!`; const address = `${username}@${domain}`; console.log(`=== [Mail.tm] POST /accounts for ${address} (Output Murni) ===`); const account = await createMailTmAccount(address, password); console.log(JSON.stringify(account, null, 2)); console.log(`\n=== [Mail.tm] POST /token for ${address} (Output Murni) ===`); const token = await getMailTmToken(address, password); console.log(JSON.stringify(token, null, 2)); } else if (command === "token") { const address = args[1]; const password = args[2]; if (!address || !password) { console.error("Usage: node tempmail.js token "); process.exit(1); } console.log(`=== [Mail.tm] POST /token for ${address} (Output Murni) ===`); const token = await getMailTmToken(address, password); console.log(JSON.stringify(token, null, 2)); } else if (command === "inbox") { const token = args[1]; if (!token) { console.error("Usage: node tempmail.js inbox "); process.exit(1); } console.log("=== [Mail.tm] GET /messages (Output Murni) ==="); const messages = await getMailTmMessages(token); console.log(JSON.stringify(messages, null, 2)); } else if (command === "message") { const token = args[1]; const messageId = args[2]; if (!token || !messageId) { console.error("Usage: node tempmail.js message "); process.exit(1); } console.log(`=== [Mail.tm] GET /messages/${messageId} (Output Murni) ===`); const message = await getMailTmMessage(token, messageId); console.log(JSON.stringify(message, null, 2)); } else if (command === "guerrilla-create") { console.log("=== [Guerrilla Mail] get_email_address (Output Murni) ==="); const addr = await getGuerrillaAddress(); console.log(JSON.stringify(addr, null, 2)); } else if (command === "guerrilla-inbox") { const sidToken = args[1]; if (!sidToken) { console.error("Usage: node tempmail.js guerrilla-inbox "); process.exit(1); } console.log("=== [Guerrilla Mail] check_email (Output Murni) ==="); const inbox = await checkGuerrillaInbox(sidToken); console.log(JSON.stringify(inbox, null, 2)); } else if (command === "guerrilla-message") { const sidToken = args[1]; const mailId = args[2]; if (!sidToken || !mailId) { console.error("Usage: node tempmail.js guerrilla-message "); process.exit(1); } console.log(`=== [Guerrilla Mail] fetch_email id=${mailId} (Output Murni) ===`); const email = await fetchGuerrillaEmail(sidToken, mailId); console.log(JSON.stringify(email, null, 2)); } else { // Default Demo: Shows literally pure output from active endpoints console.log("================================================="); console.log(" DEMO SCRAPER TEMP MAIL - OUTPUT MURNI (RAW)"); console.log("=================================================\n"); console.log("1. [Mail.tm] GET /domains (Murni):"); const domains = await getMailTmDomains(); console.log(JSON.stringify(domains, null, 2)); const domain = domains["hydra:member"]?.[0]?.domain || "uberip.com"; const username = `vamx_${crypto.randomBytes(4).toString("hex")}`; const password = `Vamx@${crypto.randomBytes(4).toString("hex")}!`; const address = `${username}@${domain}`; console.log(`\n2. [Mail.tm] POST /accounts -> ${address} (Murni):`); const account = await createMailTmAccount(address, password); console.log(JSON.stringify(account, null, 2)); console.log("\n3. [Mail.tm] POST /token (Murni):"); const tokenData = await getMailTmToken(address, password); console.log(JSON.stringify(tokenData, null, 2)); console.log("\n4. [Mail.tm] GET /me (Murni):"); const me = await getMailTmMe(tokenData.token); console.log(JSON.stringify(me, null, 2)); console.log("\n5. [Mail.tm] GET /messages (Murni):"); const messages = await getMailTmMessages(tokenData.token); console.log(JSON.stringify(messages, null, 2)); console.log("\n6. [Guerrilla Mail] get_email_address (Murni):"); const guerrillaAddr = await getGuerrillaAddress(); console.log(JSON.stringify(guerrillaAddr, null, 2)); console.log("\n7. [Guerrilla Mail] check_email (Murni):"); const guerrillaInbox = await checkGuerrillaInbox(guerrillaAddr.sid_token); console.log(JSON.stringify(guerrillaInbox, null, 2)); if (guerrillaInbox.list && guerrillaInbox.list.length > 0) { const firstMailId = guerrillaInbox.list[0].mail_id; console.log(`\n8. [Guerrilla Mail] fetch_email ID ${firstMailId} (Murni):`); const guerrillaDetail = await fetchGuerrillaEmail(guerrillaAddr.sid_token, firstMailId); console.log(JSON.stringify(guerrillaDetail, null, 2)); } console.log("\n================================================="); console.log(" PENGUJIAN OUTPUT MURNI SELESAI"); console.log("================================================="); } } catch (err) { console.error("\n[Error]", err.message); process.exit(1); } })(); }