diff --git a/src/client_backend/.vs/client_backend/v17/.suo b/src/client_backend/.vs/client_backend/v17/.suo index 5a5823b..8a40954 100644 Binary files a/src/client_backend/.vs/client_backend/v17/.suo and b/src/client_backend/.vs/client_backend/v17/.suo differ diff --git a/src/client_backend/.vs/client_backend/v17/Browse.VC.db b/src/client_backend/.vs/client_backend/v17/Browse.VC.db index 03a871e..01cf8b7 100644 Binary files a/src/client_backend/.vs/client_backend/v17/Browse.VC.db and b/src/client_backend/.vs/client_backend/v17/Browse.VC.db differ diff --git a/src/client_backend/.vs/client_backend/v17/DocumentLayout.json b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json index 297a36e..665525f 100644 --- a/src/client_backend/.vs/client_backend/v17/DocumentLayout.json +++ b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json @@ -2,77 +2,77 @@ "Version": 1, "WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\", "Documents": [ - { - "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\\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\\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}" }, { - "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\md5hash.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:md5hash.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\\local_schedule.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_schedule.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\\client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:client_backend.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\\thread_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:thread_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\\scan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.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\\settings.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.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\\local_com.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_com.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.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\\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}" - }, - { - "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_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_process.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\\app_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:app_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\\permissions.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:permissions.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\\connect.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.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\\update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.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\\client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:client_backend.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\\settings.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.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\\queue _ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue _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\\connect.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.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\\local_schedule.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_schedule.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\\thread_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:thread_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\\settings.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.h||{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\\scan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.h||{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\\queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue_ctrl.h||{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\\connect.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.h||{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\\scan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.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\\update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.h||{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\\local_com.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_com.h||{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\\virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" } ], "DocumentGroupContainers": [ @@ -82,79 +82,45 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 17, + "SelectedChildIndex": 0, "Children": [ { "$type": "Document", - "DocumentIndex": 11, - "Title": "security.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp", - "RelativeDocumentMoniker": "security.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp", - "RelativeToolTip": "security.cpp", - "ViewState": "AQIAABsAAAAAAAAAAAAAADoAAAA2AAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-12T10:18:22.033Z" - }, - { - "$type": "Document", - "DocumentIndex": 14, - "Title": "permissions.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\permissions.cpp", - "RelativeDocumentMoniker": "permissions.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\permissions.cpp", - "RelativeToolTip": "permissions.cpp", - "ViewState": "AQIAAAQAAAAAAAAAAAAIwDsAAAAAAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-12T10:18:17.369Z" - }, - { - "$type": "Document", - "DocumentIndex": 13, - "Title": "app_ctrl.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\app_ctrl.cpp", - "RelativeDocumentMoniker": "app_ctrl.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\app_ctrl.cpp", - "RelativeToolTip": "app_ctrl.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAAPAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-12T10:10:59.685Z" - }, - { - "$type": "Document", - "DocumentIndex": 12, - "Title": "check_process.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp", - "RelativeDocumentMoniker": "check_process.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp", - "RelativeToolTip": "check_process.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAARAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-10T14:40:03.094Z" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "md5hash.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\md5hash.cpp", - "RelativeDocumentMoniker": "md5hash.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\md5hash.cpp", - "RelativeToolTip": "md5hash.cpp", - "ViewState": "AQIAACQAAAAAAAAAAAAAADUAAAA1AAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-09T19:22:09.647Z" - }, - { - "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 0, "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": "AQIAAAQAAAAAAAAAAAAIwAkAAAARAAAA", + "ViewState": "AQIAAEsAAAAAAAAAAAAAAHkAAAAwAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-02-25T13:36:05.414Z", + "WhenOpened": "2024-03-13T06:48:31.009Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "thread_ctrl.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", + "RelativeDocumentMoniker": "thread_ctrl.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", + "RelativeToolTip": "thread_ctrl.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABgAAABuAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-03-13T06:52:01.533Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 16, + "Title": "local_com.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", + "RelativeDocumentMoniker": "local_com.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", + "RelativeToolTip": "local_com.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:49:41.823Z", "EditorCaption": "" }, { @@ -165,69 +131,127 @@ "RelativeDocumentMoniker": "log.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h", "RelativeToolTip": "log.h", - "ViewState": "AQIAAFMAAAAAAAAAAAAkwFsAAAAjAAAA", + "ViewState": "AQIAAE8AAAAAAAAAAAD4v2YAAAARAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2024-02-25T09:02:55.874Z" + "WhenOpened": "2024-03-13T06:47:02.038Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 10, - "Title": "log.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.cpp", - "RelativeDocumentMoniker": "log.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.cpp", - "RelativeToolTip": "log.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAB8AAAAFAAAA", + "DocumentIndex": 17, + "Title": "virus_ctrl.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h", + "RelativeDocumentMoniker": "virus_ctrl.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h", + "RelativeToolTip": "virus_ctrl.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:45:51.845Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 13, + "Title": "connect.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", + "RelativeDocumentMoniker": "connect.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", + "RelativeToolTip": "connect.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAA4AAABZAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:44:13.879Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 12, + "Title": "queue_ctrl.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", + "RelativeDocumentMoniker": "queue_ctrl.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", + "RelativeToolTip": "queue_ctrl.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:43:48.22Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "queue _ctrl.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", + "RelativeDocumentMoniker": "queue _ctrl.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", + "RelativeToolTip": "queue _ctrl.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-02-25T09:08:59.07Z" + "WhenOpened": "2024-01-28T20:40:06.295Z", + "EditorCaption": "" }, { "$type": "Document", - "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", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.cpp", - "RelativeToolTip": "local_com.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAADYAAAAYAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.217Z" + "DocumentIndex": 15, + "Title": "update.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", + "RelativeDocumentMoniker": "update.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", + "RelativeToolTip": "update.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAXAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:42:28.196Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 6, "Title": "settings.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp", "RelativeDocumentMoniker": "settings.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp", "RelativeToolTip": "settings.cpp", - "ViewState": "AQIAAMwAAAAAAAAAAAAIwAMBAAAAAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.264Z" + "WhenOpened": "2024-03-13T06:48:40.364Z", + "EditorCaption": "" }, { "$type": "Document", - "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", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", - "RelativeToolTip": "thread_ctrl.cpp", - "ViewState": "AQIAABUAAAAAAAAAAAAAADMAAAAFAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.264Z" + "DocumentIndex": 10, + "Title": "settings.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", + "RelativeDocumentMoniker": "settings.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", + "RelativeToolTip": "settings.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:42:03.328Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 11, + "Title": "scan.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h", + "RelativeDocumentMoniker": "scan.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h", + "RelativeToolTip": "scan.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAAvAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:41:43.701Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 14, "Title": "scan.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp", "RelativeDocumentMoniker": "scan.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp", "RelativeToolTip": "scan.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAKEAAAAAAAAA", + "ViewState": "AQIAANQAAAAAAAAAAAAkwPAAAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.248Z" + "WhenOpened": "2024-01-28T20:40:06.248Z", + "EditorCaption": "" }, { "$type": "Document", @@ -237,67 +261,59 @@ "RelativeDocumentMoniker": "client_backend.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp", "RelativeToolTip": "client_backend.cpp", - "ViewState": "AQIAADMAAAAAAAAAAAAAAFsAAAAhAAAA", + "ViewState": "AQIAAC0AAAAAAAAAAAAAADwAAAAoAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.279Z" + "WhenOpened": "2024-01-28T20:40:06.279Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 15, + "DocumentIndex": 4, "Title": "update.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", "RelativeDocumentMoniker": "update.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", "RelativeToolTip": "update.cpp", - "ViewState": "AQIAACwAAAAAAAAAAAAkwFIAAAAWAAAA", + "ViewState": "AQIAABAAAAAAAAAAAAAkwDcAAAAkAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.248Z" + "WhenOpened": "2024-01-28T20:40:06.248Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 8, "Title": "local_schedule.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", "RelativeDocumentMoniker": "local_schedule.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", "RelativeToolTip": "local_schedule.cpp", - "ViewState": "AQIAAGYAAAAAAAAAAAAAAJoAAAAaAAAA", + "ViewState": "AQIAAFUAAAAAAAAAAAAkwIYAAAAiAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.279Z" + "WhenOpened": "2024-01-28T20:40:06.279Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 16, - "Title": "queue _ctrl.cpp", - "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", - "RelativeDocumentMoniker": "queue _ctrl.cpp", - "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", - "RelativeToolTip": "queue _ctrl.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAACsAAAABAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.295Z" - }, - { - "$type": "Document", - "DocumentIndex": 17, + "DocumentIndex": 3, "Title": "connect.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", "RelativeDocumentMoniker": "connect.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", "RelativeToolTip": "connect.cpp", - "ViewState": "AQIAABQAAAAAAAAAAAAkwEAAAAAVAAAA", + "ViewState": "AQIAAD4AAAAAAAAAAAAkwE8AAAAQAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.315Z" + "WhenOpened": "2024-01-28T20:40:06.315Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 1, "Title": "virus_ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp", "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": "AQIAAFEAAAAAAAAAAAAIwGgAAAAmAAAA", + "ViewState": "AQIAAEMAAAAAAAAAAAD4v2sAAAAaAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-02-18T12:49:41.861Z", "EditorCaption": "" diff --git a/src/client_backend/.vs/client_backend/v17/DocumentLayout.json~RF245c3d2.TMP b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json~RF245c3d2.TMP new file mode 100644 index 0000000..4e42b29 --- /dev/null +++ b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json~RF245c3d2.TMP @@ -0,0 +1,326 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\", + "Documents": [ + { + "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\\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}" + }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.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\\update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.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\\client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:client_backend.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\\settings.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.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\\queue _ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue _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\\local_schedule.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_schedule.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\\thread_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:thread_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\\settings.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.h||{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\\scan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.h||{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\\queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue_ctrl.h||{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\\connect.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.h||{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\\scan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.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\\update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.h||{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\\local_com.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_com.h||{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\\virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 17, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "thread_ctrl.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", + "RelativeDocumentMoniker": "thread_ctrl.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", + "RelativeToolTip": "thread_ctrl.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABgAAABuAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-03-13T06:52:01.533Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 16, + "Title": "local_com.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", + "RelativeDocumentMoniker": "local_com.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", + "RelativeToolTip": "local_com.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:49:41.823Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 10, + "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": "AQIAAAwAAAAAAAAAAAAAACwAAAAKAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-03-13T06:48:31.009Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "log.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h", + "RelativeDocumentMoniker": "log.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h", + "RelativeToolTip": "log.h", + "ViewState": "AQIAAE8AAAAAAAAAAAD4v2YAAAARAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:47:02.038Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 17, + "Title": "virus_ctrl.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h", + "RelativeDocumentMoniker": "virus_ctrl.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h", + "RelativeToolTip": "virus_ctrl.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:45:51.845Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 13, + "Title": "connect.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", + "RelativeDocumentMoniker": "connect.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", + "RelativeToolTip": "connect.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAA4AAABZAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:44:13.879Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 12, + "Title": "queue_ctrl.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", + "RelativeDocumentMoniker": "queue_ctrl.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", + "RelativeToolTip": "queue_ctrl.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:43:48.22Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "queue _ctrl.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", + "RelativeDocumentMoniker": "queue _ctrl.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", + "RelativeToolTip": "queue _ctrl.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.295Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 15, + "Title": "update.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", + "RelativeDocumentMoniker": "update.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", + "RelativeToolTip": "update.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAXAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:42:28.196Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "settings.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp", + "RelativeDocumentMoniker": "settings.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp", + "RelativeToolTip": "settings.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-03-13T06:48:40.364Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "settings.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", + "RelativeDocumentMoniker": "settings.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", + "RelativeToolTip": "settings.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:42:03.328Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 11, + "Title": "scan.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h", + "RelativeDocumentMoniker": "scan.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h", + "RelativeToolTip": "scan.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAAvAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-03-13T06:41:43.701Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 14, + "Title": "scan.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp", + "RelativeDocumentMoniker": "scan.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp", + "RelativeToolTip": "scan.cpp", + "ViewState": "AQIAANQAAAAAAAAAAAAkwPAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.248Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "client_backend.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp", + "RelativeDocumentMoniker": "client_backend.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp", + "RelativeToolTip": "client_backend.cpp", + "ViewState": "AQIAAC0AAAAAAAAAAAAAADwAAAAoAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.279Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "update.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", + "RelativeDocumentMoniker": "update.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", + "RelativeToolTip": "update.cpp", + "ViewState": "AQIAABAAAAAAAAAAAAAkwDcAAAAkAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.248Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "local_schedule.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", + "RelativeDocumentMoniker": "local_schedule.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", + "RelativeToolTip": "local_schedule.cpp", + "ViewState": "AQIAAFUAAAAAAAAAAAAkwIYAAAAiAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.279Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "connect.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", + "RelativeDocumentMoniker": "connect.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", + "RelativeToolTip": "connect.cpp", + "ViewState": "AQIAAD4AAAAAAAAAAAAkwE8AAAAQAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-01-28T20:40:06.315Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "virus_ctrl.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp", + "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": "AQIAAEAAAAAAAAAAAAD4v2YAAAA8AAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-02-18T12:49:41.861Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/client_backend/check_dir.cpp b/src/client_backend/check_dir.cpp index a66c6a7..bd18dcf 100644 --- a/src/client_backend/check_dir.cpp +++ b/src/client_backend/check_dir.cpp @@ -7,9 +7,11 @@ #include "scan.h" #include "app_ctrl.h" #include "virus_ctrl.h" -#include "scan.h" #include "settings.h" #include // Include the mutex header +#include // Include the algorithm header +#include // Include the string header +#include // Include the iostream header // Define a mutex for thread synchronization std::mutex monitorMutex; @@ -117,7 +119,7 @@ void monitor_directory(LPCSTR directory) { buffer, bufferSize, TRUE, - FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE |FILE_NOTIFY_CHANGE_CREATION|FILE_NOTIFY_CHANGE_SIZE, + FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_CREATION, NULL, &overlapped, NULL) == 0) { diff --git a/src/client_backend/check_process.cpp b/src/client_backend/check_process.cpp index 3c9b241..fe04614 100644 --- a/src/client_backend/check_process.cpp +++ b/src/client_backend/check_process.cpp @@ -6,6 +6,8 @@ #include "settings.h" #include "scan.h" #include // Include the mutex header +#include // Include the thread header +#include // Include the Windows header std::mutex mtx; // Declare a mutex for thread synchronization @@ -44,7 +46,7 @@ void monitor_processes() { char path[MAX_PATH]; if (GetModuleFileNameEx(hProcess, NULL, exePath, MAX_PATH) > 0) { strcpy_s(path, MAX_PATH, exePath); - for (int z = 0; z < strlen(path); z++) + for (size_t z = 0; z < strlen(path); z++) path[z] = tolower(path[z]); if (!is_folder_included(path) || is_folder_excluded(path)) { @@ -70,10 +72,11 @@ void monitor_processes() { log(LOGLEVEL::ERR, "[monitor_processes()]: Error enumerating processes"); } } + void process_scanner() { - //we are in a thread so we can do this, unlimited resources wuhuiii + // We are in a thread so we can do this, unlimited resources while (!app_stop()) { - monitor_processes(); + monitor_processes(); Sleep(1000); // Sleep for 1 second - } -} \ No newline at end of file + } +} diff --git a/src/client_backend/client_backend.cpp b/src/client_backend/client_backend.cpp index cd4d615..8aad263 100644 --- a/src/client_backend/client_backend.cpp +++ b/src/client_backend/client_backend.cpp @@ -26,6 +26,7 @@ int main() { log(LOGLEVEL::INFO_NOSEND, "[main()]:Starting main thread."); int err = 0; printf("welcome to the jakach security tool main thread\n"); + //exit(0); if (load_settings() == 0) {//load the settings from the settings file if (update_settings("settings")!=0) { //update the settings from the server log(LOGLEVEL::ERR_NOSEND, "[main()]:Could not update settings (settings) from server."); @@ -46,7 +47,6 @@ int main() { log(LOGLEVEL::PANIC_NOSEND, "[main()]:Panic, no settings file loaded, terminating process!"); exit(1); } - // Initialize hash databases err = initialize(DB_DIR); if (err != 0) { @@ -97,11 +97,7 @@ int main() { if (can_run_thread()) { int queue_size = get_queue_size(); for (int i = 0; i < queue_size; i++) { - char* queue_entry = new char[300 * 2 + 5]; - queue_entry[0] = '\0'; - queue_pop(queue_entry); - start_thread(queue_entry); - delete[] queue_entry; + start_thread(queue_pop()); } } diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.ilk b/src/client_backend/client_backend/x64/Debug/client_backend.ilk index 2e4da78..c996c88 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.ilk and b/src/client_backend/client_backend/x64/Debug/client_backend.ilk differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.log b/src/client_backend/client_backend/x64/Debug/client_backend.log index b7bab43..62f1918 100644 --- a/src/client_backend/client_backend/x64/Debug/client_backend.log +++ b/src/client_backend/client_backend/x64/Debug/client_backend.log @@ -1,3 +1,36 @@  Quellen werden auf Modulabhängigkeiten überprüft... - virus_ctrl.cpp + check_dir.cpp +C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xutility(4537,18): warning C4244: "=": Konvertierung von "wchar_t" in "char", möglicher Datenverlust + (Quelldatei „check_dir.cpp“ wird kompiliert) + C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xutility(4537,18): + der Vorlageninstanziierungskontext (der älteste zuerst) ist + C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\check_dir.cpp(35,29): + Siehe Verweis auf die gerade kompilierte Instanziierung "std::basic_string,std::allocator>::basic_string>>,0>(_Iter,_Iter,const _Alloc &)" der Funktions-Vorlage. + with + [ + _Elem=wchar_t, + _Iter=std::_String_iterator>>, + _Alloc=std::allocator + ] + C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\check_dir.cpp(35,29): + Ersten Verweis auf "std::basic_string,std::allocator>::basic_string" in "process_changes" anzeigen + C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xstring(2600,17): + Siehe Verweis auf die gerade kompilierte Instanziierung "void std::basic_string,std::allocator>::_Construct_from_iter(_Iter,const _Sent,_Size)" der Funktions-Vorlage. + with + [ + _Size_type=unsigned __int64, + _Iter=wchar_t *, + _Sent=wchar_t *, + _Size=unsigned __int64 + ] + C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xstring(2756,18): + Siehe Verweis auf die gerade kompilierte Instanziierung "_OutIt *std::_Copy_n_unchecked4(_InIt,_SizeTy,_OutIt)" der Funktions-Vorlage. + with + [ + _OutIt=char *, + _Size=unsigned __int64, + _InIt=wchar_t *, + _SizeTy=unsigned __int64 + ] + client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog index be229aa..252d825 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog index 344d108..a72aed1 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog index 5ba9e07..04cb7c5 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/client_backend.write.1u.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/client_backend.write.1u.tlog index eedc974..326d7be 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/client_backend.write.1u.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/client_backend.write.1u.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/vc143.idb b/src/client_backend/client_backend/x64/Debug/vc143.idb index 6e8db4c..d340fd0 100644 Binary files a/src/client_backend/client_backend/x64/Debug/vc143.idb and b/src/client_backend/client_backend/x64/Debug/vc143.idb differ diff --git a/src/client_backend/client_backend/x64/Debug/vc143.pdb b/src/client_backend/client_backend/x64/Debug/vc143.pdb index ceec91d..d720510 100644 Binary files a/src/client_backend/client_backend/x64/Debug/vc143.pdb and b/src/client_backend/client_backend/x64/Debug/vc143.pdb differ diff --git a/src/client_backend/connect.cpp b/src/client_backend/connect.cpp index 1070fca..5e2173a 100644 --- a/src/client_backend/connect.cpp +++ b/src/client_backend/connect.cpp @@ -1,61 +1,63 @@ #pragma warning(disable:4996) #ifndef CONNECT_CPP #define CONNECT_CPP + #include "connect.h" #include "well_known.h" #include "security.h" +#include +#include - -int fast_send(const char * url,bool ignore_insecure) { - //send get rewuest to server, and cloe connection after maximum 1 second +int fast_send(const std::string& url, bool ignore_insecure) { CURL* curl; CURLcode res; curl = curl_easy_init(); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, url); - if(ignore_insecure==true) - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + if (ignore_insecure) + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); if (res == CURLE_OK) { - return 0; - } + return 0; + } else { - return res; - } - } + return res; + } + } return 1; } -static size_t write_callback_connect(void* contents, size_t size, size_t nmemb, void* userp) -{ + +static size_t write_callback_connect(void* contents, size_t size, size_t nmemb, void* userp) { ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } -int connect_to_srv(const char*url,char*out,int max_len, bool ignore_insecure) { +int connect_to_srv(const std::string& url, char* out, int max_len, bool ignore_insecure) { CURL* curl; CURLcode res; std::string readBuffer; curl = curl_easy_init(); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback_connect); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); - if(ignore_insecure==true) + if (ignore_insecure) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); res = curl_easy_perform(curl); curl_easy_cleanup(curl); - if (max_len > (int)strlen(readBuffer.c_str())) { + if (max_len > (int)readBuffer.length()) { strcpy(out, readBuffer.c_str()); return 0; } else - return 1; + return 1; } return 2; } + size_t write_callback_download(void* contents, size_t size, size_t nmemb, void* userp) { size_t totalSize = size * nmemb; FILE* file = (FILE*)userp; @@ -65,12 +67,11 @@ size_t write_callback_download(void* contents, size_t size, size_t nmemb, void* return totalSize; } -int download_file_from_srv(const char* url, const char* output_file_path, bool ignore_insecure) { - //use curl to download a file from a server - char*temp_path = new char[515]; - char* buf = new char[505]; - strcpy_s(temp_path,495, output_file_path); - strcat_s(temp_path,505, ".temp"); +int download_file_from_srv(const std::string& url, const std::string& output_file_path, bool ignore_insecure) { + char* temp_path = new char[output_file_path.size() + 6]; + strcpy(temp_path, output_file_path.c_str()); + strcat(temp_path, ".temp"); + CURL* curl; CURLcode res; FILE* output_file; @@ -78,137 +79,111 @@ int download_file_from_srv(const char* url, const char* output_file_path, bool i curl = curl_easy_init(); if (!curl) { delete[] temp_path; - delete[] buf; return 1; } - // Set the URL to download - curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - // Create a file to write the downloaded data output_file = fopen(temp_path, "wb"); if (!output_file) { curl_easy_cleanup(curl); - delete [] temp_path; - delete[] buf; + delete[] temp_path; return 2; } - // Set the write callback function curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback_download); curl_easy_setopt(curl, CURLOPT_WRITEDATA, output_file); - if (ignore_insecure == true) + if (ignore_insecure) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - // Perform the download res = curl_easy_perform(curl); if (res != CURLE_OK) { fclose(output_file); delete[] temp_path; - delete[] buf; return 3; } - // Cleanup and close the file + curl_easy_cleanup(curl); fclose(output_file); + if ((output_file = fopen(temp_path, "r")) == 0) { delete[] temp_path; - delete[] buf; return 4; } else { + char buf[501]; fscanf(output_file, "%500s", buf); if (strcmp(buf, "no_auth") == 0) { fclose(output_file); delete[] temp_path; - delete[] buf; return 5; } - else if(check_cert(buf, SECRETS)==0){ - remove(output_file_path);//remove old file, so it can be overwritten + else if (check_cert(buf, SECRETS) == 0) { + remove(output_file_path.c_str()); fclose(output_file); - if (rename(temp_path, output_file_path)!=0) { + if (rename(temp_path, output_file_path.c_str()) != 0) { delete[] temp_path; - delete[] buf; - return 6; + return 6; } - }else { - fclose(output_file); - delete[] temp_path; - delete[] buf; + } + else { + fclose(output_file); + delete[] temp_path; return 7; } } - delete[] buf; + delete[] temp_path; return 0; } -char* url_encode(const char* input) { - // Allocate memory for the encoded string (worst case: every character needs encoding) - size_t input_len = strlen(input); - char* encoded = (char*)malloc(input_len * 3 + 1); // +1 for null terminator - if (!encoded) { - fprintf(stderr, "Memory allocation failed\n"); - exit(EXIT_FAILURE); - } - - // Define the characters that don't need encoding - const char* safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"; - - // Initialize variables for input and output string indices - size_t i = 0; // index for input string - size_t j = 0; // index for output string - - // Loop through each character in the input string - while (input[i]) { - // Check if the character is a safe character - if (strchr(safe_chars, input[i]) != NULL) { - encoded[j++] = input[i++]; // Copy safe character as is +std::string url_encode(const std::string& input) { + static const char* const safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"; + std::string encoded; + for (char c : input) { + if (std::strchr(safe_chars, c) != nullptr) { + encoded += c; } else { - // Encode non-safe character as percent-encoded representation - sprintf(encoded + j, "%%%02X", (unsigned char)input[i]); - j += 3; // Increment output index by 3 to account for encoding (%XX) - i++; // Move to the next character in the input string + char temp[4]; + sprintf(temp, "%%%02X", (unsigned char)c); + encoded += temp; } } - - // Null-terminate the encoded string - encoded[j] = '\0'; - return encoded; } -int upload_to_srv(const char* url, const char* filepath,bool ignore_insecure) { - //upload a file to the server +int upload_to_srv(const std::string& url, const std::string& filepath, bool ignore_insecure) { CURL* curl; CURLcode res; - struct curl_httppost* formpost = NULL; - struct curl_httppost* lastptr = NULL; - struct curl_slist* headerlist = NULL; + struct curl_httppost* formpost = nullptr; + struct curl_httppost* lastptr = nullptr; + struct curl_slist* headerlist = nullptr; static const char buf[] = "Expect:"; + curl_global_init(CURL_GLOBAL_ALL); - curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "file", CURLFORM_FILE, filepath, CURLFORM_END); + curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "file", CURLFORM_FILE, filepath.c_str(), CURLFORM_END); + curl = curl_easy_init(); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, url); - if(ignore_insecure==true) - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - headerlist = curl_slist_append(headerlist, buf); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - curl_formfree(formpost); - curl_slist_free_all(headerlist); - if (res == CURLE_OK) { - return 0; - } - else { - return 1; - } - } + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + if (ignore_insecure) + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + headerlist = curl_slist_append(headerlist, buf); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + curl_formfree(formpost); + curl_slist_free_all(headerlist); + if (res == CURLE_OK) { + return 0; + } + else { + return 1; + } + } return 2; } -#endif \ No newline at end of file + +#endif diff --git a/src/client_backend/connect.h b/src/client_backend/connect.h index a2cd56d..0644595 100644 --- a/src/client_backend/connect.h +++ b/src/client_backend/connect.h @@ -5,8 +5,14 @@ #include #include #include -int connect_to_srv(const char* url, char* out, int max_len, bool ignore_insecure); -int download_file_from_srv(const char* url, const char* outputFileName,bool ignore_insecure); -int fast_send(const char* url, bool ignore_insecure); -char* url_encode(const char* input); -int upload_to_srv(const char* url, const char* filepath, bool ignore_insecure); \ No newline at end of file +//int connect_to_srv(const char* url, char* out, int max_len, bool ignore_insecure); +//int download_file_from_srv(const char* url, const char* outputFileName,bool ignore_insecure); +//int fast_send(const char* url, bool ignore_insecure); +//char* url_encode(const char* input); +//int upload_to_srv(const char* url, const char* filepath, bool ignore_insecure); + +int fast_send(const std::string& url, bool ignore_insecure); +int connect_to_srv(const std::string& url, char* out, int max_len, bool ignore_insecure); +int download_file_from_srv(const std::string& url, const std::string& outputFileName, bool ignore_insecure); +int upload_to_srv(const std::string& url, const std::string& filepath, bool ignore_insecure); +std::string url_encode(const std::string& input); \ No newline at end of file diff --git a/src/client_backend/local_com.cpp b/src/client_backend/local_com.cpp index 9941b60..9480fa1 100644 --- a/src/client_backend/local_com.cpp +++ b/src/client_backend/local_com.cpp @@ -2,54 +2,33 @@ #define LOCAL_COM_CPP #include "local_com.h" -int check_for_com_tasks(const char* com_name, const char* com_path) { - //check for new tasks in com file and add them into the queue - FILE* fp=nullptr; - char* command=new char [300]; - if ((fopen_s(&fp,com_path, "r")) != 0) { - //no com file found = no communication needed - delete[] command; - return 1; - } - else { - while (!feof(fp)) { - fscanf_s(fp, "%s", command, 295); // get the command - if (!feof(fp)) { //last line =\n we dont want to process that - //we scanned the command, now we will scan the path. If the process does not need a path the path will be nopath. (set from client) - //get a full path. => " = start, second "= end - char* path = new char[300]; - path[0] = '\0'; - //search for starting ", then loop until ending " - int cnt = 0; - int chr = 0; - fgetc(fp); - fgetc(fp); - while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char - if(chr!='\"') - path[cnt] = chr; - path[cnt+1] = '\0'; - cnt++; - } - //printf("%s\n", path); - //we now have the command and the path. Now we will add it to the queue - char* queue_entry = new char[300*2+5]; //to enshure we have enough space - queue_entry[0] = '\0'; - strcpy_s(queue_entry,600, command); //copy the command - strcat_s(queue_entry, 600, ";"); //add a ; to seperate command and path - strcat_s(queue_entry, 600, path); //add the path +#include +#include +#include - queue_push(queue_entry); - //(queue_entry); - delete[] queue_entry; - delete[] path; - } - } - } +int check_for_com_tasks(const std::string& com_name, const std::string& com_path) { + std::ifstream file(com_path); - remove(com_path); - fclose(fp); - delete[] command; - return 0; + if (!file.is_open()) { + // No com file found = no communication needed + return 1; + } + + std::string command; + while (file >> command) { + // Scan the command + std::string path; + file >> path; // Scan the path + + // Add command and path to the queue + std::string queue_entry = command + ";" + path; + queue_push(queue_entry.c_str()); + } + + // Remove the com file after processing + file.close(); + std::remove(com_path.c_str()); + + return 0; } -#endif // !LOCAL_COM_CPP \ No newline at end of file +#endif // !LOCAL_COM_CPP diff --git a/src/client_backend/local_com.h b/src/client_backend/local_com.h index c02d13f..176e866 100644 --- a/src/client_backend/local_com.h +++ b/src/client_backend/local_com.h @@ -4,4 +4,4 @@ #include "queue_ctrl.h" #include "well_known.h" -int check_for_com_tasks(const char* com_name, const char* com_path); \ No newline at end of file +int check_for_com_tasks(const std::string& com_name, const std::string& com_path); diff --git a/src/client_backend/local_schedule.cpp b/src/client_backend/local_schedule.cpp index 64f9825..23d9965 100644 --- a/src/client_backend/local_schedule.cpp +++ b/src/client_backend/local_schedule.cpp @@ -1,16 +1,16 @@ #ifndef LOCAL_SCHEDULE_CPP #define LOCAL_SCHEDULE_CPP + #include "local_schedule.h" #include "queue_ctrl.h" #include "log.h" -/* -* To do: -* read scheduled tasks form file -* process time and date to determine if task should be executed -* add task to queue -*/ +#include +#include +#include +#include +#include +#include -// Map to store task execution states std::map task_states; bool is_valid_field(const std::string& field, int value) { @@ -18,22 +18,18 @@ bool is_valid_field(const std::string& field, int value) { return true; // Wildcard matches any value } - // Parse the field and check for matches std::istringstream iss(field); - std::vector tokens; std::string token; while (std::getline(iss, token, ',')) { - if (std::find(token.begin(), token.end(), '-') != token.end()) { - // Range of values + if (token.find('-') != std::string::npos) { int start, end; if (sscanf_s(token.c_str(), "%d-%d", &start, &end) == 2 && value >= start && value <= end) { return true; } } else { - // Single value int singleValue; - if (sscanf_s(token.c_str(), "%d", &singleValue) == 1 && value == singleValue) { + if (std::istringstream(token) >> singleValue && value == singleValue) { return true; } } @@ -50,136 +46,101 @@ bool is_task_due(const std::string& task_name, const std::string& cron_expressio fields.push_back(field); } - // Check if the 'fields' vector has at least 5 elements if (fields.size() < 5) { - // Handle the case where the cron expression is not well-formed return false; } - // Check if the task should be executed if (is_valid_field(fields[0], current_time.tm_min) && is_valid_field(fields[1], current_time.tm_hour) && is_valid_field(fields[2], current_time.tm_mday) && is_valid_field(fields[3], current_time.tm_mon + 1) && is_valid_field(fields[4], current_time.tm_wday + 1)) { - // Check if the task has not already been executed if (!task_states[task_name]) { - // Set the flag to indicate that the task has been executed task_states[task_name] = true; return true; } } else { - // Reset the flag task_states[task_name] = false; } return false; } + void unlock_task(const std::string& task_name) { - // Unlock the task by setting its state to false task_states[task_name] = false; } int check_for_sched_tasks(const char* sched_name, const char* sched_path) { FILE* fp = nullptr; - char* command = new char[505]; - if ((fopen_s(&fp, sched_path, "r")) != 0) { - //panic, create log entry, return 1; - //no schedule file found. this is not normal - //log(LOGLEVEL::ERR, "[check_for_sched_tasks()]: Error opening schedule file: ", sched_path, " while checking for scheduled tasks; aborting"); + char command[505]; + if (fopen_s(&fp, sched_path, "r") != 0) { delete[] command; return 1; } else { - fscanf_s(fp, "%s", command, 500); //the cert is always the firs tline - fgetc(fp); //get the newline + fscanf_s(fp, "%s", command, _countof(command)); + fgetc(fp); while (!feof(fp)) { if (!feof(fp)) { - //read date-time config. it starts with " and ends with " - char* datetime = new char[300]; - datetime[0] = '\0'; - //search for datetime, starting ", then loop until ending " + char datetime[300] = { '\0' }; int cnt = 0; int chr = 0; - chr = fgetc(fp);//read in the first ", or at least try it - //printf("%c\n", chr); + chr = fgetc(fp); if (chr == '\"') { chr = 0; while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char + chr = fgetc(fp); if (chr != '\"') datetime[cnt] = chr; datetime[cnt + 1] = '\0'; cnt++; - //printf("scanning...\n"); } } - //now we had datetime. we can scan the command and the path now - fscanf_s(fp, "%s", command, 295); // get the command - char* path = new char[300]; - path[0] = '\0'; - //search for arg, starting ", then loop until ending " + + fscanf_s(fp, "%s", command, _countof(command)); + char path[300] = { '\0' }; cnt = 0; chr = 0; - fgetc(fp); //get th ewhitespoace after the command - chr = fgetc(fp);//read in the first ", or at least try it - + fgetc(fp); + chr = fgetc(fp); if (chr == '\"') { chr = 0; while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char + chr = fgetc(fp); if (chr != '\"') path[cnt] = chr; path[cnt + 1] = '\0'; cnt++; } } - //now get the taskname - char* taskname = new char[300]; - taskname[0] = '\0'; - fscanf_s(fp, "%s", taskname, 295); // get the taskname - fgetc(fp); //get the newline - //lets check if the command should be executed - //get the current time + + char taskname[300] = { '\0' }; + fscanf_s(fp, "%s", taskname, _countof(taskname)); + fgetc(fp); + std::time_t t = std::time(nullptr); struct std::tm current_time; localtime_s(¤t_time, &t); - //printf("%s\n", datetime); - //log(LOGLEVEL::INFO, "[check_for_sched_tasks()]: Checking task: ", taskname, " with schedule: ", datetime); - if (strcmp(datetime, "") != 0 && strcmp(command, "") != 0 && strcmp(taskname, "") != 0) { - //log(LOGLEVEL::INFO, "[check_for_sched_tasks()]: Checking task: ", taskname, " with schedule: ", datetime); + if (strcmp(datetime, "") != 0 && strcmp(command, "") != 0 && strcmp(taskname, "") != 0) { if (is_task_due(taskname, datetime, current_time)) { - //printf("command:%s\n", command); - //printf("path:%s\n", path); - //now we can build up the command for the queue - char* queue_entry = new char[300 * 2 + 5]; //to enshure we have enough space + char queue_entry[600]; queue_entry[0] = '\0'; - strcpy_s(queue_entry, 600, command); //copy the command - strcat_s(queue_entry, 600, ";"); //add a ; to seperate command and path - strcat_s(queue_entry, 600, path); //add the path - + strcpy_s(queue_entry, command); + strcat_s(queue_entry, ";"); + strcat_s(queue_entry, path); + log(LOGLEVEL::INFO_NOSEND, "[check_for_sched_tasks()]:Pushing task to queue: ", queue_entry); queue_push(queue_entry); - delete[] queue_entry; } } - //else { - // printf("datetime:%s\n", datetime); - // printf("command:%s\n", command); - // printf("path:%s\n", path); - // printf("taskname:%s\n", taskname); - // log(LOGLEVEL::ERR, "[check_for_sched_tasks()]: Error reading schedule file: ", sched_path, " while checking for scheduled tasks (malformat); aborting"); - //} - delete[] datetime; - delete[] path; - delete[] taskname; + } } } - delete[] command; fclose(fp); return 0; } -#endif // !LOCAL_SCHEDULE_CPP \ No newline at end of file + +#endif // !LOCAL_SCHEDULE_CPP diff --git a/src/client_backend/log.h b/src/client_backend/log.h index 5b7b85d..0114b28 100644 --- a/src/client_backend/log.h +++ b/src/client_backend/log.h @@ -6,10 +6,12 @@ #include #include #include +#include #include "connect.h" #include "well_known.h" #include "settings.h" #include "security.h" + enum class LOGLEVEL { INFO, WARN, @@ -27,7 +29,7 @@ std::string get_loglevel(LOGLEVEL level); template void log(LOGLEVEL level, const std::string& message, Args&&... args) { - log_timeout_reset_set(log_timeout_reset_get()+1); + log_timeout_reset_set(log_timeout_reset_get() + 1); std::string prefix = get_loglevel(level); std::time_t now = std::time(nullptr); std::tm tm; @@ -42,11 +44,9 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) { ((to_srv << ' ' << std::forward(args)), ...); } logStream << std::endl; - //to_srv << std::endl; std::string logString = logStream.str(); std::string to_srv_string = to_srv.str(); printf("info from logger: %s", logString.c_str()); - // Open the file based on log level FILE* fp; switch (level) { case LOGLEVEL::INFO: @@ -81,78 +81,67 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) { break; } if (error != 0) { - //panic, create log entry, return 1; return; } else { - //write log entry to disk fprintf_s(fp, "%s", logString.c_str()); fclose(fp); - - //write to general log file if (fopen_s(&fp, LOGFILE, "a") == 0) { fprintf_s(fp, "%s", logString.c_str()); fclose(fp); } - //write to server log file only if we werent able to send the logs directly. this file will store them until we can upload them - if (fopen_s(&fp, SRV_LOGFILE, "a") == 0 && log_timeout_get() >= 5) { //if server already did not respon over 5 times, we add it to the log file + if (fopen_s(&fp, SRV_LOGFILE, "a") == 0 && log_timeout_get() >= 5) { fprintf_s(fp, "%s\n", to_srv_string.c_str()); fclose(fp); } } - //send log so srv - //build up the log string: loglevel&logtext&machineid&date - //to_srv_string=includes the log message - //we now need to build up the request string and append the machineid - if (level!=LOGLEVEL::INFO_NOSEND && level!=LOGLEVEL::WARN_NOSEND && level!=LOGLEVEL::ERR_NOSEND && level!=LOGLEVEL::PANIC_NOSEND && log_timeout_get()<5) { - char* url = new char[3000]; + if (level != LOGLEVEL::INFO_NOSEND && level != LOGLEVEL::WARN_NOSEND && level != LOGLEVEL::ERR_NOSEND && level != LOGLEVEL::PANIC_NOSEND/* && log_timeout_get() < 5*/) { + std::string url; int res = 0; - if (get_setting("server:server_url", url) == 0 or strcmp(url, "nan") == 0) { - strcat_s(url, 3000, "/api/php/log/add_entry.php?logtext=");//need to add machine_id and apikey - strcat_s(url, 3000, url_encode(to_srv_string.c_str())); - strcat_s(url, 3000, "&machine_id="); - strcat_s(url, 3000, get_machineid(SECRETS)); - strcat_s(url, 3000, "&apikey="); - strcat_s(url, 3000, get_apikey(SECRETS)); - res=fast_send(url, get_setting("communication:unsafe_tls")); + url = get_setting_string("server:server_url"); + if (url!="" && url!="nan") { + url += "/api/php/log/add_entry.php?logtext="; + url += url_encode(to_srv_string); + url += "&machine_id="; + url += get_machineid(SECRETS); + url += "&apikey="; + url += get_apikey(SECRETS); + res = fast_send(url, get_setting("communication:unsafe_tls")); + //log(LOGLEVEL::INFO_NOSEND, "[log()]: sending log to server:", url, " ", res); if (res != 0) { - //we know that the server might be down, so we will increment the timeout counter + //log(LOGLEVEL::ERR_NOSEND, "[log()]: Error while sending log to server: ", url); log_timeout_set(log_timeout_get() + 1); } - //we might not want to log an error occuring here because it will create a loop - } - delete[] url; - }//else we do not send the log to the server + }//else + //log(LOGLEVEL::ERR_NOSEND, "[log()]: Error while sending log to server: ", url); + } + + if (log_timeout_reset_get() > 100) { log_timeout_reset_set(0); log_timeout_set(0); } - //!!!i disabled this temporarely, because it does not really work and as long as the client is in lan the other code works anyway - if(log_timeout_reset_get()>100 && 1==0) { //after 100 log entrys, we cna try again to reach out ot the server. + /*if (log_timeout_reset_get() > 100 && 1 == 0) { log_timeout_reset_set(0); log_timeout_set(0); - //try to upload the server_log file, where we stored the logs which we could not upload. - char* url = new char[3000]; + std::string url; int res = 0; - if (get_setting("server:server_url", url) == 0 or strcmp(url, "nan") == 0) { - strcat_s(url, 3000, "/api/php/log/add_log.php?machine_id="); - strcat_s(url, 3000, get_machineid(SECRETS)); - strcat_s(url, 3000, "&apikey="); - strcat_s(url, 3000, get_apikey(SECRETS)); - res=upload_to_srv(SRV_LOGFILE, url, get_setting("communication:unsafe_tls")); + url = get_setting("server:server_url"); + ifif(url != "" && url != "nan") { + url += "/api/php/log/add_log.php?machine_id="; + url += get_machineid(SECRETS); + url += "&apikey="; + url += get_apikey(SECRETS); + res = upload_to_srv(SRV_LOGFILE, url, get_setting("communication:unsafe_tls")); if (res != 0) { - //we know that the server might be down, so we will increment the timeout counter - log_timeout_set(log_timeout_get() + 1); + log_timeout_set(log_timeout_get() + 1); } else { - //remove the logfile remove(SRV_LOGFILE); } - } - delete [] url; - } - + } + }*/ } #endif // LOGGER_H diff --git a/src/client_backend/permissions.cpp b/src/client_backend/permissions.cpp index 976060c..7425a70 100644 --- a/src/client_backend/permissions.cpp +++ b/src/client_backend/permissions.cpp @@ -4,6 +4,8 @@ #pragma comment(lib, "advapi32.lib") #include "permissions.h" #include // Include mutex for synchronization +#include +#include // Include for _chmod function // Mutex for synchronizing file operations std::mutex fileMutex; @@ -15,19 +17,19 @@ file cannot be deleted or modified by anyone. admin can delete */ -//mark as readonly -int protect_file(char* path) { +// Mark as read-only +int protect_file(const char* path) { std::lock_guard lock(fileMutex); // Lock the mutex return _chmod(path, _S_IREAD); } -//mark as readwrite -int unprotect_file(char* path) { +// Mark as read-write +int unprotect_file(const char* path) { std::lock_guard lock(fileMutex); // Lock the mutex return _chmod(path, _S_IWRITE | _S_IREAD); } -//deny all access and only grant access to admins +// Deny all access and only grant access to admins BOOL create_file_protection(SECURITY_ATTRIBUTES* pSA) { // Define the SDDL for the DACL. This example sets @@ -41,10 +43,9 @@ BOOL create_file_protection(SECURITY_ATTRIBUTES* pSA) LPCSTR szSD = TEXT("D:") TEXT("(D;OICI;GA;;;BG)") // Deny access to guest users TEXT("(D;OICI;GA;;;AN)") // Deny access to unauthenticated users - //TEXT("(D;OICI;GA;;;AU)") // Deny access to authenticated users do not execute else not even admins have rights anymore :( + //TEXT("(D;OICI;GA;;;AU)") // Deny access to authenticated users do not execute else not even admins have rights anymore :( TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtin administrators - TEXT("(A;OICI;GA;;;AA)"); // Allow full control to normal administrators - + TEXT("(A;OICI;GA;;;AA)"); // Allow full control to normal administrators if (NULL == pSA) return FALSE; diff --git a/src/client_backend/permissions.h b/src/client_backend/permissions.h index dc6d6c5..6f6ab59 100644 --- a/src/client_backend/permissions.h +++ b/src/client_backend/permissions.h @@ -13,5 +13,5 @@ #include #include #include -int protect_file(char* path); -int unprotect_file(char* path); \ No newline at end of file +int protect_file(const char* path); +int unprotect_file(const char* path); \ No newline at end of file diff --git a/src/client_backend/queue _ctrl.cpp b/src/client_backend/queue _ctrl.cpp index 05ea040..1d6a734 100644 --- a/src/client_backend/queue _ctrl.cpp +++ b/src/client_backend/queue _ctrl.cpp @@ -1,45 +1,44 @@ #ifndef QUEUE_CTRL_CPP #define QUEUE_CTRL_CPP + #include "queue_ctrl.h" -#include -#define queue_limit 1000 -#define command_limit 3000 -char queue[queue_limit][command_limit]; +#include +#include +#include + +constexpr int queue_limit = 1000; + +std::array queue; int queue_size = 0; int queue_start = 0; int queue_end = 0; -int queue_push(char* str) { - if (queue_size == queue_limit) { - return 1; - } - else if (strlen(str) >= command_limit) { - return 2; - } - else { - strcpy_s(queue[queue_end], str); - queue_end++; - queue_size++; - if (queue_end == queue_limit) { - queue_end = 0; - } - return 0; - } + +int queue_push(const std::string& str) { + if (queue_size == queue_limit) { + return 1; // Queue full + } + else { + queue[queue_end] = str; + queue_end = (queue_end + 1) % queue_limit; + queue_size++; + return 0; // Success + } } -int queue_pop(char* str) { - if (queue_size == 0) { - return 1; - } - else { - strcpy_s(str, 100, queue[queue_start]); - queue_start++; - queue_size--; - if (queue_start == queue_limit) { - queue_start = 0; - } - return 0; - } + +std::string queue_pop() { + if (queue_size == 0) { + return "nan"; // Queue empty + } + else { + std::string ret = queue[queue_end-1]; + queue_end = (queue_end - 1) % queue_limit; + queue_size--; + return ret; // Success + } } + int get_queue_size() { - return queue_size; + return queue_size; } + #endif // !QUEUE_CTRL_CPP diff --git a/src/client_backend/queue_ctrl.h b/src/client_backend/queue_ctrl.h index 662e93a..8f4a227 100644 --- a/src/client_backend/queue_ctrl.h +++ b/src/client_backend/queue_ctrl.h @@ -1,9 +1,9 @@ #pragma once #ifndef QUEUE_CTRL_H #define QUEUE_CTRL_H - -int queue_push(char* str); -int queue_pop(char* str); +#include +int queue_push(const std::string& str); +std::string queue_pop(); int get_queue_size(); #endif // !QUEUE_CTRL_H diff --git a/src/client_backend/scan.cpp b/src/client_backend/scan.cpp index 7048a63..39e5a15 100644 --- a/src/client_backend/scan.cpp +++ b/src/client_backend/scan.cpp @@ -222,28 +222,23 @@ void scan_folder(const std::string& directory) { //for singlethreaded scans -void action_scanfile(const char* filepath) { +void action_scanfile(const std::string& filepath_) { thread_init(); + const std::string filepath(filepath_); char* db_path = new char[300]; - - //log(LOGLEVEL::INFO, "[action_scanfile_t()]: Scanning file: ", filepath); - if (strlen(filepath) == 0 or strcmp("", filepath) == 0 or file_exists(filepath) == false) { - thread_shutdown(); - delete[] db_path; - return; //no filepath given or file not accessible - } + char* hash = new char[300]; + std::string hash_(md5_file_t(filepath)); + if (strlen(hash_.c_str()) < 290) + strcpy_s(hash, 295, hash_.c_str()); else { - char* hash = new char[300]; - hash[0] = '\0'; - strcpy_s(hash, 295, md5_file_t(filepath).c_str()); - sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]); - search_hash(db_path, hash, filepath); - delete[] hash; + strcpy_s(hash, 295, ""); + log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath); } - delete[] db_path; + sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]); + search_hash(db_path, hash, filepath); thread_shutdown(); } -void action_scanfolder(const char* folderpath) { +void action_scanfolder(const std::string& folderpath) { thread_init(); cnt = 0; thread_local std::string folderpath_(folderpath); diff --git a/src/client_backend/scan.h b/src/client_backend/scan.h index 879535c..1a231a4 100644 --- a/src/client_backend/scan.h +++ b/src/client_backend/scan.h @@ -11,8 +11,8 @@ #include #include void scan_folder(const std::string& directory); -void action_scanfile(const char* filepath); -void action_scanfolder(const char* folderpath); +void action_scanfile(const std::string& filepath); +void action_scanfolder(const std::string& folderpath); //void action_scanfile_t(const char* filepath); void scan_file_t(const std::string& filepath_); int initialize(const std::string& folderPath); diff --git a/src/client_backend/security.cpp b/src/client_backend/security.cpp index f5d75d1..574bec2 100644 --- a/src/client_backend/security.cpp +++ b/src/client_backend/security.cpp @@ -1,72 +1,65 @@ #include "security.h" #include // Include the mutex header +#include // Include the string header +#include // Include the file stream header std::mutex fileMutex_sec; // Mutex to synchronize file access -int check_cert(const char* cert, const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { +int check_cert(const std::string& cert, const std::string& secrets_path) { + std::ifstream file(secrets_path); + if (!file.is_open()) { return 1; } else { - char secrets[505]; // Allocate memory on the stack + std::string secrets; std::lock_guard lock(fileMutex_sec); // Lock file access - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp("cert", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp(cert, secrets) == 0) { - fclose(fp); + while (file >> secrets) { + if (secrets == "cert") { + file >> secrets; // Get the secret + if (cert == secrets) { return 0; } } } - fclose(fp); return 2; } } -char* get_apikey(const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return nullptr; +std::string get_apikey(const std::string& secrets_path) { + std::ifstream file(secrets_path); + if (!file.is_open()) { + return ""; } else { - char secrets[505]; // Allocate memory on the stack + std::string secrets; std::lock_guard lock(fileMutex_sec); // Lock file access - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp("apikey", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - fclose(fp); - return secrets; // Return a dynamically allocated copy + while (file >> secrets) { + if (secrets == "apikey") { + file >> secrets; // Get the secret + return secrets; // Return the secret } } - fclose(fp); - return nullptr; + return ""; } } -char* get_machineid(const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return nullptr; +std::string get_machineid(const std::string& secrets_path) { + std::ifstream file(secrets_path); + if (!file.is_open()) { + return ""; } else { - char secrets[300]; // Allocate memory on the stack + std::string secrets; std::lock_guard lock(fileMutex_sec); // Lock file access - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - if (strcmp("machineid", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - fclose(fp); - return secrets; // Return a dynamically allocated copy + while (file >> secrets) { + if (secrets == "machineid") { + file >> secrets; // Get the secret + return secrets; // Return the secret } } - fclose(fp); - return nullptr; + return ""; } } diff --git a/src/client_backend/security.h b/src/client_backend/security.h index 78396bc..444bfc8 100644 --- a/src/client_backend/security.h +++ b/src/client_backend/security.h @@ -4,7 +4,7 @@ #include #include #include -int check_cert(const char* cert,const char* secrets_path); -char*get_apikey(const char*secrets_path); -char* get_machineid(const char*secrets_path); +int check_cert(const std::string& cert, const std::string& secrets_path); +std::string get_apikey(const std::string& secrets_path); +std::string get_machineid(const std::string& secrets_path); #endif // !SECURITY_H \ No newline at end of file diff --git a/src/client_backend/settings.cpp b/src/client_backend/settings.cpp index 896c592..ebe440a 100644 --- a/src/client_backend/settings.cpp +++ b/src/client_backend/settings.cpp @@ -1,5 +1,6 @@ #ifndef SETTINGS_CPP #define SETTINGS_CPP + #include "settings.h" #include "well_known.h" #include "log.h" @@ -10,15 +11,15 @@ std::mutex settingsMutex; std::mutex logMutex; int setting_virus_ctrl_virus_found_action = 0; -char* setting_server_server_url = new char[300]; -char excluded_folders[100][300]; +std::string setting_server_server_url = "nan"; +std::string excluded_folders[1000]; int excluded_folders_size = 0; -char included_folders[100][300]; +std::string included_folders[1000]; int included_folders_size = 0; -bool setting_rtp_folder_scan_status = 1; //0=off, 1=on -bool setting_rtp_process_scan_status = 1; //0=off, 1=on -bool setting_virus_ctrl_virus_process_found_kill = 1; //0=do not kill, 1=kill -bool setting_communication_unsafe_tls = 0; //0=do not allow communication via unsafe, self-signed certs, 1=allow communication via unsafe, self-signed certs +bool setting_rtp_folder_scan_status = true; // 0=off, 1=on +bool setting_rtp_process_scan_status = true; // 0=off, 1=on +bool setting_virus_ctrl_virus_process_found_kill = true; // 0=do not kill, 1=kill +bool setting_communication_unsafe_tls = false; // 0=do not allow communication via unsafe, self-signed certs, 1=allow communication via unsafe, self-signed certs int srv_log_timeout = 0; int log_timeout_reset = 0; @@ -26,198 +27,163 @@ void load_included_folders(); void load_excluded_folders(); int load_settings() { - FILE* fp; + //std::lock_guard lock(settingsMutex); // Lock access to settings file operations - std::lock_guard lock(settingsMutex); // Lock access to settings file operations + std::ifstream file(SETTINGS_DB); - if (fopen_s(&fp, SETTINGS_DB, "r") != 0) { + if (!file.is_open()) { log(LOGLEVEL::ERR, "[load_settings()]: Could not open settings file. ", SETTINGS_DB); - strcpy_s(setting_server_server_url, 295, "nan"); + setting_server_server_url = "nan"; return 1; } - else { - char* settings_cmd = new char[505]; - char* settings_arg = new char[300]; - fscanf_s(fp, "%s", settings_cmd, 500); //the cert is always the first line - while (!feof(fp)) { - fscanf_s(fp, "%s", settings_cmd, 295); // get the command - //now check which setting it is. - if (strcmp(settings_cmd, "virus_ctrl:virus_found:action") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - if (strcmp(settings_arg, "remove") == 0) { - setting_virus_ctrl_virus_found_action = 1; //1=remove - } - else if (strcmp(settings_arg, "quarantine") == 0) { - setting_virus_ctrl_virus_found_action = 2; //2=quarantine - } - else if (strcmp(settings_arg, "ignore") == 0) { - setting_virus_ctrl_virus_found_action = 3; //3=ignore - } - else if (strcmp(settings_arg, "call_srv") == 0) { - setting_virus_ctrl_virus_found_action = 4; //4=call_srv <= only call the server and tell it, do not remove or quarantine - } + + std::string settings_cmd, settings_arg; + file>>settings_cmd;//the firs tline is our cert + while (file >> settings_cmd) { + file >> settings_arg; + + // Process settings + //printf("aaaaaaaa,%s::,%s\n",settings_cmd.c_str(), settings_arg.c_str()); + if (settings_cmd == "virus_ctrl:virus_found:action") { + if (settings_arg == "remove") { + setting_virus_ctrl_virus_found_action = 1; } - else if (strcmp(settings_cmd, "server:server_url") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - strcpy_s(setting_server_server_url, 295, settings_arg); + else if (settings_arg == "quarantine") { + setting_virus_ctrl_virus_found_action = 2; } - else if (strcmp(settings_cmd, "rtp_folder_scan:status") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - setting_rtp_folder_scan_status = (strcmp(settings_arg, "true") == 0); //1=on, 0=off + else if (settings_arg == "ignore") { + setting_virus_ctrl_virus_found_action = 3; } - else if (strcmp(settings_cmd, "rtp_process_scan:status") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - setting_rtp_process_scan_status = (strcmp(settings_arg, "true") == 0); //1=on, 0=off - } - else if (strcmp(settings_cmd, "communication:unsafe_tls") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - setting_communication_unsafe_tls = (strcmp(settings_arg, "allow") == 0); //1=allow, 0=block - } - else if (strcmp(settings_cmd, "virus_ctrl:virus_process_found:kill") == 0) { - fscanf_s(fp, "%s", settings_arg, 295); // get the argument - setting_virus_ctrl_virus_process_found_kill = (strcmp(settings_arg, "true") == 0); //1=kill, 0=do not kill + else if (settings_arg == "call_srv") { + setting_virus_ctrl_virus_found_action = 4; } } - - delete[] settings_cmd; - delete[] settings_arg; + else if (settings_cmd == "server:server_url") { + setting_server_server_url = settings_arg; + } + else if (settings_cmd == "rtp_folder_scan:status") { + setting_rtp_folder_scan_status = (settings_arg == "true"); + } + else if (settings_cmd == "rtp_process_scan:status") { + setting_rtp_process_scan_status = (settings_arg == "true"); + } + else if (settings_cmd == "communication:unsafe_tls") { + setting_communication_unsafe_tls = (settings_arg == "allow"); + } + else if (settings_cmd == "virus_ctrl:virus_process_found:kill") { + setting_virus_ctrl_virus_process_found_kill = (settings_arg == "true"); + } } + + file.close(); + load_included_folders(); load_excluded_folders(); - fclose(fp); + return 0; } -// We have two different get_setting functions. One for int and one for char* return values -int get_setting(const char* setting_name) { +// We have two different get_setting functions. One for int and one for std::string return values +int get_setting(const std::string& setting_name) { std::lock_guard lock(settingsMutex); // Lock access to settings variables - if (strcmp(setting_name, "virus_ctrl:virus_found:action") == 0) { + if (setting_name == "virus_ctrl:virus_found:action") { return setting_virus_ctrl_virus_found_action; } - if (strcmp(setting_name, "virus_ctrl:virus_process_found:kill") == 0) { + if (setting_name == "virus_ctrl:virus_process_found:kill") { return setting_virus_ctrl_virus_process_found_kill; } - else if (strcmp(setting_name, "rtp_folder_scan:status") == 0) { + else if (setting_name == "rtp_folder_scan:status") { return setting_rtp_folder_scan_status; } - else if (strcmp(setting_name, "rtp_process_scan:status") == 0) { + else if (setting_name == "rtp_process_scan:status") { return setting_rtp_process_scan_status; } - else if (strcmp(setting_name, "communication:unsafe_tls") == 0) { + else if (setting_name == "communication:unsafe_tls") { return setting_communication_unsafe_tls; } return -1; } -int get_setting(const char* setting_name, char* out) { +std::string get_setting_string(const std::string& setting_name) { std::lock_guard lock(settingsMutex); // Lock access to settings variables - if (strcmp(setting_name, "server:server_url") == 0) { - strcpy_s(out, 295, setting_server_server_url); - return 0; + if (setting_name == "server:server_url") { + return setting_server_server_url; } - return -1; + return "nan"; } void load_included_folders() { - FILE* fp; - if (fopen_s(&fp, INCLUDED_FOLDERS, "r") != 0) { + std::lock_guard lock(settingsMutex); // Lock access to settings variables + + std::ifstream file(INCLUDED_FOLDERS); + + if (!file.is_open()) { log(LOGLEVEL::ERR, "[load_included_files()]: Could not open included folders file. ", INCLUDED_FOLDERS); return; } - else { - char* path = new char[505]; - fscanf_s(fp, "%s", path, 500); //the cert is always the first line - while (!feof(fp)) { - //get the path of an excluded folder - path[0] = '\0'; - //the path is encapsulated with " - int cnt = 0; - int chr = 0; - chr = fgetc(fp); - if (chr == '\"') { - chr = 0; - while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char - if (chr != '\"') - path[cnt] = chr; - path[cnt + 1] = '\0'; - cnt++; - } - //now add the path to the array - if (included_folders_size < 95) { - strcpy_s(included_folders[included_folders_size], 295, path); - included_folders_size++; - } - else { - log(LOGLEVEL::ERR, "[load_included_files()]: included folders array is full. Cannot add more folders."); - } + + std::string line; + std::getline(file, line); // Skip the first line + while (std::getline(file, line)) { + size_t start_pos = line.find('"'); // Find the position of the first double quote + if (start_pos != std::string::npos) { + size_t end_pos = line.find('"', start_pos + 1); // Find the position of the second double quote + if (end_pos != std::string::npos) { + std::string path = line.substr(start_pos + 1, end_pos - start_pos - 1); // Extract the path between double quotes + included_folders[included_folders_size++] = path; } } - fclose(fp); - delete[] path; } + + file.close(); } void load_excluded_folders() { - FILE* fp; - if (fopen_s(&fp, EXCLUDED_FOLDERS, "r") != 0) { - log(LOGLEVEL::ERR, "[load_excluded_folders()]: Could not open excluded folders file. ", EXCLUDED_FOLDERS); + std::lock_guard lock(settingsMutex); // Lock access to settings variables + + std::ifstream file(EXCLUDED_FOLDERS); + + if (!file.is_open()) { + log(LOGLEVEL::ERR, "[load_included_files()]: Could not open excluded folders file. ", INCLUDED_FOLDERS); return; } - else { - char* path = new char[505]; - fscanf_s(fp, "%s", path, 500); //the cert is always the first line - while (!feof(fp)) { - //get the path of an excluded folder - path[0] = '\0'; - //the path is encapsulated with " - int cnt = 0; - int chr = 0; - chr = fgetc(fp); - if (chr == '\"') { - chr = 0; - while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char - if (chr != '\"') - path[cnt] = chr; - path[cnt + 1] = '\0'; - cnt++; - } - //now add the path to the array - if (excluded_folders_size < 95) { - strcpy_s(excluded_folders[excluded_folders_size], 295, path); - excluded_folders_size++; - } - else { - log(LOGLEVEL::ERR, "[load_excluded_folders()]: Excluded folders array is full. Cannot add more folders."); - } + + std::string line; + std::getline(file, line); // Skip the first line + while (std::getline(file, line)) { + size_t start_pos = line.find('"'); // Find the position of the first double quote + if (start_pos != std::string::npos) { + size_t end_pos = line.find('"', start_pos + 1); // Find the position of the second double quote + if (end_pos != std::string::npos) { + std::string path = line.substr(start_pos + 1, end_pos - start_pos - 1); // Extract the path between double quotes + excluded_folders[excluded_folders_size++] = path; } } - fclose(fp); - delete[] path; } + + file.close(); } -bool is_folder_included(const char* path) { +bool is_folder_included(const std::string& path) { std::lock_guard lock(settingsMutex); // Lock access to settings variables for (int i = 0; i < included_folders_size; i++) { - if (strstr(path, included_folders[i]) != 0 && strcmp(included_folders[i], "") != 0 && strcmp(included_folders[i], " ") != 0) { + if (path.find(included_folders[i]) != std::string::npos) { return true; } } return false; } -bool is_folder_excluded(const char* path) { +bool is_folder_excluded(const std::string& path) { std::lock_guard lock(settingsMutex); // Lock access to settings variables for (int i = 0; i < excluded_folders_size; i++) { - if (strstr(path, excluded_folders[i]) != 0 && strcmp(excluded_folders[i], "") != 0 && strcmp(excluded_folders[i], " ") != 0) { + if (path.find(excluded_folders[i]) != std::string::npos) { return true; } } @@ -256,4 +222,4 @@ int log_timeout_reset_get() { return log_timeout_reset; } -#endif +#endif // SETTINGS_CPP diff --git a/src/client_backend/settings.h b/src/client_backend/settings.h index c63b54a..a5a1226 100644 --- a/src/client_backend/settings.h +++ b/src/client_backend/settings.h @@ -3,12 +3,16 @@ #define SETTINGS_H #include #include -int get_setting(const char* setting_name); -int get_setting(const char* setting_name,char*out); +#include +int get_setting(const std::string& setting_name); +std::string get_setting_string(const std::string& setting_name); + int load_settings(); -bool is_folder_included(const char* path); -bool is_folder_excluded(const char* path); -void print_inclusions(); +void load_included_folders(); +void load_excluded_folders(); +bool is_folder_included(const std::string& path); +bool is_folder_excluded(const std::string& path); +void print_inclusions(); int log_timeout_get(); void log_timeout_set(int timeout); diff --git a/src/client_backend/thread_ctrl.cpp b/src/client_backend/thread_ctrl.cpp index e309cfd..0fbe28f 100644 --- a/src/client_backend/thread_ctrl.cpp +++ b/src/client_backend/thread_ctrl.cpp @@ -1,78 +1,60 @@ #ifndef THREAD_CTRL_CPP #define THREAD_CTRL_CPP + #include "thread_ctrl.h" #include "log.h" #include "well_known.h" #include "scan.h" #include "app_ctrl.h" #include "update.h" -void split(char* input,const char delimiter, char* out1, char* out2) { - //split a string at the delimiter. the delimiter only occurs once. so the first part is out1 and the second part is out2 - int i = 0; - int j = 0; - int k = 0; - while (input[i] != '\0') { - if (input[i] == delimiter) { - out1[j] = '\0'; - i++; - while (input[i] != '\0') { - out2[k] = input[i]; - i++; - k++; - } - out2[k] = '\0'; - return; - } - else { - out1[j] = input[i]; - i++; - j++; - } - } -} -int start_thread(const char* command) { - if (can_run_thread()) { - char* out2 = new char[100]; //for the command - char* out1 = new char[300]; //for the arguments - split((char*)command,';', (char*)out1, (char*)out2); - //log(LOGLEVEL::INFO, "[start_thread()]: starting command: ", out1, " with arguments: ",out2); - //printf("out1: %s\n", out1); - //printf("out2: %s\n", out2); - //determine what should be executed - if (strcmp(out1, "scanfile") == 0) { - log(LOGLEVEL::INFO, "[start_thread()]: starting scanfile with arguments: ", out2); - //start a new thread with the scanfile function - std::thread t1(action_scanfile, out2); - t1.detach(); - } - else if (strcmp(out1, "scanfolder") == 0) { - //start a new thread with the scanfolder function - log(LOGLEVEL::INFO, "[start_thread()]: starting scanfolder with arguments: ", out2); - std::thread t1(action_scanfolder, out2); - //log(LOGLEVEL::INFO, "[start_thread()]: started scanfolder with arguments: ", out2); - t1.detach(); - } - else if (strcmp(out1, "update_settings") == 0) { - //start a new thread with the scanfolder function - log(LOGLEVEL::INFO, "[start_thread()]: starting update_settings with arguments: ", out2); - std::thread t1(action_update_settings); - t1.detach(); - } - else if (strcmp(out1, "update_db") == 0) { - //start a new thread with the scanfolder function - log(LOGLEVEL::INFO, "[start_thread()]: starting update_db with arguments: ", out2); - std::thread t1(action_update_settings); - t1.detach(); - } - while (can_run_thread()) { - //delay a bit, in order to wait until the thread is started - Sleep(10); - } - delete[] out1; - delete[] out2; - } - return 0; +void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) { + // Split a string at the delimiter. The delimiter only occurs once. + // The first part is stored in out1 and the second part in out2. + size_t pos = input.find(delimiter); + if (pos != std::string::npos) { + out1 = input.substr(0, pos); + out2 = input.substr(pos + 1); + } } -#endif \ No newline at end of file +int start_thread(const std::string& command) { + if (can_run_thread()) { + std::string out1, out2; + split(command, ';', out1, out2); + log(LOGLEVEL::INFO_NOSEND, "[start_thread()]: command: ", out1, " arguments: ",out2, " call: ",command); + // Determine what should be executed + if (out1 == "scanfile") { + log(LOGLEVEL::INFO, "[start_thread()]: starting scanfile with arguments: ", out2); + // Start a new thread with the scanfile function + std::thread t1(action_scanfile, out2); + t1.detach(); + } + else if (out1 == "scanfolder") { + // Start a new thread with the scanfolder function + log(LOGLEVEL::INFO, "[start_thread()]: starting scanfolder with arguments: ", out2); + std::thread t1(action_scanfolder, out2); + t1.detach(); + } + else if (out1 == "update_settings") { + // Start a new thread with the update_settings function + log(LOGLEVEL::INFO, "[start_thread()]: starting update_settings with arguments: ", out2); + std::thread t1(action_update_settings); + t1.detach(); + } + else if (out1 == "update_db") { + // Start a new thread with the update_db function + log(LOGLEVEL::INFO, "[start_thread()]: starting update_db with arguments: ", out2); + std::thread t1(action_update_db); + t1.detach(); + } + + while (can_run_thread()) { + // Delay a bit to wait until the thread is started + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + } + } + return 0; +} + +#endif // THREAD_CTRL_CPP diff --git a/src/client_backend/thread_ctrl.h b/src/client_backend/thread_ctrl.h index dd013cb..a1deffe 100644 --- a/src/client_backend/thread_ctrl.h +++ b/src/client_backend/thread_ctrl.h @@ -7,5 +7,5 @@ #include #include -int start_thread(const char*command); +int start_thread(const std::string& command); #endif \ No newline at end of file diff --git a/src/client_backend/update.cpp b/src/client_backend/update.cpp index 8eea6d0..2cd27d2 100644 --- a/src/client_backend/update.cpp +++ b/src/client_backend/update.cpp @@ -1,106 +1,98 @@ #ifndef UPDATE_CPP #define UPDATE_CPP + #include "update.h" #include "log.h" #include "connect.h" #include "settings.h" #include "security.h" +#include +#include +#include +int update_db(const std::string& folder_path) { + // Download the databases from the server + for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) { + for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) { + // Ensure that the characters are valid hexadecimal digits + if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) || std::isupper(firstChar) || std::isupper(secondChar)) { + continue; + } -int update_db(const char* folder_path) { - //download the databases from the server - for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) { - for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) { - // Ensure that the characters are valid hexadecimal digits - if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) { - continue; - } + // Create the filename based on the naming convention + std::string file_name = std::string(1, firstChar) + secondChar + ".jdbf"; - // Create the filename based on the naming convention + // Create the strings to download the files + std::string url = get_setting_string("server:server_url"); + if (url.empty() || url == "nan") { + return 2; // Invalid server URL + } + url += "/database_srv/" + file_name; - char file_name[] = { firstChar, secondChar ,'.','j','d','b','f','\0' }; - //create the strings to download the files - char* output_path = new char[300]; - char* url = new char[1000]; - if (get_setting("server:server_url", url) == 0 or strcmp(url, "nan") == 0) { - strcat_s(url, 295, "/database_srv/"); - strcat_s(url, 295, file_name); - strcpy_s(output_path, 295, folder_path); - strcat_s(output_path, 295, "\\"); - strcat_s(output_path, 295, file_name); - printf("%s\n", url); - int res = download_file_from_srv(url, output_path,get_setting("communication:unsafe_tls")); - if (res != 0) { - return 10; - } - } - else { - return 2; - } + std::string output_path = folder_path + "\\" + file_name; - delete[] url; - delete[] output_path; + std::cout << url << std::endl; - } - } - return 0; + int res = download_file_from_srv(url, output_path, get_setting("communication:unsafe_tls")); + if (res != 0) { + return 10; // Error downloading file + } + } + } + return 0; } -int update_settings(const char*settings_type) { - //create the strings to download the files - char* url = new char[1000]; - if (get_setting("server:server_url", url) == 0 or strcmp(url,"nan")==0) { - strcat_s(url, 1000, "/api/php/settings/get_settings.php?");//need to add machine_id and apikey - strcat_s(url, 1000, settings_type); - 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)); - int res = 1; - if (strcmp(settings_type, "settings") == 0) - res = download_file_from_srv(url, SETTINGS_DB, get_setting("communication:unsafe_tls")); - else if (strcmp(settings_type, "rtp_included") == 0) - res = download_file_from_srv(url, INCLUDED_FOLDERS, get_setting("communication:unsafe_tls")); - else if (strcmp(settings_type, "rtp_excluded") == 0) - res = download_file_from_srv(url, EXCLUDED_FOLDERS, get_setting("communication:unsafe_tls")); - else if (strcmp(settings_type, "sched") == 0) - res = download_file_from_srv(url, SCHED_PATH, get_setting("communication:unsafe_tls")); - //int res = 0; - if (res != 0) { - log(LOGLEVEL::ERR, "[update_settings()]: Error downloading settings database file from server", " ERROR:", res); - return 1; - } - delete[] url; - return 0; - } - else { - delete[] url; - return 2; - } - return 2; +int update_settings(const std::string& settings_type) { + // Create the strings to download the files + std::string url = get_setting_string("server:server_url"); + if (url.empty() || url == "nan") { + return 2; // Invalid server URL + } + url += "/api/php/settings/get_settings.php?"; + url += settings_type + "&machine_id=" + get_machineid(SECRETS) + "&apikey=" + get_apikey(SECRETS); + + int res = 1; + if (settings_type == "settings") + res = download_file_from_srv(url, SETTINGS_DB, get_setting("communication:unsafe_tls")); + else if (settings_type == "rtp_included") + res = download_file_from_srv(url, INCLUDED_FOLDERS, get_setting("communication:unsafe_tls")); + else if (settings_type == "rtp_excluded") + res = download_file_from_srv(url, EXCLUDED_FOLDERS, get_setting("communication:unsafe_tls")); + else if (settings_type == "sched") + res = download_file_from_srv(url, SCHED_PATH, get_setting("communication:unsafe_tls")); + + if (res != 0) { + log(LOGLEVEL::ERR, "[update_settings()]: Error downloading settings database file from server. ERROR:", res); + return 1; // Error downloading file + } + + return 0; } + int action_update_settings() { - //update the settings - int err = 0; - if (update_settings("settings") != 0) { - err= 1; - } - //update the included folders - if (update_settings("rtp_included") != 0) { - err= 2; - } - //update the excluded folders - if (update_settings("rtp_excluded") != 0) { - err= 3; - } - //update the schedule - if (update_settings("sched") != 0) { - err= 4; - } - return err; + // Update the settings + int err = 0; + if (update_settings("settings") != 0) + err = 1; + + // Update the included folders + if (update_settings("rtp_included") != 0) + err = 2; + + // Update the excluded folders + if (update_settings("rtp_excluded") != 0) + err = 3; + + // Update the schedule + if (update_settings("sched") != 0) + err = 4; + + return err; } + int action_update_db() { - //update the databases - return update_db(DB_DIR); + // Update the databases + return update_db(DB_DIR); } -#endif \ No newline at end of file + +#endif // UPDATE_CPP diff --git a/src/client_backend/update.h b/src/client_backend/update.h index 25a0369..b59dc06 100644 --- a/src/client_backend/update.h +++ b/src/client_backend/update.h @@ -3,7 +3,8 @@ #define UPDATE_H #include #include -int update_db(const char* folder_path); -int update_settings(const char*settings_type); +int update_db(const std::string& folder_path); +int update_settings(const std::string& settings_type); int action_update_settings(); +int action_update_db(); #endif \ No newline at end of file diff --git a/src/client_backend/virus_ctrl.cpp b/src/client_backend/virus_ctrl.cpp index f94ec6a..7935480 100644 --- a/src/client_backend/virus_ctrl.cpp +++ b/src/client_backend/virus_ctrl.cpp @@ -1,5 +1,6 @@ #ifndef VIRUS_CTRL_CPP #define VIRUS_CTRL_CPP + #include "virus_ctrl.h" #include "well_known.h" #include "log.h" @@ -7,183 +8,163 @@ #include "connect.h" #include "security.h" #include // Include the mutex header +#include +#include +#include +#include +#include +#include +#include // Define a mutex for thread synchronization std::mutex virusCtrlMutex; -int virus_ctrl_store( const char*path, const char*hash, const char*id) { - std::lock_guard lock(virusCtrlMutex); // Lock the mute - FILE* fp; - char *db_path = new char[300]; - strcpy_s(db_path, 295,VIRUS_CTRL_DB); - strcat_s(db_path, 295, id); - if (fopen_s(&fp, db_path, "a") != 0) { - log(LOGLEVEL::ERR, "[virus_ctrl_store()]:Failed to open virus control database to store path of infected file: ",path); - delete[] db_path; - return 1; - } - else { - fprintf(fp, "\"%s\" %s\n", path, hash); - fclose(fp); - delete[] db_path; - return 0; - } -} -int virus_ctrl_process( const char* id) { - std::lock_guard lock(virusCtrlMutex); // Lock the mute - //take actions based on settings. - //eg delete infected files, quarantine them, etc - Sleep(100); //wait for the file to be written to the disk else the process that createt the file might not be finished yet - FILE* fp; - char* db_path = new char[300]; - strcpy_s(db_path, 295, VIRUS_CTRL_DB); - strcat_s(db_path, 295, id); - if (fopen_s(&fp, db_path, "r") != 0) { - log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Failed to open virus control database to process it.", db_path); - delete[] db_path; - return 1; - } - else { - while (!feof(fp)) { - //get a fulll path (enclosed with "") - char* path = new char[300]; - char* hash = new char[300]; - path[0] = '\0'; - //search for starting ", then loop until ending " - int cnt = 0; - int chr = 0; - chr=fgetc(fp); - if (chr == '\"') {//get the location of the file - chr = 0; - while (cnt < 295 && chr != '\"') { - chr = fgetc(fp); //get a char - if (chr != '\"') - path[cnt] = chr; - path[cnt + 1] = '\0'; - cnt++; - } - fscanf_s(fp, "%s", hash, 295); // get the hash of the file - 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){ - strcpy_s(action, 50, "remove failed"); - log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while removing infected file: ", path," ",hash); - } - 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){ - 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; +int virus_ctrl_store(const std::string& path, const std::string& hash, const std::string& id) { + std::lock_guard lock(virusCtrlMutex); // Lock the mutex + std::ofstream file(VIRUS_CTRL_DB + id, std::ios::app); + if (!file.is_open()) { + log(LOGLEVEL::ERR, "[virus_ctrl_store()]: Failed to open virus control database to store path of infected file: ", path); + return 1; + } + else { + file << "\"" << path << "\" " << hash << "\n"; + file.close(); + return 0; + } +} - 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; +int virus_ctrl_process(const std::string& id) { + std::lock_guard lock(virusCtrlMutex); // Lock the mutex + // Take actions based on settings. + // e.g., delete infected files, quarantine them, etc. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); // Wait for the file to be written to the disk else the process that created the file might not be finished yet - case 4://notify - //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; + std::ifstream file(VIRUS_CTRL_DB + id); + if (!file.is_open()) { + log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Failed to open virus control database to process it.", VIRUS_CTRL_DB + id); + return 1; + } + else { + std::string line; + while (std::getline(file, line)) { + // Get a full path (enclosed with "") + std::string path, hash; + std::size_t pos = line.find("\""); + if (pos != std::string::npos) { + path = line.substr(pos + 1, line.find("\"", pos + 1) - pos - 1); + hash = line.substr(line.find("\"", pos + 1) + 1); + std::string quarantine_path = std::string(QUARANTINE_PATH) + "\\" + hash; + std::string action; + switch (get_setting("virus_ctrl:virus_found:action")) { + case 1: // remove + if (std::remove(path.c_str()) != 0) { + action = "remove_failed"; + log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while removing infected file: ", path, " ", hash); + } + else { + log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]: Removed Virus: ", path, " ", hash, ""); + action = "removed"; + } + 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?"); - strcat_s(url, 1000, "file="); - strcat_s(url, 1000, url_encode(path)); - strcat_s(url, 1000, "&hash="); - strcat_s(url, 1000, hash); - strcat_s(url, 1000, "&action="); - 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 { - log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while notifying server about virus: ", path, " ", hash); - } - delete[] quarantine_path; - delete[] url; - delete[] server_response; - } - //else { creates to many log entrys => entrys are not needed - // log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while processing virus control database. Expected \" but got ", chr); - //} - delete[] path; - delete[] hash; - } - fclose(fp); - } - remove(db_path); - delete[] db_path; - return 0; + case 2: // quarantine + if (std::rename(path.c_str(), quarantine_path.c_str()) != 0) { + log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while quarantining infected file: ", path, " ", hash); + action = "quarantine_failed"; + } + else { + log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]: Quarantined Virus: ", path, " ", hash, " to ", quarantine_path); + action = "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"); + action = "ignored"; + break; + + case 4: // notify + // We should also log it. + log(LOGLEVEL::VIRUS, "[virus_ctrl_process()]: Virus found in file: ", path, " ", hash, " but only notified due to settings"); + action = "notified"; + break; + } + + // Notify the server + std::string url; + url = get_setting_string("server:server_url"); + if(url != "nan" && url != "") { + url += "/api/php/virus/notify_virus.php?"; + url += "file=" + url_encode(path); + url += "&hash=" + url_encode(hash); + url += "&action=" + action; + url += "&machine_id=" + get_machineid(SECRETS); + url += "&apikey=" + get_apikey(SECRETS); + char server_response[100]; + int res; + if ((res = connect_to_srv(url, server_response, 100, get_setting("communication:unsafe_tls"))) != 0 || strcmp("wrt_ok", server_response) != 0) { + log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while notifying server about virus: ", path, " ", hash); + //log(LOGLEVEL::ERR_NOSEND, "[virus_ctrl_process()]: Error while notifying server about virus: ", path, " ", hash, " response: ", server_response, " url: ", url, " res: ", res); + } + } + else { + log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while notifying server about virus: ", path, " ", hash); + } + } + } + file.close(); + } + std::remove((VIRUS_CTRL_DB + id).c_str()); + return 0; } -const char* get_filename(const char* path) { - const char* fileName = strrchr(path, '\\'); - if (fileName == NULL) { - // No directory separator found, return the original path - return path; - } - else { - // Return the substring after the last directory separator - return fileName + 1; - } + +std::string get_filename(const std::string& path) { + auto pos = path.find_last_of("\\"); + if (pos == std::string::npos) { + // No directory separator found, return the original path + return path; + } + else { + // Return the substring after the last directory separator + return path.substr(pos + 1); + } } -int strcasecmp(const char* s1, const char* s2) { - while (*s1 && *s2) { - int diff = tolower(*s1) - tolower(*s2); - if (diff != 0) - return diff; - s1++; - s2++; - } - return 0; + +int strcasecmp(const std::string& s1, const std::string& s2) { + auto it1 = s1.begin(); + auto it2 = s2.begin(); + while (it1 != s1.end() && it2 != s2.end()) { + int diff = std::tolower(*it1) - std::tolower(*it2); + if (diff != 0) + return diff; + ++it1; + ++it2; + } + return 0; } -void kill_process(const char*path) { - HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL); - PROCESSENTRY32 pEntry; - pEntry.dwSize = sizeof(pEntry); - BOOL hRes = Process32First(hSnapShot, &pEntry); - while (hRes) - { - if (strcasecmp(pEntry.szExeFile, get_filename(path)) == 0) - { - HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, - (DWORD)pEntry.th32ProcessID); - if (hProcess != NULL) - { - TerminateProcess(hProcess, 9); - CloseHandle(hProcess); - } - else - log(LOGLEVEL::ERR, "[kill_process()]:Error while killing process: ", path); - } - hRes = Process32Next(hSnapShot, &pEntry); - } - CloseHandle(hSnapShot); + +void kill_process(const std::string& path) { + HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL); + PROCESSENTRY32 pEntry; + pEntry.dwSize = sizeof(pEntry); + BOOL hRes = Process32First(hSnapShot, &pEntry); + while (hRes) + { + if (strcasecmp(pEntry.szExeFile, get_filename(path).c_str()) == 0) + { + HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, static_cast(pEntry.th32ProcessID)); + if (hProcess != NULL) + { + TerminateProcess(hProcess, 9); + CloseHandle(hProcess); + } + else + log(LOGLEVEL::ERR, "[kill_process()]: Error while killing process: ", path); + } + hRes = Process32Next(hSnapShot, &pEntry); + } + CloseHandle(hSnapShot); } -#endif \ No newline at end of file + +#endif diff --git a/src/client_backend/virus_ctrl.h b/src/client_backend/virus_ctrl.h index 299b67b..ffcc773 100644 --- a/src/client_backend/virus_ctrl.h +++ b/src/client_backend/virus_ctrl.h @@ -8,7 +8,11 @@ #include #include #include -int virus_ctrl_store(const char*, const char*,const char* id); -int virus_ctrl_process(const char* id); -void kill_process(const char* path); +//int virus_ctrl_store(const char*, const char*,const char* id); +//int virus_ctrl_process(const char* id); +//void kill_process(const char* path); + +void kill_process(const std::string& path); +int virus_ctrl_store(const std::string& path, const std::string& name, const std::string& id); +int virus_ctrl_process(const std::string& id); #endif diff --git a/src/client_backend/x64/Debug/client_backend.pdb b/src/client_backend/x64/Debug/client_backend.pdb index 0cb2094..e413f22 100644 Binary files a/src/client_backend/x64/Debug/client_backend.pdb and b/src/client_backend/x64/Debug/client_backend.pdb differ