File size: 6,310 Bytes
15f7aec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
const { connect } = require('puppeteer-real-browser');

async function getTempMail() {
    console.log('Launching browser...');
    
    const { browser, page } = await connect({
        headless: 'auto',
        args: ['--no-sandbox', '--disable-setuid-sandbox'],
        turnstile: true
    });

    try {
        console.log('Navigating to tmailor.com...');
        await page.goto('https://tmailor.com', { 
            waitUntil: 'networkidle2',
            timeout: 60000 
        });

        console.log('Initial page load complete. Waiting...');
        await new Promise(resolve => setTimeout(resolve, 3000));

        console.log('Looking for Turnstile iframe to solve...');
        
        async function solveTurnstile() {
            const frames = page.frames();
            for (const frame of frames) {
                const url = frame.url();
                console.log('Frame URL:', url);
                if (url.includes('turnstile') || url.includes('challenges.cloudflare')) {
                    console.log('Found Turnstile challenge frame!');
                    try {
                        await new Promise(resolve => setTimeout(resolve, 2000));
                        const checkbox = await frame.$('input[type="checkbox"]');
                        if (checkbox) {
                            console.log('Clicking Turnstile checkbox...');
                            await checkbox.click();
                            return true;
                        }
                        const verifyButton = await frame.$('[id*="verify"], [class*="verify"], button');
                        if (verifyButton) {
                            console.log('Clicking verify button in frame...');
                            await verifyButton.click();
                            return true;
                        }
                    } catch (e) {
                        console.log('Error in Turnstile frame:', e.message);
                    }
                }
            }
            return false;
        }

        let turnstileSolved = await solveTurnstile();
        if (turnstileSolved) {
            console.log('Turnstile interaction attempted, waiting for verification...');
            await new Promise(resolve => setTimeout(resolve, 8000));
        }

        console.log('Checking for Confirm link on page...');
        const confirmButtons = await page.$$('a[title*="verify"], a[href*="firewall"], button');
        for (const btn of confirmButtons) {
            const text = await page.evaluate(el => el.textContent, btn);
            if (text && text.toLowerCase().includes('confirm')) {
                console.log('Found Confirm button, clicking...');
                await btn.click();
                await new Promise(resolve => setTimeout(resolve, 5000));
                
                turnstileSolved = await solveTurnstile();
                if (turnstileSolved) {
                    await new Promise(resolve => setTimeout(resolve, 8000));
                }
                break;
            }
        }

        console.log('Looking for New Email button...');
        const buttons = await page.$$('button, a');
        for (const btn of buttons) {
            const text = await page.evaluate(el => el.textContent, btn);
            if (text && text.includes('New Email')) {
                console.log('Found New Email button, clicking...');
                await btn.click();
                await new Promise(resolve => setTimeout(resolve, 3000));
                break;
            }
        }

        console.log('Waiting for email to appear...');
        await new Promise(resolve => setTimeout(resolve, 5000));

        let email = null;

        console.log('Searching for email in page...');
        const allText = await page.evaluate(() => document.body.innerText);
        
        const emailPatterns = allText.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g);
        if (emailPatterns) {
            const filtered = emailPatterns.filter(e => 
                !e.includes('gmail.com') && 
                !e.includes('tmailor.com@') &&
                !e.toLowerCase().includes('support')
            );
            if (filtered.length > 0) {
                email = filtered[0];
                console.log('Found email in page text:', email);
            }
        }

        if (!email) {
            const emailSelectors = [
                '#email',
                '#tempmail',
                '.email-address',
                '[data-email]',
                'input[readonly]',
                'input[type="text"]',
                '.copy-text',
                'code',
                'pre'
            ];

            for (const selector of emailSelectors) {
                try {
                    const elements = await page.$$(selector);
                    for (const element of elements) {
                        const value = await page.evaluate(el => {
                            return el.value || el.textContent || el.getAttribute('data-email') || el.getAttribute('data-clipboard-text');
                        }, element);
                        if (value && value.includes('@') && !value.includes('gmail')) {
                            email = value.trim();
                            console.log(`Found email with selector "${selector}": ${email}`);
                            break;
                        }
                    }
                    if (email) break;
                } catch (e) {}
            }
        }

        console.log('\nTaking screenshot...');
        await page.screenshot({ path: 'tmailor-screenshot.png', fullPage: true });
        console.log('Screenshot saved to tmailor-screenshot.png');

        console.log('\n=== RESULT ===');
        if (email && email.includes('@')) {
            console.log('SUCCESS! Temp Email:', email);
        } else {
            console.log('Could not find a temp email address');
            console.log('\n--- Page visible text (first 1500 chars) ---');
            console.log(allText.substring(0, 1500));
        }

        return email;

    } catch (error) {
        console.error('Error:', error.message);
    } finally {
        await browser.close();
        console.log('Browser closed.');
    }
}

getTempMail();