-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
109 lines (90 loc) · 4.12 KB
/
main.js
File metadata and controls
109 lines (90 loc) · 4.12 KB
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
#!/usr/bin/env node
const readline = require('readline');
const SmtpChecker = require('./core/checker');
class MultiSmtpApp {
constructor() {
this.checker = new SmtpChecker();
}
showBanner() {
console.log('\n\x1b[96m╔════════════════════════════════════════════════════════════╗\x1b[0m');
console.log('\x1b[96m║\x1b[0m' + '\x1b[93m 🚀 MULTI SMTP VALIDATOR 🚀'.padEnd(60) + '\x1b[96m║\x1b[0m');
console.log('\x1b[96m║\x1b[0m' + '\x1b[92m Advanced SMTP Server Verification Tool'.padEnd(60) + '\x1b[96m║\x1b[0m');
console.log('\x1b[96m╚════════════════════════════════════════════════════════════╝\x1b[0m\n');
}
printResult(result) {
let emoji = '';
let color = '';
switch (result.status) {
case 'valid':
emoji = '✅';
color = '\x1b[32m';
break;
case 'invalid':
emoji = '❌';
color = '\x1b[31m';
break;
case 'reject':
emoji = '🚫';
color = '\x1b[33m';
break;
case 'fail':
emoji = '⚠️';
color = '\x1b[35m';
break;
}
console.log(`${color}${emoji} ${result.host}:${result.port} - ${result.email} [${result.status.toUpperCase()}]\x1b[0m`);
}
printSummary() {
const stats = this.checker.getStats();
console.log('\n\x1b[95m✨ === SUMMARY === ✨\x1b[0m');
console.log(`\x1b[97m📊 Total: \x1b[96m${stats.total}\x1b[0m`);
console.log(`\x1b[32m✅ Valid: ${stats.valid}\x1b[0m`);
console.log(`\x1b[31m❌ Invalid: ${stats.invalid}\x1b[0m`);
console.log(`\x1b[33m🚫 Reject: ${stats.reject}\x1b[0m`);
console.log(`\x1b[35m⚠️ Fail: ${stats.fail}\x1b[0m`);
console.log('\n\x1b[94m📁 Generated files:\x1b[0m');
if (stats.valid > 0) console.log(`\x1b[32m✅ valid.txt (${stats.valid})\x1b[0m`);
if (stats.invalid > 0) console.log(`\x1b[31m❌ invalid.txt (${stats.invalid})\x1b[0m`);
if (stats.reject > 0) console.log(`\x1b[33m🚫 reject.txt (${stats.reject})\x1b[0m`);
if (stats.fail > 0) console.log(`\x1b[35m⚠️ fail.txt (${stats.fail})\x1b[0m`);
}
async run() {
this.showBanner();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const filePath = await new Promise(resolve => {
rl.question('\x1b[94m📁 Enter SMTP list file path: \x1b[0m', resolve);
});
const testEmail = await new Promise(resolve => {
rl.question('\x1b[94m📧 Enter test email to receive validation: \x1b[0m', resolve);
});
rl.close();
const cleanPath = filePath.replace(/^[\"']|[\"']$/g, '');
try {
await this.checker.loadServersFromFile(cleanPath);
console.log(`\x1b[92m⚡ Processing ${this.checker.totalLoaded} servers with ${this.checker.maxConcurrent} threads\x1b[0m\n`);
let completed = 0;
await this.checker.checkAll(
testEmail,
(checked, total) => {
// Progress update
},
(result) => {
completed++;
console.log(`\x1b[96m[${completed}/${this.checker.totalLoaded}]\x1b[0m `, '');
this.printResult(result);
}
);
this.printSummary();
} catch (error) {
console.log(`\x1b[31m❌ Error: ${error.message}\x1b[0m`);
}
}
}
if (require.main === module) {
const app = new MultiSmtpApp();
app.run().catch(console.error);
}
module.exports = MultiSmtpApp;