forked from a8kj7sea/proxy-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxyBuilder.cpp
More file actions
60 lines (46 loc) · 1.32 KB
/
ProxyBuilder.cpp
File metadata and controls
60 lines (46 loc) · 1.32 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
#include <iostream>
#include <fstream>
#include <random>
#include <ctime>
#include <sstream>
#include <limits>
using namespace std;
random_device rd;
mt19937 generator(rd());
int generateRandomPort() {
uniform_int_distribution<int> distribution(1, 65535);
return distribution(generator);
}
string generateRandomIP() {
ostringstream ipBuilder;
uniform_int_distribution<int> distribution(0, 255);
for (int i = 0; i < 4; i++) {
int octet = distribution(generator);
ipBuilder << octet;
if (i < 3) {
ipBuilder << ".";
}
}
return ipBuilder.str();
}
void storeProxy(const string& proxy) {
ofstream outputFile("proxies.txt", ios_base::app);
if (outputFile.is_open()) {
outputFile << proxy << endl;
outputFile.close();
cout << "Successfully saved proxy: " << proxy << endl;
}
else {
cout << "Failed to save proxy: " << proxy << endl;
}
}
int main() {
srand(static_cast<unsigned int>(time(0)));
for (int x = numeric_limits<long>::min(); x < numeric_limits<long>::max(); x++) {
string ip = generateRandomIP();
int port = generateRandomPort();
string proxy = ip + ":" + to_string(port);
storeProxy(proxy);
}
return 0;
}