-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
91 lines (74 loc) · 2.09 KB
/
index.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
const tor_axios = require("tor-axios");
const tor = tor_axios.torSetup({
ip: "localhost",
port: 9050,
});
const crypto = require("crypto");
const info = {
dataSent: 0,
ipUpdated: 0,
};
const url = "YOUR_URL"; // Change the endpoint
const secondsBetweenIpUpdates = 20;
const millisecondsBetweenRequests = 30;
(async () => {
updateTorSession(secondsBetweenIpUpdates);
let sendRequests = true;
while (sendRequests) {
// data to send for each request
const options = {
user: generateEmail(),
pass: generatePassword(),
};
try {
sendPostRequest(url, options).then((res) => {
if (res.status !== 200) {
sendRequests = false;
return;
}
++info.dataSent;
});
await sleep(millisecondsBetweenRequests);
console.clear();
console.log(`Requests Sent: ${info.dataSent}`);
console.log(`IP updated ${info.ipUpdated} times.`);
} catch (err) {
console.log(err);
break;
}
}
})();
function generateEmail() {
return (
getRandomString(getRandomNumberBetween(6, 16)) +
"@" +
getValidEmailDomain() +
".com"
);
}
function getValidEmailDomain() {
const domains = ["gmail", "outlook", "netease", "hotmail", "tencent"];
const index = Math.floor(Math.random() * domains.length);
return domains[index];
}
function generatePassword() {
return getRandomString(getRandomNumberBetween(7, 20));
}
function getRandomString(num) {
return crypto.randomBytes(num).toString("hex");
}
function getRandomNumberBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function sendPostRequest(url, options) {
return tor.post(url, options);
}
function updateTorSession(seconds) {
setInterval(() => {
tor.torNewSession();
info.ipUpdated++;
}, seconds * 1000);
}
function sleep(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));
}