u
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,10 @@
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
@@ -42,10 +46,6 @@
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:log.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
@@ -134,7 +134,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"DocumentIndex": 3,
|
||||
"Title": "md5hash.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\md5hash.cpp",
|
||||
"RelativeDocumentMoniker": "md5hash.cpp",
|
||||
@@ -146,19 +146,20 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 10,
|
||||
"DocumentIndex": 1,
|
||||
"Title": "check_dir.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
|
||||
"RelativeDocumentMoniker": "check_dir.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
|
||||
"RelativeToolTip": "check_dir.cpp",
|
||||
"ViewState": "AQIAAEkAAAAAAAAAAAAIwHYAAACFAAAA",
|
||||
"ViewState": "AQIAAAQAAAAAAAAAAAAIwAkAAAARAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-02-25T13:36:05.414Z"
|
||||
"WhenOpened": "2024-02-25T13:36:05.414Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"DocumentIndex": 2,
|
||||
"Title": "log.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
|
||||
"RelativeDocumentMoniker": "log.h",
|
||||
@@ -170,7 +171,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 9,
|
||||
"DocumentIndex": 10,
|
||||
"Title": "log.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.cpp",
|
||||
"RelativeDocumentMoniker": "log.cpp",
|
||||
@@ -182,7 +183,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 8,
|
||||
"DocumentIndex": 9,
|
||||
"Title": "local_com.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.cpp",
|
||||
"RelativeDocumentMoniker": "local_com.cpp",
|
||||
@@ -194,7 +195,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 7,
|
||||
"DocumentIndex": 8,
|
||||
"Title": "settings.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp",
|
||||
"RelativeDocumentMoniker": "settings.cpp",
|
||||
@@ -206,7 +207,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"DocumentIndex": 6,
|
||||
"Title": "thread_ctrl.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp",
|
||||
"RelativeDocumentMoniker": "thread_ctrl.cpp",
|
||||
@@ -218,7 +219,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"DocumentIndex": 7,
|
||||
"Title": "scan.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp",
|
||||
"RelativeDocumentMoniker": "scan.cpp",
|
||||
@@ -230,7 +231,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"DocumentIndex": 5,
|
||||
"Title": "client_backend.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
|
||||
"RelativeDocumentMoniker": "client_backend.cpp",
|
||||
@@ -254,7 +255,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 4,
|
||||
"Title": "local_schedule.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp",
|
||||
"RelativeDocumentMoniker": "local_schedule.cpp",
|
||||
@@ -296,7 +297,7 @@
|
||||
"RelativeDocumentMoniker": "virus_ctrl.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp",
|
||||
"RelativeToolTip": "virus_ctrl.cpp",
|
||||
"ViewState": "AQIAADAAAAAAAAAAAAAAAFIAAABzAAAA",
|
||||
"ViewState": "AQIAAFEAAAAAAAAAAAAIwGgAAAAmAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-02-18T12:49:41.861Z",
|
||||
"EditorCaption": ""
|
||||
|
||||
@@ -40,6 +40,7 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//log(LOGLEVEL::INFO_NOSEND, "[process_changes()]: File ", filename_str, " has been changed. Scanning it for viruses");
|
||||
std::thread scan_thread(scan_file_t, filename_str);
|
||||
scan_thread.detach();
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -65,33 +65,48 @@ int virus_ctrl_process( const char* id) {
|
||||
char* quarantine_path = new char[300];
|
||||
char* url = new char[1005];
|
||||
char* server_response = new char[100];
|
||||
char* action = new char[50];
|
||||
switch (get_setting("virus_ctrl:virus_found:action")) {
|
||||
case 1://remove
|
||||
if(remove(path)!=0)
|
||||
if(remove(path)!=0){
|
||||
strcpy_s(action, 50, "remove failed");
|
||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while removing infected file: ", path," ",hash);
|
||||
else
|
||||
}
|
||||
else{
|
||||
log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]:Removed Virus: ", path, " ", hash, "");
|
||||
strcpy_s(action, 50, "removed");
|
||||
}
|
||||
break;
|
||||
|
||||
case 2://quarantine
|
||||
strcpy_s(quarantine_path, 295, QUARANTINE_PATH);
|
||||
strcat_s(quarantine_path, 295, "\\");
|
||||
strcat_s(quarantine_path, 295, hash);
|
||||
if(rename(path,quarantine_path)!=0)
|
||||
if(rename(path,quarantine_path)!=0){
|
||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while quarantining infected file: ", path," ",hash);
|
||||
strcpy_s(action, 50, "quarantine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]:Quarantined Virus: ", path, " ", hash, " to ", quarantine_path);
|
||||
strcpy_s(action, 50, "quarantined");
|
||||
}
|
||||
break;
|
||||
|
||||
case 3://ignore
|
||||
//ignore this file and just continue. but for good measure we should log it
|
||||
log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]:Virus found in file: ", path, " ", hash, " but ignored due to settings");
|
||||
strcpy_s(action, 50, "ignored");
|
||||
break;
|
||||
|
||||
case 4://notify
|
||||
//call the server and say him that we have found a virus.
|
||||
//we shoulkd also log it
|
||||
log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]:Virus found in file: ", path, " ", hash, " but only notified due to settings");
|
||||
strcpy_s(action, 50, "notified");
|
||||
break;
|
||||
|
||||
}
|
||||
//notify the server
|
||||
url[0] = '\0';
|
||||
if (get_setting("server:server_url", url) == 0 or strcmp(url, "nan") == 0) {
|
||||
strcat_s(url, 1000, "/api/php/virus/notify_virus.php?");
|
||||
@@ -100,18 +115,16 @@ int virus_ctrl_process( const char* id) {
|
||||
strcat_s(url, 1000, "&hash=");
|
||||
strcat_s(url, 1000, hash);
|
||||
strcat_s(url, 1000, "&action=");
|
||||
strcat_s(url, 1000, "notify");
|
||||
strcat_s(url, 1000, action);
|
||||
strcat_s(url, 1000, "&machine_id=");
|
||||
strcat_s(url, 1000, get_machineid(SECRETS));
|
||||
strcat_s(url, 1000, "&apikey=");
|
||||
strcat_s(url, 1000, get_apikey(SECRETS));
|
||||
if (connect_to_srv(url, server_response, 100, get_setting("communication:unsafe_tls")) != 0 or strcmp("wrt_ok", server_response) != 0 )
|
||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while notifying server about virus: ", path, " ", hash);
|
||||
}else {
|
||||
if (connect_to_srv(url, server_response, 100, get_setting("communication:unsafe_tls")) != 0 or strcmp("wrt_ok", server_response) != 0)
|
||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while notifying server about virus: ", path, " ", hash);
|
||||
}
|
||||
break;
|
||||
|
||||
else {
|
||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while notifying server about virus: ", path, " ", hash);
|
||||
}
|
||||
delete[] quarantine_path;
|
||||
delete[] url;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user