front and backend can now communicate

This commit is contained in:
jakani24
2024-03-17 20:15:58 +01:00
parent 7ea487d0e1
commit 9daeaff131
33 changed files with 1301 additions and 148 deletions

View File

@@ -2,6 +2,34 @@
"Version": 1, "Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\", "WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\",
"Documents": [ "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\\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\\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\\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\\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\\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\\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\\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\\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\\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}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -10,22 +38,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\\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\\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}" "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\\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\\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\\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\\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\\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\\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}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -34,10 +46,6 @@
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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}" "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\\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\\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\\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}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -74,10 +82,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\\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\\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}" "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}", "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}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -98,11 +102,24 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 0, "SelectedChildIndex": 17,
"Children": [ "Children": [
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 3,
"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": "AQIAAAAAAAAAAAAAAAAAAB4AAAASAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-17T16:34:14.678Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 7,
"Title": "utils.h", "Title": "utils.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h",
"RelativeDocumentMoniker": "utils.h", "RelativeDocumentMoniker": "utils.h",
@@ -115,7 +132,7 @@
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 1, "DocumentIndex": 8,
"Title": "utils.cpp", "Title": "utils.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeDocumentMoniker": "utils.cpp", "RelativeDocumentMoniker": "utils.cpp",
@@ -128,19 +145,20 @@
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 13, "DocumentIndex": 15,
"Title": "check_process.cpp", "Title": "check_process.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp",
"RelativeDocumentMoniker": "check_process.cpp", "RelativeDocumentMoniker": "check_process.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp",
"RelativeToolTip": "check_process.cpp", "RelativeToolTip": "check_process.cpp",
"ViewState": "AQIAABsAAAAAAAAAAAAAADcAAABCAAAA", "ViewState": "AQIAABkAAAAAAAAAAABBwDcAAABCAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T13:35:33.369Z" "WhenOpened": "2024-03-14T13:35:33.369Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 9, "DocumentIndex": 11,
"Title": "well_known.h", "Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "well_known.h", "RelativeDocumentMoniker": "well_known.h",
@@ -148,36 +166,38 @@
"RelativeToolTip": "well_known.h", "RelativeToolTip": "well_known.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAC0AAAAZAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAC0AAAAZAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T13:20:06.953Z" "WhenOpened": "2024-03-14T13:20:06.953Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 14, "DocumentIndex": 16,
"Title": "check_dir.cpp", "Title": "check_dir.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
"RelativeDocumentMoniker": "check_dir.cpp", "RelativeDocumentMoniker": "check_dir.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
"RelativeToolTip": "check_dir.cpp", "RelativeToolTip": "check_dir.cpp",
"ViewState": "AQIAAEsAAAAAAAAAAAAAAHkAAAAwAAAA", "ViewState": "AQIAAEkAAAAAAAAAAABBwHkAAAAwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:31.009Z" "WhenOpened": "2024-03-13T06:48:31.009Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 2, "DocumentIndex": 1,
"Title": "thread_ctrl.cpp", "Title": "thread_ctrl.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp",
"RelativeDocumentMoniker": "thread_ctrl.cpp", "RelativeDocumentMoniker": "thread_ctrl.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp",
"RelativeToolTip": "thread_ctrl.cpp", "RelativeToolTip": "thread_ctrl.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAASAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAABQAAAAqAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:52:01.533Z", "WhenOpened": "2024-03-13T06:52:01.533Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 20, "DocumentIndex": 21,
"Title": "local_com.h", "Title": "local_com.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
"RelativeDocumentMoniker": "local_com.h", "RelativeDocumentMoniker": "local_com.h",
@@ -185,11 +205,12 @@
"RelativeToolTip": "local_com.h", "RelativeToolTip": "local_com.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:49:41.823Z" "WhenOpened": "2024-03-13T06:49:41.823Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 10, "DocumentIndex": 12,
"Title": "log.h", "Title": "log.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeDocumentMoniker": "log.h", "RelativeDocumentMoniker": "log.h",
@@ -197,11 +218,12 @@
"RelativeToolTip": "log.h", "RelativeToolTip": "log.h",
"ViewState": "AQIAAEwAAAAAAAAAAAD4v2wAAABKAAAA", "ViewState": "AQIAAEwAAAAAAAAAAAD4v2wAAABKAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:47:02.038Z" "WhenOpened": "2024-03-13T06:47:02.038Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 21, "DocumentIndex": 22,
"Title": "virus_ctrl.h", "Title": "virus_ctrl.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h",
"RelativeDocumentMoniker": "virus_ctrl.h", "RelativeDocumentMoniker": "virus_ctrl.h",
@@ -209,11 +231,12 @@
"RelativeToolTip": "virus_ctrl.h", "RelativeToolTip": "virus_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:45:51.845Z" "WhenOpened": "2024-03-13T06:45:51.845Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 11, "DocumentIndex": 13,
"Title": "connect.h", "Title": "connect.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
"RelativeDocumentMoniker": "connect.h", "RelativeDocumentMoniker": "connect.h",
@@ -221,11 +244,12 @@
"RelativeToolTip": "connect.h", "RelativeToolTip": "connect.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAA8AAABrAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAA8AAABrAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:44:13.879Z" "WhenOpened": "2024-03-13T06:44:13.879Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 19, "DocumentIndex": 20,
"Title": "queue_ctrl.h", "Title": "queue_ctrl.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h",
"RelativeDocumentMoniker": "queue_ctrl.h", "RelativeDocumentMoniker": "queue_ctrl.h",
@@ -233,11 +257,12 @@
"RelativeToolTip": "queue_ctrl.h", "RelativeToolTip": "queue_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:43:48.22Z" "WhenOpened": "2024-03-13T06:43:48.22Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 16, "DocumentIndex": 18,
"Title": "queue _ctrl.cpp", "Title": "queue _ctrl.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp",
"RelativeDocumentMoniker": "queue _ctrl.cpp", "RelativeDocumentMoniker": "queue _ctrl.cpp",
@@ -245,11 +270,12 @@
"RelativeToolTip": "queue _ctrl.cpp", "RelativeToolTip": "queue _ctrl.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.295Z" "WhenOpened": "2024-01-28T20:40:06.295Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 12, "DocumentIndex": 14,
"Title": "update.h", "Title": "update.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeDocumentMoniker": "update.h", "RelativeDocumentMoniker": "update.h",
@@ -257,11 +283,12 @@
"RelativeToolTip": "update.h", "RelativeToolTip": "update.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:28.196Z" "WhenOpened": "2024-03-13T06:42:28.196Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 15, "DocumentIndex": 17,
"Title": "settings.cpp", "Title": "settings.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp",
"RelativeDocumentMoniker": "settings.cpp", "RelativeDocumentMoniker": "settings.cpp",
@@ -269,11 +296,12 @@
"RelativeToolTip": "settings.cpp", "RelativeToolTip": "settings.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:40.364Z" "WhenOpened": "2024-03-13T06:48:40.364Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 17, "DocumentIndex": 19,
"Title": "settings.h", "Title": "settings.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeDocumentMoniker": "settings.h", "RelativeDocumentMoniker": "settings.h",
@@ -281,94 +309,96 @@
"RelativeToolTip": "settings.h", "RelativeToolTip": "settings.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:03.328Z" "WhenOpened": "2024-03-13T06:42:03.328Z",
},
{
"$type": "Document",
"DocumentIndex": 18,
"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"
},
{
"$type": "Document",
"DocumentIndex": 4,
"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": "AQIAAOkAAAAAAAAAAAAkwOkAAAAgAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 5, "DocumentIndex": 5,
"Title": "client_backend.cpp", "Title": "scan.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeDocumentMoniker": "client_backend.cpp", "RelativeDocumentMoniker": "scan.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeToolTip": "client_backend.cpp", "RelativeToolTip": "scan.h",
"ViewState": "AQIAAAwAAAAAAAAAAAAAADAAAAACAAAA", "ViewState": "AQIAAA0AAAAAAAAAAAAAABMAAAAPAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-01-28T20:40:06.279Z", "WhenOpened": "2024-03-13T06:41:43.701Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 6, "DocumentIndex": 0,
"Title": "update.cpp", "Title": "scan.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp",
"RelativeDocumentMoniker": "update.cpp", "RelativeDocumentMoniker": "scan.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp",
"RelativeToolTip": "update.cpp", "RelativeToolTip": "scan.cpp",
"ViewState": "AQIAAAYAAAAAAAAAAAAAAAkAAAARAAAA", "ViewState": "AQIAAMIAAAAAAAAAAAAkwOkAAAAFAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z", "WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 3, "DocumentIndex": 4,
"Title": "local_schedule.cpp", "Title": "client_backend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
"RelativeDocumentMoniker": "local_schedule.cpp", "RelativeDocumentMoniker": "client_backend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_schedule.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
"RelativeToolTip": "local_schedule.cpp", "RelativeToolTip": "client_backend.cpp",
"ViewState": "AQIAAGYAAAAAAAAAAAAAAIYAAAAiAAAA", "ViewState": "AQIAAC0AAAAAAAAAAAAAAFYAAAAfAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z", "WhenOpened": "2024-01-28T20:40:06.279Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 7, "DocumentIndex": 9,
"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": "AQIAAAQAAAAAAAAAAABBwAkAAAARAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"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": "AQIAAGEAAAAAAAAAAAAkwI4AAAANAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 10,
"Title": "connect.cpp", "Title": "connect.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp",
"RelativeDocumentMoniker": "connect.cpp", "RelativeDocumentMoniker": "connect.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp",
"RelativeToolTip": "connect.cpp", "RelativeToolTip": "connect.cpp",
"ViewState": "AQIAAJwAAAAAAAAAAAAAAHkAAAAtAAAA", "ViewState": "AQIAAJoAAAAAAAAAAABBwHkAAAAtAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.315Z", "WhenOpened": "2024-01-28T20:40:06.315Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 8, "DocumentIndex": 2,
"Title": "virus_ctrl.cpp", "Title": "virus_ctrl.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp",
"RelativeDocumentMoniker": "virus_ctrl.cpp", "RelativeDocumentMoniker": "virus_ctrl.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.cpp",
"RelativeToolTip": "virus_ctrl.cpp", "RelativeToolTip": "virus_ctrl.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACUAAABHAAAA", "ViewState": "AQIAAEEAAAAAAAAAAAAwwHYAAABIAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-02-18T12:49:41.861Z", "WhenOpened": "2024-02-18T12:49:41.861Z",
"EditorCaption": "" "EditorCaption": ""

View File

@@ -5,30 +5,41 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <sstream>
#include <iomanip>
int check_for_com_tasks(const std::string& com_name, const std::string& com_path) { int check_for_com_tasks(const std::string& com_name, const std::string& com_path) {
std::ifstream file(com_path); std::ifstream file(com_path);
if (!file.is_open()) { if (!file.is_open()) {
// No com file found = no communication needed return 1; // Error opening file
return 1;
} }
std::string command; std::string command;
while (file >> command) { std::string path;
// Scan the command std::string line;
std::string path; while (std::getline(file, line)) {
file >> path; // Scan the path std::stringstream ss(line);
if (ss >> command) {
// Add command and path to the queue // Check if the next token is a quoted path
std::string queue_entry = command + ";" + path; if (line.find("\"") != std::string::npos) {
queue_push(queue_entry.c_str()); size_t start = line.find("\"") + 1; // Start after the opening quote
size_t end = line.find_last_of("\""); // Find the last quote
if (start != std::string::npos && end != std::string::npos) {
path = line.substr(start, end - start);
}
}
else {
// If no quotes found, simply take the next token as the path
ss >> 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(); file.close();
std::remove(com_path.c_str()); std::remove(com_path.c_str());
return 0; return 0;
} }
#endif // !LOCAL_COM_CPP #endif // !LOCAL_COM_CPP

View File

@@ -158,8 +158,6 @@ int search_hash(const std::string& dbname_, const std::string& hash_, const std:
return 0; // Not found return 0; // Not found
} }
// Rest of the code remains unchanged...
bool file_exists(const std::string& filePath) { bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str()); DWORD fileAttributes = GetFileAttributes(filePath.c_str());
@@ -235,7 +233,15 @@ void action_scanfile(const std::string& filepath_) {
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath); 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]); sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath); if (search_hash(db_path, hash, filepath) != 1) {
//notify desktop client by writing to answer_com file
//if there is now virus, we notify here. if there is a virus we only notify in the virus_ctrl_process function
std::ofstream answer_com(ANSWER_COM_PATH,std::ios::app);
if (answer_com.is_open()) {
answer_com << "not_found " << "\"" << filepath_ << "\"" << " " << hash << " " << "no_action_taken" << "\n";
answer_com.close();
}
}
thread_shutdown(); thread_shutdown();
} }
void action_scanfolder(const std::string& folderpath) { void action_scanfolder(const std::string& folderpath) {
@@ -243,6 +249,11 @@ void action_scanfolder(const std::string& folderpath) {
cnt = 0; cnt = 0;
thread_local std::string folderpath_(folderpath); thread_local std::string folderpath_(folderpath);
scan_folder(folderpath_); scan_folder(folderpath_);
std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app);
if (answer_com.is_open()) {
answer_com << "end " << "\"" << "nothing" << "\"" << " " << "nothing" << " " << "nothing" << "\n";
answer_com.close();
}
thread_shutdown(); thread_shutdown();
} }

