Untitled
unknown
plain_text
a year ago
5.0 kB
4
Indexable
#define CURL_STATICLIB #include <curl/curl.h> #include <string> #include <fstream> #include <vector> #include <iostream> #include <filesystem> #include <random> #include <thread> std::vector<std::thread> threads; std::string target_mail = ""; std::vector <std::string> mail_reqs; int mail1 = 0, mail2 = 0; std::string generate_verification_code() { std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<int> dist(100000, 999999); int sayi = dist(gen); return std::to_string(sayi); } static std::string st; static const char* payload_text[] = { "Date: Mon, 29 Nov 2021 21:54:29 +0000\r\n", "Subject: Lifetopia Hesabını Doğrula\r\n", "\r\n", /* empty line to divide headers from body, see RFC5322 */ // "Welcome to Lifetopia Private Server\r\n", "Doğrulama kodunuz: ", st.c_str(), "\r\n\n", "Sunucumuza hoşgeldin, doğru bir sunucu seçimi yaptığın için yaşayabileceğin en iyi oyun deneyimine hak kazandın!", "\r\n\n", "-XD3TR & Avare\r\n", NULL }; struct upload_status { int lines_read; }; static size_t payload_source(void* ptr, size_t size, size_t nmemb, void* userp) { struct upload_status* upload_ctx = (struct upload_status*)userp; const char* data; if ((size == 0) || (nmemb == 0) || ((size * nmemb) < 1)) { return 0; } data = payload_text[upload_ctx->lines_read]; if (data) { size_t len = strlen(data); memcpy(ptr, data, len); upload_ctx->lines_read++; return len; } return 0; } void send_mail(const char* target_mail2) { std::string path = "codes/" + target_mail + ".txt"; if (std::filesystem::exists(path)) { std::ofstream cd(path); cd << ""; cd.close(); std::cout << "- Resent: " << target_mail2 << std::endl; } else std::cout << "- Sent: " << target_mail2 << std::endl; CURL* curl; CURLcode res = CURLE_OK; struct curl_slist* recipients = NULL; struct upload_status upload_ctx; upload_ctx.lines_read = 0; curl = curl_easy_init(); if (curl) { if (mail1 < 100) { curl_easy_setopt(curl, CURLOPT_USERNAME, "ltps.lifetopia@gmail.com"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "ptvn oxbn tngw krdn"); mail1++; } if (mail2 < 100 && mail1 >= 99) { curl_easy_setopt(curl, CURLOPT_USERNAME, "ltps.lifetopia@gmail.com"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "ptvn oxbn tngw krdn"); mail2++; } curl_easy_setopt(curl, CURLOPT_URL, "smtp://smtp.gmail.com:587"); curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "<ltps.lifetopia@gmail.com>"); recipients = curl_slist_append(recipients, target_mail2); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); res = curl_easy_perform(curl); if (res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); //if (remove(path.c_str()) == 0) std::cout << "- Verification resent to " << target_mail2 << std::endl; std::ofstream cd(path, std::ios::app); cd << st; cd.close(); curl_slist_free_all(recipients); curl_easy_cleanup(curl); } } void check_req() { while (true) { if (mail_reqs.size() > 0) { for (int i_ = 0; i_ < mail_reqs.size(); ++i_) { target_mail = mail_reqs[i_]; std::string target_mail2 = "<" + target_mail + ">"; st = generate_verification_code(); send_mail(target_mail2.c_str()); std::this_thread::sleep_for(std::chrono::seconds(1)); } mail_reqs.clear(); std::ofstream mail2("mail.txt"); mail2.clear(), mail2.close(); // if (remove("mail.txt") == 0) std::cout << "- All requests approved!" << std::endl; } else { std::ifstream mail("mail.txt"); std::string mail_line; if (!mail.is_open()) break; while (std::getline(mail, mail_line)) mail_reqs.push_back(mail_line), std::cout << "- Received Request: " << mail_line << std::endl; std::this_thread::sleep_for(std::chrono::seconds(1)); } } } int main() { SetConsoleTitle(L"LTPS Mail Sender"); threads.push_back(std::thread(check_req)); for (auto& th : threads) th.join(); return 0; }
Editor is loading...
Leave a Comment