front and backend can now communicate
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -2,6 +2,34 @@
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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}",
|
||||
"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}",
|
||||
"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}",
|
||||
"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}",
|
||||
"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}",
|
||||
"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}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:scan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
@@ -98,11 +102,24 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"SelectedChildIndex": 17,
|
||||
"Children": [
|
||||
{
|
||||
"$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",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h",
|
||||
"RelativeDocumentMoniker": "utils.h",
|
||||
@@ -115,7 +132,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"DocumentIndex": 8,
|
||||
"Title": "utils.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
|
||||
"RelativeDocumentMoniker": "utils.cpp",
|
||||
@@ -128,19 +145,20 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 13,
|
||||
"DocumentIndex": 15,
|
||||
"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": "AQIAABsAAAAAAAAAAAAAADcAAABCAAAA",
|
||||
"ViewState": "AQIAABkAAAAAAAAAAABBwDcAAABCAAAA",
|
||||
"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": 9,
|
||||
"DocumentIndex": 11,
|
||||
"Title": "well_known.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
|
||||
"RelativeDocumentMoniker": "well_known.h",
|
||||
@@ -148,36 +166,38 @@
|
||||
"RelativeToolTip": "well_known.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAC0AAAAZAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-14T13:20:06.953Z"
|
||||
"WhenOpened": "2024-03-14T13:20:06.953Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 14,
|
||||
"DocumentIndex": 16,
|
||||
"Title": "check_dir.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
|
||||
"RelativeDocumentMoniker": "check_dir.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
|
||||
"RelativeToolTip": "check_dir.cpp",
|
||||
"ViewState": "AQIAAEsAAAAAAAAAAAAAAHkAAAAwAAAA",
|
||||
"ViewState": "AQIAAEkAAAAAAAAAAABBwHkAAAAwAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-03-13T06:48:31.009Z"
|
||||
"WhenOpened": "2024-03-13T06:48:31.009Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"DocumentIndex": 1,
|
||||
"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": "AQIAAAAAAAAAAAAAAAAAAAkAAAASAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABQAAAAqAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-03-13T06:52:01.533Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 20,
|
||||
"DocumentIndex": 21,
|
||||
"Title": "local_com.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
|
||||
"RelativeDocumentMoniker": "local_com.h",
|
||||
@@ -185,11 +205,12 @@
|
||||
"RelativeToolTip": "local_com.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:49:41.823Z"
|
||||
"WhenOpened": "2024-03-13T06:49:41.823Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 10,
|
||||
"DocumentIndex": 12,
|
||||
"Title": "log.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
|
||||
"RelativeDocumentMoniker": "log.h",
|
||||
@@ -197,11 +218,12 @@
|
||||
"RelativeToolTip": "log.h",
|
||||
"ViewState": "AQIAAEwAAAAAAAAAAAD4v2wAAABKAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:47:02.038Z"
|
||||
"WhenOpened": "2024-03-13T06:47:02.038Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 21,
|
||||
"DocumentIndex": 22,
|
||||
"Title": "virus_ctrl.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h",
|
||||
"RelativeDocumentMoniker": "virus_ctrl.h",
|
||||
@@ -209,11 +231,12 @@
|
||||
"RelativeToolTip": "virus_ctrl.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:45:51.845Z"
|
||||
"WhenOpened": "2024-03-13T06:45:51.845Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 11,
|
||||
"DocumentIndex": 13,
|
||||
"Title": "connect.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
|
||||
"RelativeDocumentMoniker": "connect.h",
|
||||
@@ -221,11 +244,12 @@
|
||||
"RelativeToolTip": "connect.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAA8AAABrAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:44:13.879Z"
|
||||
"WhenOpened": "2024-03-13T06:44:13.879Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 19,
|
||||
"DocumentIndex": 20,
|
||||
"Title": "queue_ctrl.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h",
|
||||
"RelativeDocumentMoniker": "queue_ctrl.h",
|
||||
@@ -233,11 +257,12 @@
|
||||
"RelativeToolTip": "queue_ctrl.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:43:48.22Z"
|
||||
"WhenOpened": "2024-03-13T06:43:48.22Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 16,
|
||||
"DocumentIndex": 18,
|
||||
"Title": "queue _ctrl.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp",
|
||||
"RelativeDocumentMoniker": "queue _ctrl.cpp",
|
||||
@@ -245,11 +270,12 @@
|
||||
"RelativeToolTip": "queue _ctrl.cpp",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-01-28T20:40:06.295Z"
|
||||
"WhenOpened": "2024-01-28T20:40:06.295Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 12,
|
||||
"DocumentIndex": 14,
|
||||
"Title": "update.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
|
||||
"RelativeDocumentMoniker": "update.h",
|
||||
@@ -257,11 +283,12 @@
|
||||
"RelativeToolTip": "update.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:42:28.196Z"
|
||||
"WhenOpened": "2024-03-13T06:42:28.196Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 15,
|
||||
"DocumentIndex": 17,
|
||||
"Title": "settings.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp",
|
||||
"RelativeDocumentMoniker": "settings.cpp",
|
||||
@@ -269,11 +296,12 @@
|
||||
"RelativeToolTip": "settings.cpp",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-03-13T06:48:40.364Z"
|
||||
"WhenOpened": "2024-03-13T06:48:40.364Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 17,
|
||||
"DocumentIndex": 19,
|
||||
"Title": "settings.h",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
|
||||
"RelativeDocumentMoniker": "settings.h",
|
||||
@@ -281,94 +309,96 @@
|
||||
"RelativeToolTip": "settings.h",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"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",
|
||||
"WhenOpened": "2024-03-13T06:42:03.328Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "client_backend.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
|
||||
"RelativeDocumentMoniker": "client_backend.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
|
||||
"RelativeToolTip": "client_backend.cpp",
|
||||
"ViewState": "AQIAAAwAAAAAAAAAAAAAADAAAAACAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-01-28T20:40:06.279Z",
|
||||
"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": "AQIAAA0AAAAAAAAAAAAAABMAAAAPAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||
"WhenOpened": "2024-03-13T06:41:43.701Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"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": "AQIAAAYAAAAAAAAAAAAAAAkAAAARAAAA",
|
||||
"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": "AQIAAMIAAAAAAAAAAAAkwOkAAAAFAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-01-28T20:40:06.248Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"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": "AQIAAGYAAAAAAAAAAAAAAIYAAAAiAAAA",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "client_backend.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
|
||||
"RelativeDocumentMoniker": "client_backend.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
|
||||
"RelativeToolTip": "client_backend.cpp",
|
||||
"ViewState": "AQIAAC0AAAAAAAAAAAAAAFYAAAAfAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-01-28T20:40:06.279Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$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",
|
||||
"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": "AQIAAJwAAAAAAAAAAAAAAHkAAAAtAAAA",
|
||||
"ViewState": "AQIAAJoAAAAAAAAAAABBwHkAAAAtAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-01-28T20:40:06.315Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 8,
|
||||
"DocumentIndex": 2,
|
||||
"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": "AQIAAAAAAAAAAAAAAAAAACUAAABHAAAA",
|
||||
"ViewState": "AQIAAEEAAAAAAAAAAAAwwHYAAABIAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-02-18T12:49:41.861Z",
|
||||
"EditorCaption": ""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,30 +5,41 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
int check_for_com_tasks(const std::string& com_name, const std::string& com_path) {
|
||||
std::ifstream file(com_path);
|
||||
|
||||
if (!file.is_open()) {
|
||||
// No com file found = no communication needed
|
||||
return 1;
|
||||
return 1; // Error opening file
|
||||
}
|
||||
|
||||
std::string command;
|
||||
while (file >> command) {
|
||||
// Scan the command
|
||||
std::string path;
|
||||
file >> path; // Scan the path
|
||||
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
std::stringstream ss(line);
|
||||
if (ss >> command) {
|
||||
// Check if the next token is a quoted path
|
||||
if (line.find("\"") != std::string::npos) {
|
||||
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();
|
||||
std::remove(com_path.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // !LOCAL_COM_CPP
|
||||
|
||||
@@ -158,8 +158,6 @@ int search_hash(const std::string& dbname_, const std::string& hash_, const std:
|
||||
return 0; // Not found
|
||||
}
|
||||
|
||||
// Rest of the code remains unchanged...
|
||||
|
||||
|
||||
bool file_exists(const std::string& filePath) {
|
||||
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);
|
||||
}
|
||||
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();
|
||||
}
|
||||
void action_scanfolder(const std::string& folderpath) {
|
||||
@@ -243,6 +249,11 @@ void action_scanfolder(const std::string& folderpath) {
|
||||
cnt = 0;
|
||||
thread_local std::string folderpath_(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();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
// Define a mutex for thread synchronization
|
||||
std::mutex virusCtrlMutex;
|
||||
@@ -112,6 +113,13 @@ int virus_ctrl_process(const std::string& id) {
|
||||
else {
|
||||
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();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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}"
|
||||
},
|
||||
{
|
||||
"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": [
|
||||
@@ -22,15 +22,14 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "glutil.h",
|
||||
"DocumentMoniker": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
|
||||
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
|
||||
"ToolTip": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
|
||||
"RelativeToolTip": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
|
||||
"ViewState": "AQIAANwAAAAAAAAAAAD4v/gAAAAKAAAA",
|
||||
"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-14T20:21:24.734Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2024-03-17T16:32:22.34Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
@@ -40,7 +39,7 @@
|
||||
"RelativeDocumentMoniker": "main.cpp",
|
||||
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
|
||||
"RelativeToolTip": "main.cpp",
|
||||
"ViewState": "AQIAAA0AAAAAAAAAAAD4vxUAAAA5AAAA",
|
||||
"ViewState": "AQIAAAYAAAAAAAAAAAAAAP0AAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2024-03-14T19:45:55.142Z",
|
||||
"EditorCaption": ""
|
||||
|
||||
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,24 +7,151 @@
|
||||
#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) {
|
||||
// Simulate file scanning by waiting for 10 seconds
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
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
|
||||
screen->add<nanogui::Label>("Scanned file: " + filePath);
|
||||
// Refresh layout to ensure the new label is visible
|
||||
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");
|
||||
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
|
||||
void scan_folder(nanogui::Screen* screen, const std::string& folderPath) {
|
||||
// Simulate folder scanning by waiting for 10 seconds
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
void scan_folder(nanogui::Screen*screen,nanogui::Widget* contentWidget, const std::string& filePath) {
|
||||
// Remove the answer file
|
||||
std::remove(ANSWER_COM_PATH);
|
||||
// Display the scanned folder path in the window
|
||||
screen->add<nanogui::Label>("Scanned folder: " + folderPath);
|
||||
// Refresh layout to ensure the new label is visible
|
||||
nanogui::Label* lineLabel1 = new nanogui::Label(contentWidget, "Scanning folder: " + filePath + "\n");
|
||||
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 selectedFolderPath;
|
||||
@@ -67,8 +194,7 @@ int main() {
|
||||
nanogui::init();
|
||||
|
||||
// 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
|
||||
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
|
||||
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
|
||||
@@ -76,6 +202,16 @@ int main() {
|
||||
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);
|
||||
@@ -87,7 +223,7 @@ int main() {
|
||||
);
|
||||
if (!selectedFile.empty()) {
|
||||
// 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();
|
||||
if (!selectedFolder.empty()) {
|
||||
// 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
|
||||
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Horizontal,
|
||||
nanogui::Alignment::Middle,
|
||||
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);
|
||||
|
||||
243
src/client_frontend_guilite/main.cpp~RFcb12ba8.TMP
Normal file
243
src/client_frontend_guilite/main.cpp~RFcb12ba8.TMP
Normal 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;
|
||||
}
|
||||
272
src/client_frontend_guilite/main.cpp~RFcc476de.TMP
Normal file
272
src/client_frontend_guilite/main.cpp~RFcc476de.TMP
Normal 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;
|
||||
}
|
||||
270
src/client_frontend_guilite/main.cpp~RFce7b738.TMP
Normal file
270
src/client_frontend_guilite/main.cpp~RFce7b738.TMP
Normal 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;
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user