View File

@@ -16,6 +16,7 @@
#include <windows.h> #include <windows.h>
#include <tlhelp32.h> #include <tlhelp32.h>
#include <cstring> #include <cstring>
#include <fstream>
// Define a mutex for thread synchronization // Define a mutex for thread synchronization
std::mutex virusCtrlMutex; std::mutex virusCtrlMutex;
@@ -112,6 +113,13 @@ int virus_ctrl_process(const std::string& id) {
else { else {
log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while notifying server about virus: ", path, " ", hash); log(LOGLEVEL::ERR, "[virus_ctrl_process()]: Error while notifying server about virus: ", path, " ", hash);
} }
//notify desktop client
std::ofstream answer_com(ANSWER_COM_PATH,std::ios::app);
if (answer_com.is_open()) {
answer_com << "found " << "\"" << path << "\"" << " " << hash << " " << action << "\n";
answer_com.close();
}
} }
} }
file.close(); file.close();

View File

@@ -7,7 +7,7 @@
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}, },
{ {
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\VCPKG\\VCPKG-2023.08.09\\INSTALLED\\X64-WINDOWS\\INCLUDE\\NANOGUI\\GLUTIL.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -22,15 +22,14 @@
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 1, "DocumentIndex": 1,
"Title": "glutil.h", "Title": "well_known.h",
"DocumentMoniker": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h", "RelativeDocumentMoniker": "..\\client_backend\\well_known.h",
"ToolTip": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h", "RelativeToolTip": "..\\client_backend\\well_known.h",
"ViewState": "AQIAANwAAAAAAAAAAAD4v/gAAAAKAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAAVAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T20:21:24.734Z", "WhenOpened": "2024-03-17T16:32:22.34Z"
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
@@ -40,7 +39,7 @@
"RelativeDocumentMoniker": "main.cpp", "RelativeDocumentMoniker": "main.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeToolTip": "main.cpp", "RelativeToolTip": "main.cpp",
"ViewState": "AQIAAA0AAAAAAAAAAAD4vxUAAAA5AAAA", "ViewState": "AQIAAAYAAAAAAAAAAAAAAP0AAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T19:45:55.142Z", "WhenOpened": "2024-03-14T19:45:55.142Z",
"EditorCaption": "" "EditorCaption": ""

View File

@@ -0,0 +1,53 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "..\\client_backend\\well_known.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "..\\client_backend\\well_known.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAAVAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-17T16:32:22.34Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeDocumentMoniker": "main.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeToolTip": "main.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABQAAAAbAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T19:45:55.142Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,52 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "..\\client_backend\\well_known.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "..\\client_backend\\well_known.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAAVAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-17T16:32:22.34Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeDocumentMoniker": "main.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeToolTip": "main.cpp",
"ViewState": "AQIAAAMAAAAAAAAAAAAAAB8AAAA6AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T19:45:55.142Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,52 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "..\\client_backend\\well_known.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "..\\client_backend\\well_known.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAAVAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-17T16:32:22.34Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeDocumentMoniker": "main.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeToolTip": "main.cpp",
"ViewState": "AQIAAFYAAAAAAAAAAAAIwIsAAAANAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T19:45:55.142Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -7,24 +7,151 @@
#include <windows.h> #include <windows.h>
#include <locale> #include <locale>
#include <codecvt> #include <codecvt>
#include <fstream>
#include "../client_backend/well_known.h"
// Function to simulate file scanning // Function to simulate file scanning
void scan_file(nanogui::Screen* screen, const std::string& filePath) { void scan_file(nanogui::Screen*screen ,nanogui::Widget* contentWidget, const std::string& filePath) {
// Simulate file scanning by waiting for 10 seconds // Remove the answer file
std::this_thread::sleep_for(std::chrono::seconds(10)); std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window // Display the scanned file path in the window
screen->add<nanogui::Label>("Scanned file: " + filePath); nanogui::Label* lineLabel1 = new nanogui::Label(contentWidget, "Scanning file: " + filePath + "\n");
// Refresh layout to ensure the new label is visible
screen->performLayout(); screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
nanogui::Label* lineLabel2 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
answered = true;
if (status == "found") {
nanogui::Label* lineLabel3 = new nanogui::Label(contentWidget, "Virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel4 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is infected\n");
nanogui::Label* lineLabel5 = new nanogui::Label(contentWidget, "Hash: " + hash + "\n");
nanogui::Label* lineLabel6 = new nanogui::Label(contentWidget, "Action taken: " + action + "\n");
}
else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel8 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is not infected\n");
}
nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
}
else {
answered = true;
nanogui::Label* lineLabel10 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
nanogui::Label* lineLabel11 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
inputFile.close();
std::remove(ANSWER_COM_PATH);
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
} }
// Function to simulate folder scanning // Function to simulate folder scanning
void scan_folder(nanogui::Screen* screen, const std::string& folderPath) { void scan_folder(nanogui::Screen*screen,nanogui::Widget* contentWidget, const std::string& filePath) {
// Simulate folder scanning by waiting for 10 seconds // Remove the answer file
std::this_thread::sleep_for(std::chrono::seconds(10)); std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window // Display the scanned folder path in the window
screen->add<nanogui::Label>("Scanned folder: " + folderPath); nanogui::Label* lineLabel1 = new nanogui::Label(contentWidget, "Scanning folder: " + filePath + "\n");
// Refresh layout to ensure the new label is visible
screen->performLayout(); screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << filePath << "\"";
outputFile.close();
}
else {
nanogui::Label* lineLabel2 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
while (!inputFile.eof()) {
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
//answered = true;
if (status == "found") {
nanogui::Label* lineLabel3 = new nanogui::Label(contentWidget, "Virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel4 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is infected\n");
nanogui::Label* lineLabel5 = new nanogui::Label(contentWidget, "Hash: " + hash + "\n");
nanogui::Label* lineLabel6 = new nanogui::Label(contentWidget, "Action taken: " + action + "\n");
}
else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel8 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is not infected\n");
}
nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
if (status == "end")
answered = true;
}
else {
//answered = true;
nanogui::Label* lineLabel10 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
nanogui::Label* lineLabel11 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
}
inputFile.close();
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
} }
std::string getFolderPath() { std::string getFolderPath() {
std::string selectedFolderPath; std::string selectedFolderPath;
@@ -67,8 +194,7 @@ int main() {
nanogui::init(); nanogui::init();
// Create a NanoGUI screen // Create a NanoGUI screen
nanogui::Screen screen(nanogui::Vector2i(400, 300), "Antivirus"); nanogui::Screen screen(nanogui::Vector2i(800, 600), "Cyberhex endpoint protection");
// Create a layout for the buttons // Create a layout for the buttons
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen); nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical, nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
@@ -76,6 +202,16 @@ int main() {
5, 5); 5, 5);
buttonWidget->setLayout(buttonLayout); buttonWidget->setLayout(buttonLayout);
// Create a widget inside the scroll panel to hold the content
nanogui::VScrollPanel* scrollPanel = new nanogui::VScrollPanel(&screen);
scrollPanel->setLayout(new nanogui::GroupLayout(10));
nanogui::Widget* contentWidget = new nanogui::Widget(scrollPanel);
contentWidget->setLayout(new nanogui::GroupLayout(10));
scrollPanel->setFixedSize(nanogui::Vector2i(750, 450));
// Create a button for scanning a file // Create a button for scanning a file
nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File"); nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File");
scanFileButton->setFixedWidth(150); scanFileButton->setFixedWidth(150);
@@ -87,7 +223,7 @@ int main() {
); );
if (!selectedFile.empty()) { if (!selectedFile.empty()) {
// Call scan_file function in a separate thread // Call scan_file function in a separate thread
std::thread(scan_file, &screen, selectedFile).detach(); std::thread(scan_file,&screen, contentWidget, selectedFile).detach();
} }
}); });
@@ -99,16 +235,32 @@ int main() {
std::string selectedFolder = getFolderPath(); std::string selectedFolder = getFolderPath();
if (!selectedFolder.empty()) { if (!selectedFolder.empty()) {
// Call scan_folder function in a separate thread // Call scan_folder function in a separate thread
std::thread(scan_folder, &screen, selectedFolder).detach(); std::thread(scan_folder, &screen,contentWidget, selectedFolder).detach();
} }
}); });
// Set the layout for the main screen // Set the layout for the main screen
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Horizontal, nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Middle, nanogui::Alignment::Minimum,
10, 10); 10, 10);
// Add 100 lines to the content widget
//for (int i = 0; i < 100; ++i) {
// nanogui::Label* lineLabel = new nanogui::Label(contentWidget, "Line " + std::to_string(i));
// lineLabel->setFixedWidth(200);
//}
// Scroll panel will automatically take the size of its content
//scrollPanel->setFixedHeight(300);
screen.setVisible(true);
screen.setLayout(layout); screen.setLayout(layout);
// Draw NanoGUI // Draw NanoGUI
screen.performLayout(); screen.performLayout();
screen.setVisible(true); screen.setVisible(true);

