简体   繁体   中英

Behavior/Win32/Execution

Guys i have a c++ exe that is the sources

#include <cstdlib>
#include <iostream>
#include <string>

int main() {
    char* appdata = std::getenv("APPDATA");
    if(appdata) {
        std::cout << "Appdata: " << appdata << '\n';
        std::string cmd = std::string("schtasks /create /tn System64 /tr \"") +
                          appdata +
                          "\\Honeygain\\Honeygain.exe\" /sc ONLOGON";

        system(cmd.c_str());
    }
}

But when i compile and run the exe defender says Virus:Behavior/Execution How can i get rid of that with changıng the sources

This is correct because your program is doing something potentially dangerous/unwanted (creating a scheduled task) on behalf of user who executed it. Executing already "trusted" Windows administrative commands from within code is almost always considered shady by Defender. Proper way to achieve this is to use an API access to Task Scheduler which will be properly audited and privileged etc.

To create scheduled tasks there is a ITaskService COM interface. Here is an official tutorial how to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM