updating folder scanner to utilize 100% cpu

This commit is contained in:
jakani24
2024-06-02 14:43:48 +02:00
parent 6f1a3e2dbd
commit 94dd7d5764
30 changed files with 266 additions and 240 deletions

View File

@@ -3,48 +3,24 @@
"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\\utils.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.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\\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\\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\\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\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:well_known.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\\deepscan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:deepscan.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\\utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.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\\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\\utils.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.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\\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\\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\\queue _ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
@@ -54,6 +30,10 @@
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:zip.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.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.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\\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}"
@@ -62,6 +42,10 @@
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:deepscan.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\\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}"
@@ -70,14 +54,34 @@
"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\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:well_known.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\\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\\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\\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\\utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.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\\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}"
@@ -110,10 +114,6 @@
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\security.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.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\\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}"
@@ -138,7 +138,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"SelectedChildIndex": 22,
"Children": [
{
"$type": "Document",
@@ -148,102 +148,98 @@
"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": "AQIAAAAAAAAAAAAAAAAAAAYAAABlAAAA",
"ViewState": "AQIAAIEAAAAAAAAAAAAAAH0AAAAtAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:31.009Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 17,
"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": "AQIAANgAAAAAAAAAAAAAAPwAAAA9AAAA",
"ViewState": "AQIAAAUBAAAAAAAAAAAAACMBAABNAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:40.364Z",
"EditorCaption": ""
"WhenOpened": "2024-03-13T06:48:40.364Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 16,
"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": "AQIAAE4AAAAAAAAAAAAAAHEAAAAfAAAA",
"ViewState": "AQIAAGkAAAAAAAAAAAAAAD0AAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z",
"EditorCaption": ""
"WhenOpened": "2024-01-28T20:40:06.279Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 15,
"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": "AQIAAFcAAAAAAAAAAAAAAH4AAAA+AAAA",
"ViewState": "AQIAAJAAAAAAAAAAAAAAAKYAAAAsAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": ""
"WhenOpened": "2024-01-28T20:40:06.248Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 2,
"Title": "utils.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeDocumentMoniker": "utils.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeToolTip": "utils.cpp",
"ViewState": "AQIAACgAAAAAAAAAAAAvwD0AAABHAAAA",
"ViewState": "AQIAABYAAAAAAAAAAAAvwDAAAAAxAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T15:55:22.469Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 17,
"DocumentIndex": 14,
"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": "AQIAAAAAAAAAAAAAAAAAAAUAAABKAAAA",
"ViewState": "AQIAAFcAAAAAAAAAAAAAAHsAAAAhAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-04-26T20:39:34.98Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"DocumentIndex": 13,
"Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "well_known.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "well_known.h",
"ViewState": "AQIAAAMAAAAAAAAAAAAvwB0AAAA/AAAA",
"ViewState": "AQIAABsAAAAAAAAAAAAAAEYAAABwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T13:20:06.953Z",
"EditorCaption": ""
"WhenOpened": "2024-03-14T13:20:06.953Z"
},
{
"$type": "Document",
"DocumentIndex": 16,
"DocumentIndex": 12,
"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": "AQIAAAAAAAAAAAAAAAAAAAUAAAAAAAAA",
"ViewState": "AQIAAAYAAAAAAAAAAAAAABQAAABiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:52:01.533Z"
},
{
"$type": "Document",
"DocumentIndex": 21,
"DocumentIndex": 22,
"Title": "scan.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeDocumentMoniker": "scan.h",
@@ -255,56 +251,55 @@
},
{
"$type": "Document",
"DocumentIndex": 15,
"DocumentIndex": 11,
"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": "AQIAAAAAAAAAAAAAAAAAAAUAAABYAAAA",
"ViewState": "AQIAACoAAAAAAAAAAAAAABUAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-28T14:00:18.147Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 10,
"Title": "deepscan.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.cpp",
"RelativeDocumentMoniker": "deepscan.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.cpp",
"RelativeToolTip": "deepscan.cpp",
"ViewState": "AQIAADAAAAAAAAAAAAAvwEoAAAAuAAAA",
"ViewState": "AQIAAPwAAAAAAAAAAAAvwP4AAAAlAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-31T08:30:41.528Z",
"EditorCaption": ""
"WhenOpened": "2024-03-31T08:30:41.528Z"
},
{
"$type": "Document",
"DocumentIndex": 14,
"DocumentIndex": 9,
"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": "AQIAAAAAAAAAAAAAAAAAAAUAAABaAAAA",
"ViewState": "AQIAAGMAAAAAAAAAAAAAAC8AAAAzAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-02-18T12:49:41.861Z"
},
{
"$type": "Document",
"DocumentIndex": 13,
"DocumentIndex": 8,
"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": "AQIAAAAAAAAAAAAAAAAAAAgAAAAAAAAA",
"ViewState": "AQIAAEUAAAAAAAAAAAAAAFMAAAAlAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-29T07:05:00.157Z"
},
{
"$type": "Document",
"DocumentIndex": 27,
"DocumentIndex": 7,
"Title": "security.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.h",
"RelativeDocumentMoniker": "security.h",
@@ -316,13 +311,13 @@
},
{
"$type": "Document",
"DocumentIndex": 12,
"DocumentIndex": 6,
"Title": "zip.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp",
"RelativeDocumentMoniker": "zip.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp",
"RelativeToolTip": "zip.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAARAAAA",
"ViewState": "AQIAACQAAAAAAAAAAAAAAEsAAAAOAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-29T07:57:04.198Z"
},
@@ -340,7 +335,7 @@
},
{
"$type": "Document",
"DocumentIndex": 24,
"DocumentIndex": 25,
"Title": "local_com.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
"RelativeDocumentMoniker": "local_com.h",
@@ -352,7 +347,7 @@
},
{
"$type": "Document",
"DocumentIndex": 26,
"DocumentIndex": 27,
"Title": "update.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeDocumentMoniker": "update.h",
@@ -364,13 +359,13 @@
},
{
"$type": "Document",
"DocumentIndex": 11,
"DocumentIndex": 5,
"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": "AQIAAAAAAAAAAAAAAAAAAAYAAABBAAAA",
"ViewState": "AQIAAAkAAAAAAAAAAAAAACUAAAAWAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.295Z"
},
@@ -400,44 +395,45 @@
},
{
"$type": "Document",
"DocumentIndex": 8,
"DocumentIndex": 1,
"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": "AQIAAAAAAAAAAAAAAAAAAAUAAAB3AAAA",
"ViewState": "AQIAAB4AAAAAAAAAAAAAAD8AAAAxAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T13:35:33.369Z"
"WhenOpened": "2024-03-14T13:35:33.369Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 10,
"DocumentIndex": 0,
"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": "AQIAAAAAAAAAAAAAAAAAAAoAAABbAAAA",
"ViewState": "AQIAACEBAAAAAAAAAAAvwDQBAAAfAAAA",
"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": 3,
"DocumentIndex": 4,
"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": "AQIAAEgAAAAAAAAAAAAvwD8AAAAAAAAA",
"ViewState": "AQIAAPwAAAAAAAAAAAAAAPUAAACqAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.315Z",
"EditorCaption": ""
"WhenOpened": "2024-01-28T20:40:06.315Z"
},
{
"$type": "Document",
"DocumentIndex": 19,
"DocumentIndex": 20,
"Title": "settings.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeDocumentMoniker": "settings.h",
@@ -449,7 +445,7 @@
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 19,
"Title": "utils.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h",
"RelativeDocumentMoniker": "utils.h",
@@ -457,24 +453,24 @@
"RelativeToolTip": "utils.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABIAAABJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T15:55:30.524Z",
"EditorCaption": ""
"WhenOpened": "2024-03-14T15:55:30.524Z"
},
{
"$type": "Document",
"DocumentIndex": 9,
"DocumentIndex": 3,
"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": "AQIAAAAAAAAAAAAAAAAAAAYAAABZAAAA",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABMAAAAVAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-05-10T11:48:55.871Z"
"WhenOpened": "2024-05-10T11:48:55.871Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 20,
"DocumentIndex": 21,
"Title": "local_schedule.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp",
"RelativeDocumentMoniker": "local_schedule.cpp",
@@ -486,7 +482,7 @@
},
{
"$type": "Document",
"DocumentIndex": 22,
"DocumentIndex": 23,
"Title": "local_com.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.cpp",
"RelativeDocumentMoniker": "local_com.cpp",
@@ -498,7 +494,7 @@
},
{
"$type": "Document",
"DocumentIndex": 23,
"DocumentIndex": 24,
"Title": "zip.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.h",
"RelativeDocumentMoniker": "zip.h",
@@ -510,7 +506,7 @@
},
{
"$type": "Document",
"DocumentIndex": 25,
"DocumentIndex": 26,
"Title": "deepscan.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.h",
"RelativeDocumentMoniker": "deepscan.h",

View File

@@ -42,8 +42,6 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
// Allocate a buffer for the file name and copy the content
std::wstring fileName(pInfo->FileName, pInfo->FileNameLength / sizeof(wchar_t));
fileName.push_back(L'\0'); //NULL-terminate the string
//if (debug_mode())
// std::wcout<<"[HIGH_ALERT_DEBUG/NO_DISK_WRITE]: file changed " << fileName <<std::endl;
// Convert wstring to string
std::string filename_str(fileName.begin(), fileName.end());
filename_str = "c:\\" + filename_str;
@@ -55,16 +53,9 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
return;
}
else {
//int thread_timeout = 0;
//while (get_num_threads()-1 >= std::thread::hardware_concurrency()) {
// Sleep(10);
// thread_timeout++;
// if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
// set_num_threads(0);
// }
//}
if (debug_mode())
log(LOGLEVEL::INFO_NOSEND, "[process_changes()]: File ", filename_str.c_str(), " has been changed. Scanning it for viruses");
//start the scan in a separate thread
std::thread scan_thread(scan_file_t, filename_str);
scan_thread.detach();
Sleep(1);
@@ -105,7 +96,7 @@ void monitor_directory(LPCSTR directory) {
buffer,
bufferSize,
TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE, // Notify on file name changes (=file moves) and last write changes
NULL,
&overlapped,
NULL) == 0) {
@@ -132,7 +123,7 @@ void monitor_directory(LPCSTR directory) {
do {
process_changes(pInfo);
// Move to the next entry
pInfo = reinterpret_cast<FILE_NOTIFY_INFORMATION*>(reinterpret_cast<BYTE*>(pInfo) + pInfo->NextEntryOffset);
} while (pInfo->NextEntryOffset != 0);
@@ -147,7 +138,7 @@ void monitor_directory(LPCSTR directory) {
buffer,
bufferSize,
TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,// Notify on file name changes (=file moves) and last write changes
NULL,
&overlapped,
NULL) == 0) {

View File

@@ -21,6 +21,7 @@ Functions:
std::mutex mtx; // Declare a mutex for thread synchronization
//function that monitors the processes running on the system
void monitor_processes() {
static DWORD previousProcessIds[1024] = { 0 }; // Previous snapshot of process IDs
DWORD processIds[1024];

View File

@@ -33,7 +33,6 @@ int main(int argc, char* argv[]) {
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 (argc != 2) {
if (update_settings("settings") != 0) { //update the settings from the server
@@ -60,6 +59,7 @@ int main(int argc, char* argv[]) {
Sleep(1000); //wait for the log to be written
exit(1);
}
//do self check
if ((err = selfcheck()) != 0) {
log(LOGLEVEL::PANIC, "[main()]:This installation of cyberhex failed the self check! Application may be tampered with!", err);

View File

@@ -1,5 +1,5 @@
 Quellen werden auf Modulabhängigkeiten überprüft...
utils.cpp
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\utils.cpp(230,42): warning C4101: "e": Unreferenzierte lokale Variable
scan.cpp
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\scan.cpp(264,46): warning C4018: ">=": Konflikt zwischen "signed" und "unsigned"
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\vcpkg.targets(228,5): warning : [vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: -ExecutionPolicy Bypass -noprofile -File "C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\applocal.ps1" "C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe" "C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\debug\bin" "client_backend\x64\Debug\client_backend.tlog\client_backend.write.1u.tlog" "client_backend\x64\Debug\vcpkg.applocal.log"

View File

@@ -27,7 +27,7 @@ Functions:
#include <mutex>
std::mutex connect_mutex;
//this function is thread safe
//this function is thread safe and used to send a request to the server. mainly used for log entrys, because it is fast and does not need a response
int fast_send(const std::string& url, bool ignore_insecure) {
std::lock_guard<std::mutex> lock(connect_mutex);
thread_local const std::string url_ = url;
@@ -56,7 +56,7 @@ static size_t write_callback_connect(void* contents, size_t size, size_t nmemb,
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
//make this multi thread safe
//make this multi thread safe, and return the response from the server into a called "out" (param)
int connect_to_srv(const std::string& url, char* out, int max_len, bool ignore_insecure) {
CURL* curl;
CURLcode res;
@@ -90,6 +90,7 @@ size_t write_callback_download(void* contents, size_t size, size_t nmemb, void*
return totalSize;
}
// used to download files from the server
int download_file_from_srv(const std::string& url, const std::string& output_file_path, bool ignore_insecure, bool do_not_check_cyberhex_cert) {
char* temp_path = new char[output_file_path.size() + 6];
strcpy(temp_path, output_file_path.c_str());
@@ -160,6 +161,8 @@ int download_file_from_srv(const std::string& url, const std::string& output_fil
return 0;
}
// function to encode a URL into url safe format
std::string url_encode(const std::string& input) {
static const char* const safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~";
std::string encoded;
@@ -178,6 +181,7 @@ std::string url_encode(const std::string& input) {
return encoded;
}
// function to upload a file to the server. not used now, but could be used e.g. to upload malware samples to the server etc
int upload_to_srv(const std::string& url, const std::string& filepath, bool ignore_insecure) {
CURL* curl;
CURLcode res;
@@ -210,6 +214,8 @@ int upload_to_srv(const std::string& url, const std::string& filepath, bool igno
}
return 2;
}
// function to send a message to a named pipe. not used now, but could be used to communicate with other processes. We currently just youse ofstream to write to a file
int send_to_pipe(const std::string& message) {
HANDLE hPipe;
DWORD dwRead;
@@ -236,6 +242,8 @@ int send_to_pipe(const std::string& message) {
return 1;
}
}
// function to read a message from a named pipe. not used now, but could be used to communicate with other processes. We currently just youse ifstream to read from a file
std::string read_from_pipe() {
HANDLE hPipe;
DWORD dwRead;

View File

@@ -40,7 +40,7 @@ int action_deepscan_is_virus = 0; //flag that is set by the callback function to
//action_deepscanfolder
//deepscan_folder
// Load YARA rules from a file and compile them
YR_RULES* load_yara_rules(const char* ruleFilePath, YR_RULES* compiledRules = nullptr) {
// Create a new compiler
YR_COMPILER* compiler;
@@ -72,6 +72,8 @@ YR_RULES* load_yara_rules(const char* ruleFilePath, YR_RULES* compiledRules = nu
fclose(file);
return compiledRules;
}
// Initialize YARA rules by loading them from a folder
void init_yara_rules(const char* folderPath) {
// Stack to store directories to be traversed iteratively
@@ -102,6 +104,8 @@ void init_yara_rules(const char* folderPath) {
std::stack<std::string> deep_directories; // Stack to store directories to be scanned
// Scan all files in a folder recursively using first the normal scanner, then the deep scanner
void deepscan_folder(const std::string& directory) {
deep_directories.push(directory);
@@ -186,6 +190,8 @@ struct Callback_data {
std::string filepath;
// You can add more data members here if needed
};
// Callback function for YARA scan
int process_callback(YR_SCAN_CONTEXT* context,int message, void* message_data, void* user_data) {
switch (message) {
case CALLBACK_MSG_RULE_MATCHING:
@@ -207,6 +213,8 @@ int process_callback(YR_SCAN_CONTEXT* context,int message, void* message_data, v
}
return CALLBACK_CONTINUE;
}
// Scan a single file using YARA rules (thread-safe)
bool deepscan_file_t(const std::string& file_path) {
set_num_threads(get_num_threads() + 1);
// we do not need to make a new instance of yara rules, because they are global and do not get deleted or modified
@@ -243,6 +251,8 @@ bool deepscan_file_t(const std::string& file_path) {
return true;
}
// Action function for deepscanfolder
void action_deepscanfolder(const std::string& folderpath) {
thread_init();
thread_local std::string folderpath_(folderpath);

View File

@@ -38,6 +38,7 @@ std::string get_loglevel(LOGLEVEL level);
template <typename... Args>
void log(LOGLEVEL level, const std::string& message, Args&&... args) {
//reset the log timeout
log_timeout_reset_set(log_timeout_reset_get() + 1);
std::string prefix = get_loglevel(level);
std::time_t now = std::time(nullptr);
@@ -46,8 +47,9 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) {
int error = 0;
std::ostringstream logStream;
std::ostringstream to_srv;
to_srv << std::put_time(&tm, "%Y-%m-%d %H:%M:%S") << ";" << prefix << ";" << message;
logStream << std::put_time(&tm, "%Y-%m-%d %H:%M:%S") << " " << prefix << " " << message;
//build the log strings
to_srv << std::put_time(&tm, "%Y-%m-%d %H:%M:%S") << ";" << prefix << ";" << message; //build the string for the server, use ; as delimiter
logStream << std::put_time(&tm, "%Y-%m-%d %H:%M:%S") << "\t" << prefix << "\t" << message; //build the string for the log file
if constexpr (sizeof...(args) > 0) {
((logStream << ' ' << std::forward<Args>(args)), ...);
((to_srv << ' ' << std::forward<Args>(args)), ...);
@@ -55,8 +57,9 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) {
logStream << std::endl;
std::string logString = logStream.str();
std::string to_srv_string = to_srv.str();
printf("info from logger: %s", logString.c_str());
printf("info from logger: %s", logString.c_str()); //print the log message to the console
FILE* fp;
//write the log message to the appropriate log file
switch (level) {
case LOGLEVEL::INFO:
error = fopen_s(&fp, INFOFILE, "a");
@@ -104,8 +107,8 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) {
fclose(fp);
}
}
//printf("info from logger2: %s", logString.c_str());
if (level != LOGLEVEL::INFO_NOSEND && level != LOGLEVEL::WARN_NOSEND && level != LOGLEVEL::ERR_NOSEND && level != LOGLEVEL::PANIC_NOSEND/* && log_timeout_get() < 5*/) {
//send log message to server
std::string url;
int res = 0;
url = get_setting_string("server:server_url");
@@ -116,11 +119,10 @@ void log(LOGLEVEL level, const std::string& message, Args&&... args) {
url += get_machineid(SECRETS);
url += "&apikey=";
url += get_apikey(SECRETS);
//printf("sending to srv: %s", url.c_str());
//send with fastsend in new thread
std::thread send_thread(fast_send, url, get_setting("communication:unsafe_tls"));
send_thread.detach();
Sleep(10);//in order to wait for the thread to copy the params into its own memory
Sleep(5);//in order to wait for the thread to copy the params into its own memory
}
}

View File

@@ -15,12 +15,11 @@ Functions:
// Define a mutex for thread synchronization
std::mutex fileMutex_hash;
// Function to hash a file using the MD5 algorithm
int md5_file(const char* path, char* md5Hash) {
std::ifstream file(path, std::ios::binary);
if (!file) {
// Log the error if needed (uncomment if required)
// log(LOGLEVEL::ERR, "[md5_file()]: Could not open file for scanning ", path);
return 1;
}
@@ -49,13 +48,11 @@ int md5_file(const char* path, char* md5Hash) {
return 0;
}
// Function to hash a file using the MD5 algorithm (thread-safe)
std::string md5_file_t(const std::string& path_) {
std::string path(path_);
FILE* fp = fopen(path.c_str(), "rb");
//printf("%s\n",path.c_str());
if (!fp) {
// Log the error if needed (uncomment if required)
// log(LOGLEVEL::WARN_NOSEND, "[md5_file_t()]: Could not open file for scanning ", path.c_str());
return "nan"; // Return the path because otherwise, it might crash (if we send a nullptr)
}

View File

@@ -12,20 +12,13 @@ Functions:
#define _WIN32_WINNT 0x0500
#pragma comment(lib, "advapi32.lib")
#include "permissions.h"
#include <mutex> // Include mutex for synchronization
#include <mutex> // Include mutex for synchronizationddd
#include <Windows.h>
#include <io.h> // Include for _chmod function
// Mutex for synchronizing file operations
std::mutex fileMutex;
/*
1 create file (as admin)
2 set file as read only (also as admin)
file cannot be deleted or modified by anyone. admin can delete
*/
// Mark as read-only
int protect_file(const char* path) {
std::lock_guard<std::mutex> lock(fileMutex); // Lock the mutex
@@ -44,7 +37,7 @@ BOOL create_file_protection(SECURITY_ATTRIBUTES* pSA)
// Define the SDDL for the DACL. This example sets
// the following access:
// Built-in guests are denied all access.
// Anonymous logon is denied all access.
// Anonymous logon is denied all access.a
// Authenticated users are denied all access.
// Administrators are allowed full control.
// Modify these values as needed to generate the proper

View File

@@ -22,6 +22,7 @@ int queue_size = 0;
int queue_start = 0;
int queue_end = 0;
// Push a string to the queue the string containes the action to be started and the params of this action
int queue_push(const std::string& str) {
if (queue_size == queue_limit) {
return 1; // Queue full
@@ -34,6 +35,7 @@ int queue_push(const std::string& str) {
}
}
// Pop a string/action from the queue
std::string queue_pop() {
if (queue_size == 0) {
return "nan"; // Queue empty

View File

@@ -158,15 +158,6 @@ int search_hash(const std::string& dbname_, const std::string& hash_, const std:
}
// auto fileIter = fileHandles.find(dbname);
//if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
//log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
// return 2;
//}
//else if (fileIter == fileHandles.end()) {
// return 2;
//}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
@@ -267,32 +258,20 @@ void scan_folder(const std::string& directory) {
if(debug_mode())
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path);
// Do multithreading here
int thread_timeout = 0;
//log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path);
while (get_num_threads() >= std::thread::hardware_concurrency()) {
Sleep(10);
thread_timeout++;
//printf("Thread timeout: %d\n", thread_timeout);
if (thread_timeout == 100 * 20) {
// If there is no available thread for more than 30 seconds, reset the thread counter
// If there is no available thread for more than 20 seconds, reset the thread counter
set_num_threads(0);
}
}
//log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path);
if (is_valid_path(full_path)) { // Filter out invalid paths and paths with weird characters
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) { // 4GB
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
}
}
else {
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
}
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
@@ -377,16 +356,20 @@ void scan_file_t(const std::string& filepath_) {
set_num_threads(get_num_threads() + 1);
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
//thread_local char* hash = new char[300];
thread_local std::string hash(md5_file_t(filepath));
//if (strlen(hash_.c_str()) < 290)
// strcpy_s(hash, 295, hash_.c_str());
//else{
// strcpy_s(hash, 295, "");
// log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
//}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
if(is_valid_path(filepath)){
std::uintmax_t fileSize = std::filesystem::file_size(filepath);
if (fileSize > 4000000000) { // 4GB
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", filepath);
}
else {
thread_local std::string hash(md5_file_t(filepath));
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
}
}
else {
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", filepath);
}
set_num_threads(get_num_threads() - 1);
}
void scan_process_t(const std::string& filepath_) {

View File

@@ -18,6 +18,8 @@ Functions:
std::mutex fileMutex_sec; // Mutex to synchronize file access
// Function to check if the certificate is valid. the certificate is stored in the first line of each settings file. we check them agains the one in the secrets file
int check_cert(const std::string& cert, const std::string& secrets_path) {
std::ifstream file(secrets_path);
if (!file.is_open()) {
@@ -39,6 +41,7 @@ int check_cert(const std::string& cert, const std::string& secrets_path) {
}
}
// Function to return the API key from the secrets file
std::string get_apikey(const std::string& secrets_path) {
std::ifstream file(secrets_path);
if (!file.is_open()) {
@@ -58,6 +61,7 @@ std::string get_apikey(const std::string& secrets_path) {
}
}
// Function to return the machine ID from the secrets file
std::string get_machineid(const std::string& secrets_path) {
std::ifstream file(secrets_path);
if (!file.is_open()) {
@@ -77,6 +81,7 @@ std::string get_machineid(const std::string& secrets_path) {
}
}
// Function to check if the cyberhex files have been tampered with
bool selfcheck() {
//hash all the cyberhex files and check if they have been tampered with
if (md5_file_t(DLL_LIBCRYPTO_PATH) != DLL_LIBCRYPTO_HASH)

View File

@@ -53,8 +53,6 @@ void load_excluded_folders();
void load_disallowed_start_folders();
int load_settings() {
//std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings file operations
std::ifstream file(SETTINGS_DB);
if (!file.is_open()) {
@@ -64,12 +62,11 @@ int load_settings() {
}
std::string settings_cmd, settings_arg;
file>>settings_cmd;//the firs tline is our cert
file>>settings_cmd;//the firs tline is our cert, which is used to determine if we can trust this file. This trust check has already been done after the file has been downloaded from the server
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;
@@ -106,16 +103,19 @@ int load_settings() {
file.close();
// Load included and excluded folders (=for RTP)
load_included_folders();
load_excluded_folders();
// Load disallowed start folders (=folders from where no app is allowed to start)
load_disallowed_start_folders();
return 0;
}
// We have two different get_setting functions. One for int and one for std::string return values
//return the settings which are integer based
int get_setting(const std::string& setting_name) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::lock_guard<std::mutex> lock(settingsMutex);
if (setting_name == "virus_ctrl:virus_found:action") {
return setting_virus_ctrl_virus_found_action;
@@ -138,9 +138,9 @@ int get_setting(const std::string& setting_name) {
return -1;
}
//return the settings which are string based
std::string get_setting_string(const std::string& setting_name) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::lock_guard<std::mutex> lock(settingsMutex);
if (setting_name == "server:server_url") {
return setting_server_server_url;
@@ -150,7 +150,7 @@ std::string get_setting_string(const std::string& setting_name) {
}
void load_included_folders() {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::lock_guard<std::mutex> lock(settingsMutex);
std::ifstream file(INCLUDED_FOLDERS);
@@ -159,8 +159,9 @@ void load_included_folders() {
return;
}
//the paths are stored as follows in the file "<path>", so we have to parse the text between "" to get the path
std::string line;
std::getline(file, line); // Skip the first line
std::getline(file, line); // Skip the first line, because it is the certificate
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) {
@@ -175,6 +176,7 @@ void load_included_folders() {
file.close();
}
// Load the excluded folders from the excluded folders file, works the same as load_included_folders
void load_excluded_folders() {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
@@ -201,6 +203,7 @@ void load_excluded_folders() {
file.close();
}
// Load the disallowed start folders from the disallowed start folders file, works the same as load_included_folders
void load_disallowed_start_folders() {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::ifstream file(DISALLOWED_START_FOLDERS);
@@ -226,6 +229,7 @@ void load_disallowed_start_folders() {
file.close();
}
// Check if a folder is included in the included_folders
bool is_folder_included(const std::string& path) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::string lower_path=to_lower(path);
@@ -237,6 +241,7 @@ bool is_folder_included(const std::string& path) {
return false;
}
// Check if a folder is excluded in the excluded_folders
bool is_folder_excluded(const std::string& path) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::string lower_path = to_lower(path);
@@ -247,6 +252,8 @@ bool is_folder_excluded(const std::string& path) {
}
return false;
}
// Check if a folder is disallowed in the disallowed start folders. This function also supports patterns like c:\users\*\blabla
bool is_disallowed_sart_folder(const std::string& path) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
std::string lower_path = to_lower(path);
@@ -259,7 +266,7 @@ bool is_disallowed_sart_folder(const std::string& path) {
}
// only for debug purposes, prints the included folders
void print_inclusions() {
std::lock_guard<std::mutex> lock(logMutex); // Lock access to log printing
@@ -268,24 +275,28 @@ void print_inclusions() {
}
}
//return the log timeout. namely for how long we werent able to send a log entry to the server
int log_timeout_get() {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
return srv_log_timeout;
}
//set the log timeout
void log_timeout_set(int timeout) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
srv_log_timeout = timeout;
}
//set the log timeout reset => after how long should the log timeout be reset
void log_timeout_reset_set(int timeout) {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables
log_timeout_reset = timeout;
}
//get the log timeout reset
int log_timeout_reset_get() {
std::lock_guard<std::mutex> lock(settingsMutex); // Lock access to settings variables

View File

@@ -18,6 +18,7 @@ Functions:
#include "update.h"
#include "utils.h"
//this function is the function that starts threads on behalf of the scheduler and the desktop app
int start_thread(const std::string& command) {
if (can_run_thread()) {
bool has_run = 0;

View File

@@ -164,6 +164,7 @@ int update_settings(const std::string& settings_type) {
return 0;
}
//update the settings. if caled by scheduler
int action_update_settings() {
// Update the settings
int err = 0;

View File

@@ -44,6 +44,8 @@ void split(const std::string& input, char delimiter, std::string& out1, std::str
out2 = input.substr(pos + 1);
}
}
// Check if the path is valid. It checks if the file exists and if the current process has read access to the file.
bool is_valid_path(const std::string& filename) {
if (!has_read_access(filename)) {//this also fails if the file does not exist
return 0; // No read access
@@ -51,7 +53,7 @@ bool is_valid_path(const std::string& filename) {
return 1; // No special character found
}
// Check if a string matches a pattern
bool matches_pattern(const std::string& str, const std::string& pattern) {
std::string::const_iterator str_it = str.begin();
std::string::const_iterator pattern_it = pattern.begin();
@@ -88,6 +90,7 @@ bool matches_pattern(const std::string& str, const std::string& pattern) {
return pattern_it == pattern.end();
}
// Convert a string to lowercase
std::string to_lower(const std::string& str) {
std::string lower_str = str;
std::transform(lower_str.begin(), lower_str.end(), lower_str.begin(),
@@ -95,6 +98,7 @@ std::string to_lower(const std::string& str) {
return lower_str;
}
// Starts a process in a second, completly decoupled thread. used for the update process
void startup(LPCTSTR lpApplicationName)
{
// additional information
@@ -123,7 +127,7 @@ void startup(LPCTSTR lpApplicationName)
CloseHandle(pi.hThread);
}
// Get the filename from a path
std::string get_filename(const std::string& path) {
auto pos = path.find_last_of("\\");
if (pos == std::string::npos) {
@@ -136,6 +140,7 @@ std::string get_filename(const std::string& path) {
}
}
// Compare two strings case-insensitive
int strcasecmp(const std::string& s1, const std::string& s2) {
auto it1 = s1.begin();
auto it2 = s2.begin();
@@ -149,6 +154,8 @@ int strcasecmp(const std::string& s1, const std::string& s2) {
return 0;
}
// Kill a process, used by RTP proccess scanner
void kill_process(const std::string& path) {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
PROCESSENTRY32 pEntry;
@@ -172,7 +179,7 @@ void kill_process(const std::string& path) {
CloseHandle(hSnapShot);
}
// Check if a file exists! this function is prety slow, so not used extensivly. Normaly is_valid_path is used instead
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
@@ -185,6 +192,7 @@ bool file_exists(const std::string& filePath) {
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
// Get the number of running threads! This function is prety slow, so not used extensivly
int get_num_running_threads() {
DWORD runningThreads = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
@@ -211,6 +219,7 @@ int get_num_running_threads() {
return runningThreads;
}
// Check if the current process has read access to the file
bool has_read_access(const std::string &path) {
// Check if the current process has read access to the file
FILE* fp;
@@ -221,6 +230,7 @@ bool has_read_access(const std::string &path) {
return false;
}
// Delete all files in a directory
void delete_all_files(const std::string& directoryPath) {
for (const auto& entry : fs::directory_iterator(directoryPath)) {
if (fs::is_regular_file(entry)) {
@@ -233,16 +243,20 @@ void delete_all_files(const std::string& directoryPath) {
}
}
// Get the number of threads of the system. measured by a state machine, so maybe incorect
int get_num_threads() {
std::lock_guard<std::mutex> lock(numThreadsMutex);
return num_threads;
}
// Set the number of threads of the system
int set_num_threads(int num) {
std::lock_guard<std::mutex> lock(numThreadsMutex);
num_threads = num;
return 0;
}
// Check if the thread safety is enabled
bool thread_safety() { //if this is set to false the deepscan funcitons will utilize up to thousands of threads and completely destroy your machine. but it will be fast.
return true;
}

View File

@@ -30,6 +30,7 @@ Functions:
// Define a mutex for thread synchronization
std::mutex virusCtrlMutex;
// Store the path of the infected file in the database
int virus_ctrl_store(const std::string& path, const std::string& hash, const std::string& id) {
std::lock_guard<std::mutex> lock(virusCtrlMutex); // Lock the mutex
std::ofstream file(VIRUS_CTRL_DB + id, std::ios::app);
@@ -44,6 +45,7 @@ int virus_ctrl_store(const std::string& path, const std::string& hash, const std
}
}
// Process the infected files based on the settings
int virus_ctrl_process(const std::string& id) {
std::lock_guard<std::mutex> lock(virusCtrlMutex); // Lock the mutex
// Take actions based on settings.

View File

@@ -1,73 +1,73 @@
#pragma once
#ifndef WELL_KNOWN_H
#define WELL_KNOWN_H
#define MAIN_COM "main_com.txt"
#define MAIN_COM_PATH "C:\\Program Files\\cyberhex\\com\\main_com.txt"
#define ANSWER_COM "answer_com.txt"
#define ANSWER_COM_PATH "C:\\Program Files\\cyberhex\\com\\answer_com.txt"
#define MAIN_COM "main_com.txt" //main communication file for the desktop app
#define MAIN_COM_PATH "C:\\Program Files\\cyberhex\\com\\main_com.txt" //path to the main communication file
#define ANSWER_COM "answer_com.txt" //answer communication file for the desktop app
#define ANSWER_COM_PATH "C:\\Program Files\\cyberhex\\com\\answer_com.txt" //path to the answer communication file
#define SECURE_COM "secure_com.txt"
#define SECURE_COM_PATH "C:\\Program Files\\cyberhex\\secure\\com\\secure_com.txt"
#define SECURE_COM "secure_com.txt" //communication file for the server. Not used right now, but may be used in the future when the server is able to send commands
#define SECURE_COM_PATH "C:\\Program Files\\cyberhex\\secure\\com\\secure_com.txt" //path to the secure communication file
#define SCHED "sched.txt"
#define SCHED_PATH "C:\\Program Files\\cyberhex\\secure\\settings\\sched.txt"
#define SCHED "sched.txt" //scheduler file for the scheduled tasks sent by the server
#define SCHED_PATH "C:\\Program Files\\cyberhex\\secure\\settings\\sched.txt" //path to the scheduler file
#define LOGFILE "C:\\Program Files\\cyberhex\\secure\\log\\log.txt"
#define INFOFILE "C:\\Program Files\\cyberhex\\secure\\log\\info.txt"
#define WARNFILE "C:\\Program Files\\cyberhex\\secure\\log\\warn.txt"
#define ERRORFILE "C:\\Program Files\\cyberhex\\secure\\log\\error.txt"
#define VIRUSFILE "C:\\Program Files\\cyberhex\\secure\\log\\virus.txt"
#define RISKFILE "C:\\Program Files\\cyberhex\\secure\\log\\risk.txt"
#define PANICFILE "C:\\Program Files\\cyberhex\\secure\\log\\panic.txt"
#define SRV_LOGFILE "C:\\Program Files\\cyberhex\\secure\\log\\srv_log.txt"
#define LOGFILE "C:\\Program Files\\cyberhex\\secure\\log\\log.txt" //path to the log file
#define INFOFILE "C:\\Program Files\\cyberhex\\secure\\log\\info.txt" //path to the info log file
#define WARNFILE "C:\\Program Files\\cyberhex\\secure\\log\\warn.txt" //path to the warning log file
#define ERRORFILE "C:\\Program Files\\cyberhex\\secure\\log\\error.txt" //path to the error log file
#define VIRUSFILE "C:\\Program Files\\cyberhex\\secure\\log\\virus.txt" //path to the virus log file
#define RISKFILE "C:\\Program Files\\cyberhex\\secure\\log\\risk.txt" //path to the risk log file! not used right now
#define PANICFILE "C:\\Program Files\\cyberhex\\secure\\log\\panic.txt" //path to the panic log file
#define SRV_LOGFILE "C:\\Program Files\\cyberhex\\secure\\log\\srv_log.txt" //path to the server log file. only used as backup, if the server would crash
#define FOLDER_DATABASE_DIR "C:\\Program Files\\cyberhex\\secure\\database\\folder"
#define FOLDER_DATABASE_DIR "C:\\Program Files\\cyberhex\\secure\\database\\folder" //path to the folder database directory where the hashes are stored
#define APP_DIR "C:\\Program Files\\cyberhex\\secure\\app"
#define APP_DIR "C:\\Program Files\\cyberhex\\secure\\app" //path to the app directory
#define DB_DIR "C:\\Program Files\\cyberhex\\secure\\database"
#define YARA_DB_DIR "C:\\Program Files\\cyberhex\\secure\\yara"
#define DB_DIR "C:\\Program Files\\cyberhex\\secure\\database" //path to the database directory where the hashes are stored
#define YARA_DB_DIR "C:\\Program Files\\cyberhex\\secure\\yara" //path to the yara database directory where the yara rules are stored
#define VIRUS_CTRL_DB "C:\\Program Files\\cyberhex\\secure\\database\\virus_ctrl_db.txt"
#define VIRUS_CTRL_DB "C:\\Program Files\\cyberhex\\secure\\database\\virus_ctrl_db.txt" //path to the virus control database
#define SETTINGS_DB "C:\\Program Files\\cyberhex\\secure\\settings\\settings_db.txt"
#define SETTINGS_DB "C:\\Program Files\\cyberhex\\secure\\settings\\settings_db.txt" //path to the settings database
#define QUARANTINE_PATH "C:\\Program Files\\cyberhex\\secure\\quarantine"
#define QUARANTINE_PATH "C:\\Program Files\\cyberhex\\secure\\quarantine" //path to the quarantine directory
#define SECRETS "C:\\Program Files\\cyberhex\\secure\\settings\\secrets.txt"
#define SECRETS "C:\\Program Files\\cyberhex\\secure\\settings\\secrets.txt" //path to the secrets file which containes the api key and the cert of the server
#define PERIODIC_FOLDER_SCAN "C:\\Program Files\\cyberhex\\secure\\database\\folder\\periodic_folder_scan.txt"
#define PERIODIC_FOLDER_SCAN_TEMP_DB "C:\\Program Files\\cyberhex\\secure\\database\\folder\\temp_db.txt"
#define PERIODIC_FOLDER_SCAN "C:\\Program Files\\cyberhex\\secure\\database\\folder\\periodic_folder_scan.txt" //path to the periodic folder scan file
#define PERIODIC_FOLDER_SCAN_TEMP_DB "C:\\Program Files\\cyberhex\\secure\\database\\folder\\temp_db.txt" //path to the temporary database file used for multiple things
#define INCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\included_folders.txt"
#define EXCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\excluded_folders.txt"
#define DISALLOWED_START_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\disallowed_start_folders.txt"
#define INCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\included_folders.txt" //path to the included folders file which stores the included paths
#define EXCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\excluded_folders.txt" //path to the excluded folders file which stores the excluded paths
#define DISALLOWED_START_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\disallowed_start_folders.txt" //path to the disallowed start folders file which stores the disallowed start paths
#define JAKACH_UPDATE_SRV "https://jakach.duckdns.org/cyberhex/latest/"
#define CURRENT_VERSION 1
#define JAKACH_UPDATE_SRV "https://jakach.duckdns.org/cyberhex/latest/" //url to the server where the updates are stored, namely the main jakach server
#define CURRENT_VERSION 1 //current version of the app
//hashes for self check
#define APP_HASH "aa"
#define DLL_LIBCRYPTO_HASH "06431d044cf37522e1434019522d11a0"
#define DLL_LIBCURL_HASH "cec7fb7e6cfb46be0740b02fb828900d"
#define DLL_MSVCP140_HASH "ebf8072a3c5c586979313f76e503aabf"
#define DLL_MSVCP140D_HASH "f265bdccc3d8dbc56344c0d900a833bc"
#define DLL_VCRUNTIME140_HASH "699dd61122d91e80abdfcc396ce0ec10"
#define DLL_VCRUNTIME140D_HASH "8e32121bc62367042f6d105df057d6b4"
#define DLL_VCRUNTIME140_1D_HASH "75e81353c004a6bea844c212db09e1ed"
#define DLL_ZLIB1_HASH "a966f1c10844493269521fef54e4cdef"
#define DLL_UCRTBASED_HASH "ffc3b14a9c1280517429e805ed9625b2"
#define APP_HASH "aa" //hash of the app
#define DLL_LIBCRYPTO_HASH "06431d044cf37522e1434019522d11a0" //hash of the libcrypto dll
#define DLL_LIBCURL_HASH "cec7fb7e6cfb46be0740b02fb828900d" //hash of the libcurl dll
#define DLL_MSVCP140_HASH "ebf8072a3c5c586979313f76e503aabf" //hash of the msvcp140 dll
#define DLL_MSVCP140D_HASH "f265bdccc3d8dbc56344c0d900a833bc" //hash of the msvcp140d dll
#define DLL_VCRUNTIME140_HASH "699dd61122d91e80abdfcc396ce0ec10" //hash of the vcruntime140 dll
#define DLL_VCRUNTIME140D_HASH "8e32121bc62367042f6d105df057d6b4" //hash of the vcruntime140d dll
#define DLL_VCRUNTIME140_1D_HASH "75e81353c004a6bea844c212db09e1ed" //hash of the vcruntime140_1d dll
#define DLL_ZLIB1_HASH "a966f1c10844493269521fef54e4cdef" //hash of the zlib1 dll
#define DLL_UCRTBASED_HASH "ffc3b14a9c1280517429e805ed9625b2" //hash of the ucrtbased dll
#define APP_PATH "C:\\Program Files\\cyberhex\\secure\\app\\cyberhex.exe"
#define DLL_LIBCRYPTO_PATH "c:\\Program Files\\cyberhex\\secure\\app\\libcrypto-3-x64.dll"
#define DLL_LIBCURL_PATH "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll"
#define DLL_MSVCP140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140.dll"
#define DLL_MSVCP140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140d.dll"
#define DLL_VCRUNTIME140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140.dll"
#define DLL_VCRUNTIME140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140d.dll"
#define DLL_VCRUNTIME140_1D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140_1d.dll"
#define DLL_ZLIB1_PATH "C:\\Program Files\\cyberhex\\secure\\app\\zlib1.dll"
#define DLL_UCRTBASED_PATH "C:\\Program Files\\cyberhex\\secure\\app\\ucrtbased.dll"
#define APP_PATH "C:\\Program Files\\cyberhex\\secure\\app\\cyberhex.exe" //path to the app
#define DLL_LIBCRYPTO_PATH "c:\\Program Files\\cyberhex\\secure\\app\\libcrypto-3-x64.dll" //path to the libcrypto dll
#define DLL_LIBCURL_PATH "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll" //path to the libcurl dll
#define DLL_MSVCP140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140.dll" //path to the msvcp140 dll
#define DLL_MSVCP140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140d.dll" //path to the msvcp140d dll
#define DLL_VCRUNTIME140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140.dll" //path to the vcruntime140 dll
#define DLL_VCRUNTIME140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140d.dll" //path to the vcruntime140d dll
#define DLL_VCRUNTIME140_1D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140_1d.dll" //path to the vcruntime140_1d dll
#define DLL_ZLIB1_PATH "C:\\Program Files\\cyberhex\\secure\\app\\zlib1.dll" //path to the zlib1 dll
#define DLL_UCRTBASED_PATH "C:\\Program Files\\cyberhex\\secure\\app\\ucrtbased.dll" //path to the ucrtbased dll
#endif // !WELL_KNOWN_H

View File

@@ -15,8 +15,11 @@ Code copied from:
#include <Shldisp.h>
#include <codecvt>
// Unzip the contents of a ZIP file to a specified destination folder
void unzip(const std::string& source, const std::string& dest)
{
HRESULT hResult = S_FALSE;
IShellDispatch* pIShellDispatch = NULL;
Folder* pToFolder = NULL;
@@ -24,6 +27,7 @@ void unzip(const std::string& source, const std::string& dest)
CoInitialize(NULL);
// Create an instance of the Shell object
hResult = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
IID_IShellDispatch, (void**)&pIShellDispatch);
if (SUCCEEDED(hResult))
@@ -31,18 +35,21 @@ void unzip(const std::string& source, const std::string& dest)
VariantInit(&variantDir);
variantDir.vt = VT_BSTR;
variantDir.bstrVal = SysAllocStringLen(NULL, MultiByteToWideChar(CP_UTF8, 0, dest.c_str(), -1, NULL, 0));
// Convert the destination folder path to a wide string
MultiByteToWideChar(CP_UTF8, 0, dest.c_str(), -1, variantDir.bstrVal, SysStringLen(variantDir.bstrVal));
// Get the destination folder
hResult = pIShellDispatch->NameSpace(variantDir, &pToFolder);
if (SUCCEEDED(hResult))
{
// Get the source ZIP file
Folder* pFromFolder = NULL;
VariantInit(&variantFile);
variantFile.vt = VT_BSTR;
variantFile.bstrVal = SysAllocStringLen(NULL, MultiByteToWideChar(CP_UTF8, 0, source.c_str(), -1, NULL, 0));
MultiByteToWideChar(CP_UTF8, 0, source.c_str(), -1, variantFile.bstrVal, SysStringLen(variantFile.bstrVal));
// Get the source folder
pIShellDispatch->NameSpace(variantFile, &pFromFolder);
FolderItems* fi = NULL;
@@ -56,6 +63,7 @@ void unzip(const std::string& source, const std::string& dest)
VariantInit(&newV);
newV.vt = VT_DISPATCH;
newV.pdispVal = fi;
// Extract the contents of the ZIP file to the destination folder
hResult = pToFolder->CopyHere(newV, variantOpt);
Sleep(1000);
@@ -65,6 +73,7 @@ void unzip(const std::string& source, const std::string& dest)
pIShellDispatch->Release();
}
// Cleanup
CoUninitialize();
SysFreeString(variantDir.bstrVal);
SysFreeString(variantFile.bstrVal);