Results 1 to 3 of 3

Thread: Fake virus alert (avast)

  1. #1
    Join Date
    Nov 2012
    Location
    Poland/UK
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Fake virus alert (avast)

    Hi, recently my updater is treated as a virus by some antivirus programs (Avast, avira etc), I don't have any idea how resolve this problem.

    My code:

    Qt Code:
    1. #include <dirent.h>
    2. #ifdef __linux__
    3. #include <sys/stat.h>
    4. #include <sys/wait.h>
    5. #elif __unix__
    6. #include <sys/stat.h>
    7. #include <sys/wait.h>
    8. #else
    9. #include <direct.h>
    10. #endif
    11. #include <iostream>
    12. #include <ctime>
    13. #include <vector>
    14. #include <fstream>
    15. #include <cstdio>
    16. #include <sstream>
    17. #include <unistd.h>
    18. #include <cstdio>
    19. std::vector <std::string> split(std::string string, char delimiter)
    20. {
    21. std::stringstream ss(string);
    22. std::string item;
    23. std::vector<std::string > elems;
    24. while(std::getline(ss,item,delimiter)) {
    25. elems.push_back(item);
    26. }
    27. return elems;
    28. }
    29.  
    30.  
    31. void pause(int duration)
    32. {
    33.  
    34. int temp = time(NULL) + duration;
    35. while(temp > time(NULL)) {
    36.  
    37. }
    38. }
    39.  
    40. void createDirectory(std::string directory)
    41. {
    42. #ifdef __linux__
    43. mkdir(directory.c_str(),0777);
    44. #elif __unix__
    45. mkdir(directory.c_str(),0777);
    46. #else
    47. _mkdir(directory.c_str());
    48. #endif
    49. }
    50.  
    51. std::vector <std::string > readDirectory(std::string directory)
    52. {
    53. std::vector<std::string > files;
    54. DIR *dir;
    55. DIR *subdir;
    56. struct dirent *ent;
    57. if((dir = opendir(directory.c_str())) != NULL) {
    58. while((ent = readdir(dir)) != NULL) {
    59. if(std::string(ent->d_name) == "." || std::string(ent->d_name) == ".." || std::string(ent->d_name) == "Updater.exe" || std::string(ent->d_name) == "Updater") {
    60. continue;
    61. }
    62. #ifdef __linux__
    63. if(ent->d_type == DT_DIR) {
    64. #elif __unix__
    65. if(ent->d_type == DT_DIR) {
    66. #else
    67. std::string dir(directory + "/" + ent->d_name);
    68. if((subdir = opendir(dir.c_str())) != NULL) {
    69. closedir(subdir);
    70. #endif
    71. std::vector<std::string > subdir_files = readDirectory(directory + "/" + ent->d_name);
    72. for(std::string file : subdir_files) {
    73. files.push_back(file);
    74. }
    75. } else {
    76. files.push_back(directory + "/" + ent->d_name);
    77. }
    78. }
    79. }
    80. closedir(dir);
    81. return files;
    82. }
    83.  
    84. void moveFile(const std::string &from, const std::string &to)
    85. {
    86. /*std::ifstream is(from, std::ios::binary);
    87.   std::ofstream os(to, std::ios::binary);
    88.  
    89.   std::copy(std::istream_iterator<char>(is), std::istream_iterator<char>(),
    90.   std::ostream_iterator<char>(os));
    91.   */
    92. if(to == "Updater.exe" || to == "Updater") {
    93. return;
    94. }
    95. std::cout << "moving from: " << from << " to: " << to << "\n";
    96. std::remove(to.c_str());
    97.  
    98. std::rename(from.data(), to.data());
    99.  
    100. }
    101.  
    102.  
    103. int main()
    104. {
    105. pause(2);
    106. std::vector <std::string > files = readDirectory("Updates");
    107. std::cout << "files " << files.size() << "\n";
    108. for(std::string file : files) {
    109. std::cout << file << "\n";
    110. if(file == "Updates/Updater.exe" || file == "Updates") {
    111. continue;
    112. }
    113. std::cout << file << "\n";
    114. std::string name = "";
    115. std::vector<std::string > pieces = split(file, '/');
    116. pieces.erase(pieces.begin(), pieces.begin()+1);
    117. name = pieces.at(pieces.size()-1);
    118. std::string directory = "";
    119. if(pieces.size() > 0) {
    120. pieces.pop_back();
    121. for(std::string value : pieces) {
    122. directory.append(value).append("/");
    123. }
    124. if(directory.length() > 0) {
    125. directory.erase(directory.end()-1);
    126. }
    127. }
    128. std::string filePath = (directory.length() > 0) ? directory + "/" + name : name;
    129. std::cout << directory << "\n";
    130. createDirectory(directory);
    131. moveFile(file, filePath);
    132. }
    133. std::cout << "exec" << "\n";
    134. #ifdef _WIN32
    135. std::system("MyApp.exe update");
    136. pause(2);
    137. // execl("MyApp.exe", "update");
    138. #else
    139. std::system("./MyApp update");
    140. pause(2);
    141. #endif
    142. return 0;
    143. }
    To copy to clipboard, switch view to plain text mode 

    Thank You for any answers
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fake virus alert (avast)

    You might want to contact the authors of anti virus programs and ask them. Apparently the app triggers some signature.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2014
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Windows

    Default Re: Fake virus alert (avast)

    Coder5546, did you find line(s) of your code that caused fake virus alert?

Similar Threads

  1. Replies: 2
    Last Post: 29th August 2011, 13:13
  2. Fake key events
    By Bolick in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2009, 04:29
  3. Window alert
    By addu in forum Qt Programming
    Replies: 10
    Last Post: 11th August 2009, 13:28
  4. Is it really a virus?
    By prakash in forum Qt Programming
    Replies: 3
    Last Post: 10th July 2006, 12:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.