View File

@@ -0,0 +1,243 @@
#include <nanogui/nanogui.h>
#include <thread>
#include <chrono>
#include <atomic>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <locale>
#include <codecvt>
#include <fstream>
#include "../client_backend/well_known.h"
// Function to simulate file scanning
void scan_file(nanogui::Screen* screen, const std::string& filePath) {
// Display the scanned file path in the window
screen->add<nanogui::Label>("Scanning file: " + filePath + "\n");
screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
screen->add<nanogui::Label>("Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
answered = true;
if (status == "found") {
screen->add<nanogui::Label>("Virus found in file: " + scannedFilePath + "\n");
screen->add<nanogui::Label>("File: " + scannedFilePath + " is infected\n");
screen->add<nanogui::Label>("Hash: " + hash + "\n");
screen->add<nanogui::Label>("Action taken: " + action + "\n");
}
else {
screen->add<nanogui::Label>("No virus found in file: " + scannedFilePath + "\n");
screen->add<nanogui::Label>("File: " + scannedFilePath + " is not infected\n");
}
screen->add<nanogui::Label>("------------------------------------------");
screen->performLayout();
}
}
else {
answered = true;
screen->add<nanogui::Label>("Error: Unable to talk to daemon!\n");
screen->add<nanogui::Label>("------------------------------------------");
screen->performLayout();
}
inputFile.close();
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
// Function to simulate folder scanning
void scan_folder(nanogui::Screen* screen, const std::string& folderPath) {
// Display the scanned folder path in the window
screen->add<nanogui::Label>("Scanning folder: " + folderPath + "\n");
screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << folderPath << "\"";
outputFile.close();
}
else {
screen->add<nanogui::Label>("Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
while (!inputFile.eof()) {
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
answered = true;
if (status == "found") {
screen->add<nanogui::Label>("Virus found in file: " + scannedFilePath + "\n");
screen->add<nanogui::Label>("File: " + scannedFilePath + " is infected\n");
screen->add<nanogui::Label>("Hash: " + hash + "\n");
screen->add<nanogui::Label>("Action taken: " + action + "\n");
}
else {
screen->add<nanogui::Label>("No virus found in file: " + scannedFilePath + "\n");
screen->add<nanogui::Label>("File: " + scannedFilePath + " is not infected\n");
}
screen->add<nanogui::Label>("------------------------------------------");
screen->performLayout();
}
}
else {
answered = true;
screen->add<nanogui::Label>("Error: Unable to talk to daemon!\n");
screen->add<nanogui::Label>("------------------------------------------");
screen->performLayout();
}
}
inputFile.close();
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
std::string getFolderPath() {
std::string selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = NULL; // Use the desktop window as the owner
browseInfo.pidlRoot = NULL; // Start from the desktop
browseInfo.pszDisplayName = selectedPath;
browseInfo.lpszTitle = TEXT("Select a folder");
browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
LPITEMIDLIST pidlSelected = SHBrowseForFolder(&browseInfo);
if (pidlSelected != NULL) {
SHGetPathFromIDList(pidlSelected, selectedPath);
// Convert TCHAR array to std::string
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
selectedFolderPath = converter.to_bytes(selectedPath);
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return selectedFolderPath;
}
int main() {
// Initialize NanoGUI
nanogui::init();
// Create a NanoGUI screen
nanogui::Screen screen(nanogui::Vector2i(800, 600), "Cyberhex endpoint protection");
// Create a layout for the buttons
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Middle,
5, 5);
buttonWidget->setLayout(buttonLayout);
// Create a button for scanning a file
nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File");
scanFileButton->setFixedWidth(150);
scanFileButton->setCallback([&] {
// Open file dialog to select a file
std::string selectedFile = nanogui::file_dialog(
{ {"*", "All Files"} },
false
);
if (!selectedFile.empty()) {
// Call scan_file function in a separate thread
std::thread(scan_file, &screen, selectedFile).detach();
}
});
// Create a button for scanning a folder
nanogui::Button* scanFolderButton = new nanogui::Button(buttonWidget, "Scan Folder");
scanFolderButton->setFixedWidth(150);
scanFolderButton->setCallback([&] {
// Open file dialog to select a folder
std::string selectedFolder = getFolderPath();
if (!selectedFolder.empty()) {
// Call scan_folder function in a separate thread
std::thread(scan_folder, &screen, selectedFolder).detach();
}
});
// Set the layout for the main screen
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Minimum,
10, 10);
screen.setLayout(layout);
// Draw NanoGUI
screen.performLayout();
screen.setVisible(true);
// Main event loop
nanogui::mainloop();
// Shutdown NanoGUI
nanogui::shutdown();
return 0;
}

View File

@@ -0,0 +1,272 @@
#include <nanogui/nanogui.h>
#include <thread>
#include <chrono>
#include <atomic>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <locale>
#include <codecvt>
#include <fstream>
#include "../client_backend/well_known.h"
// Function to add a message to the scrollable field
void addMessage(nanogui::Widget* scrollContent, const std::string& message) {
nanogui::Label* label = new nanogui::Label(scrollContent, message);
label->setFixedWidth(600);
//label->setWordWrap(true);
}
// Function to simulate file scanning
void scan_file(nanogui::Screen* screen, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window
auto scrollContent = new nanogui::Widget(screen);
screen->setLayout(new nanogui::BoxLayout(nanogui::Orientation::Vertical, nanogui::Alignment::Minimum, 0, 0));
addMessage(scrollContent, "Scanning file: " + filePath + "\n");
screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
addMessage(scrollContent, "Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
answered = true;
if (status == "found") {
addMessage(scrollContent, "Virus found in file: " + scannedFilePath + "\n");
addMessage(scrollContent, "File: " + scannedFilePath + " is infected\n");
addMessage(scrollContent, "Hash: " + hash + "\n");
addMessage(scrollContent, "Action taken: " + action + "\n");
}
else {
addMessage(scrollContent, "No virus found in file: " + scannedFilePath + "\n");
addMessage(scrollContent, "File: " + scannedFilePath + " is not infected\n");
}
addMessage(scrollContent, "------------------------------------------");
screen->performLayout();
}
}
else {
answered = true;
addMessage(scrollContent, "Error: Unable to talk to daemon!\n");
addMessage(scrollContent, "------------------------------------------");
screen->performLayout();
}
inputFile.close();
std::remove(ANSWER_COM_PATH);
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
// Function to simulate folder scanning
void scan_folder(nanogui::Screen* screen, const std::string& folderPath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window
auto scrollContent = new nanogui::Widget(screen);
screen->setLayout(new nanogui::BoxLayout(nanogui::Orientation::Vertical, nanogui::Alignment::Minimum, 0, 0));
addMessage(scrollContent, "Scanning folder: " + folderPath + "\n");
screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << folderPath << "\"";
outputFile.close();
}
else {
addMessage(scrollContent, "Error: Unable to talk to daemon!\n");
screen->performLayout();
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
while (!inputFile.eof()) {
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
//answered = true;
if (status == "found") {
addMessage(scrollContent, "Virus found in file: " + scannedFilePath + "\n");
addMessage(scrollContent, "File: " + scannedFilePath + " is infected\n");
addMessage(scrollContent, "Hash: " + hash + "\n");
addMessage(scrollContent, "Action taken: " + action + "\n");
}
else {
addMessage(scrollContent, "No virus found in file: " + scannedFilePath + "\n");
addMessage(scrollContent, "File: " + scannedFilePath + " is not infected\n");
}
addMessage(scrollContent, "------------------------------------------");
screen->performLayout();
}
if (status == "end")
answered = true;
}
else {
//answered = true;
addMessage(scrollContent, "Error: Unable to talk to daemon!\n");
addMessage(scrollContent, "------------------------------------------");
screen->performLayout();
}
}
inputFile.close();
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
std::string getFolderPath() {
std::string selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = NULL; // Use the desktop window as the owner
browseInfo.pidlRoot = NULL; // Start from the desktop
browseInfo.pszDisplayName = selectedPath;
browseInfo.lpszTitle = TEXT("Select a folder");
browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
LPITEMIDLIST pidlSelected = SHBrowseForFolder(&browseInfo);
if (pidlSelected != NULL) {
SHGetPathFromIDList(pidlSelected, selectedPath);
// Convert TCHAR array to std::string
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
selectedFolderPath = converter.to_bytes(selectedPath);
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return selectedFolderPath;
}
int main() {
// Initialize NanoGUI
nanogui::init();
// Create a NanoGUI screen
nanogui::Screen screen(nanogui::Vector2i(800, 600), "Cyberhex endpoint protection");
// Create a layout for the buttons
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Middle,
5, 5);
buttonWidget->setLayout(buttonLayout);
// Create a button for scanning a file
nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File");
scanFileButton->setFixedWidth(150);
scanFileButton->setCallback([&] {
// Open file dialog to select a file
std::string selectedFile = nanogui::file_dialog(
{ {"*", "All Files"} },
false
);
if (!selectedFile.empty()) {
// Call scan_file function in a separate thread
std::thread(scan_file, &screen, selectedFile).detach();
}
});
// Create a button for scanning a folder
nanogui::Button* scanFolderButton = new nanogui::Button(buttonWidget, "Scan Folder");
scanFolderButton->setFixedWidth(150);
scanFolderButton->setCallback([&] {
// Open file dialog to select a folder
std::string selectedFolder = getFolderPath();
if (!selectedFolder.empty()) {
// Call scan_folder function in a separate thread
std::thread(scan_folder, &screen, selectedFolder).detach();
}
});
// Create a scrollable panel
nanogui::VScrollPanel* scrollPanel = new nanogui::VScrollPanel(&screen);
scrollPanel->setFixedWidth(700);
scrollPanel->setFixedHeight(500);
nanogui::Widget* scrollContent = new nanogui::Widget(scrollPanel);
scrollContent->setLayout(new nanogui::BoxLayout(nanogui::Orientation::Vertical, nanogui::Alignment::Minimum, 0, 0));
scrollPanel->setFixedSize({ 700, 500 });
// Set the layout for the main screen
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Minimum,
10, 10);
screen.setLayout(layout);
// Draw NanoGUI
screen.performLayout();
screen.setVisible(true);
// Main event loop
nanogui::mainloop();
// Shutdown NanoGUI
nanogui::shutdown();
return 0;
}

View File

@@ -0,0 +1,270 @@
#include <nanogui/nanogui.h>
#include <thread>
#include <chrono>
#include <atomic>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <locale>
#include <codecvt>
#include <fstream>
#include "../client_backend/well_known.h"
// Function to simulate file scanning
void scan_file(nanogui::Screen*screen ,nanogui::Widget* contentWidget, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window
nanogui::Label* lineLabel1 = new nanogui::Label(contentWidget, "Scanning file: " + filePath + "\n");
screen->performLayout();
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
nanogui::Label* lineLabel2 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
answered = true;
if (status == "found") {
nanogui::Label* lineLabel3 = new nanogui::Label(contentWidget, "Virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel4 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is infected\n");
nanogui::Label* lineLabel5 = new nanogui::Label(contentWidget, "Hash: " + hash + "\n");
nanogui::Label* lineLabel6 = new nanogui::Label(contentWidget, "Action taken: " + action + "\n");
}
else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel8 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is not infected\n");
}
nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
}
else {
answered = true;
nanogui::Label* lineLabel10 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
nanogui::Label* lineLabel11 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout();
}
inputFile.close();
std::remove(ANSWER_COM_PATH);
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
// Function to simulate folder scanning
void scan_folder(nanogui::Widget* contentWidget, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window
nanogui::Label* lineLabel1 = new nanogui::Label(contentWidget, "Scanning folder: " + filePath + "\n");
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << filePath << "\"";
outputFile.close();
}
else {
nanogui::Label* lineLabel2 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
return;
}
while (!answered) {
// Wait for answer in file
std::ifstream inputFile(ANSWER_COM_PATH);
// The structure of the answer file is as follows:
// found/not_found
// filepath
// hash
// action_taken/no_action_taken
if (inputFile.is_open()) {
std::string status, scannedFilePath, hash, action;
while (!inputFile.eof()) {
if (inputFile >> status) {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
if (status == "found" || status == "not_found") {
std::getline(inputFile, scannedFilePath, '\"'); // Read until closing double quote
inputFile.ignore(1); // Ignore space between filepath and hash
inputFile.ignore(1); // Ignore starting double quote
std::getline(inputFile, hash, ' '); // Read until space
std::getline(inputFile, action); // Read until end of line
//answered = true;
if (status == "found") {
nanogui::Label* lineLabel3 = new nanogui::Label(contentWidget, "Virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel4 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is infected\n");
nanogui::Label* lineLabel5 = new nanogui::Label(contentWidget, "Hash: " + hash + "\n");
nanogui::Label* lineLabel6 = new nanogui::Label(contentWidget, "Action taken: " + action + "\n");
}
else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n");
nanogui::Label* lineLabel8 = new nanogui::Label(contentWidget, "File: " + scannedFilePath + " is not infected\n");
}
nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
}
if (status == "end")
answered = true;
}
else {
//answered = true;
nanogui::Label* lineLabel10 = new nanogui::Label(contentWidget, "Error: Unable to talk to daemon!\n");
nanogui::Label* lineLabel11 = new nanogui::Label(contentWidget, "------------------------------------------");
}
}
inputFile.close();
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
std::string getFolderPath() {
std::string selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = NULL; // Use the desktop window as the owner
browseInfo.pidlRoot = NULL; // Start from the desktop
browseInfo.pszDisplayName = selectedPath;
browseInfo.lpszTitle = TEXT("Select a folder");
browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
LPITEMIDLIST pidlSelected = SHBrowseForFolder(&browseInfo);
if (pidlSelected != NULL) {
SHGetPathFromIDList(pidlSelected, selectedPath);
// Convert TCHAR array to std::string
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
selectedFolderPath = converter.to_bytes(selectedPath);
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return selectedFolderPath;
}
int main() {
// Initialize NanoGUI
nanogui::init();
// Create a NanoGUI screen
nanogui::Screen screen(nanogui::Vector2i(800, 600), "Cyberhex endpoint protection");
// Create a layout for the buttons
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Middle,
5, 5);
buttonWidget->setLayout(buttonLayout);
// Create a widget inside the scroll panel to hold the content
nanogui::VScrollPanel* scrollPanel = new nanogui::VScrollPanel(&screen);
scrollPanel->setLayout(new nanogui::GroupLayout(10));
nanogui::Widget* contentWidget = new nanogui::Widget(scrollPanel);
contentWidget->setLayout(new nanogui::GroupLayout(10));
scrollPanel->setFixedSize(nanogui::Vector2i(750, 450));
// Create a button for scanning a file
nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File");
scanFileButton->setFixedWidth(150);
scanFileButton->setCallback([&] {
// Open file dialog to select a file
std::string selectedFile = nanogui::file_dialog(
{ {"*", "All Files"} },
false
);
if (!selectedFile.empty()) {
// Call scan_file function in a separate thread
std::thread(scan_file,&screen, contentWidget, selectedFile).detach();
}
});
// Create a button for scanning a folder
nanogui::Button* scanFolderButton = new nanogui::Button(buttonWidget, "Scan Folder");
scanFolderButton->setFixedWidth(150);
scanFolderButton->setCallback([&] {
// Open file dialog to select a folder
std::string selectedFolder = getFolderPath();
if (!selectedFolder.empty()) {
// Call scan_folder function in a separate thread
std::thread(scan_folder, contentWidget, selectedFolder).detach();
}
});
// Set the layout for the main screen
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Minimum,
10, 10);
// Add 100 lines to the content widget
//for (int i = 0; i < 100; ++i) {
// nanogui::Label* lineLabel = new nanogui::Label(contentWidget, "Line " + std::to_string(i));
// lineLabel->setFixedWidth(200);
//}
// Scroll panel will automatically take the size of its content
//scrollPanel->setFixedHeight(300);
screen.setVisible(true);
screen.setLayout(layout);
// Draw NanoGUI
screen.performLayout();
screen.setVisible(true);
// Main event loop
nanogui::mainloop();
// Shutdown NanoGUI
nanogui::shutdown();
return 0;
}