updating frontend

This commit is contained in:
jakani24
2024-03-23 18:06:12 +01:00
parent 7cacfb9361
commit ba1716f4eb
84 changed files with 4036 additions and 857 deletions

View File

@@ -6,10 +6,18 @@
"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}", "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}" "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\\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\\check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}, },
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{ {
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -19,13 +27,17 @@
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative: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}", "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}, },
{ {
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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}" "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\\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\\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}"
@@ -42,22 +54,10 @@
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}, },
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{ {
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "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}" "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\\utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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}"
@@ -102,58 +102,164 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 7, "SelectedChildIndex": 2,
"Children": [ "Children": [
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 7, "DocumentIndex": 19,
"Title": "connect.h", "Title": "settings.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\\settings.h",
"RelativeDocumentMoniker": "connect.h", "RelativeDocumentMoniker": "settings.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeToolTip": "connect.h", "RelativeToolTip": "settings.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABMAAAAdAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
"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:42:03.328Z"
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 20, "DocumentIndex": 13,
"Title": "queue_ctrl.h", "Title": "scan.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\\scan.h",
"RelativeDocumentMoniker": "queue_ctrl.h", "RelativeDocumentMoniker": "scan.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeToolTip": "queue_ctrl.h", "RelativeToolTip": "scan.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA", "ViewState": "AQIAAAkAAAAAAAAAAABRwBMAAAAPAAAA",
"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:41:43.701Z"
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 18, "DocumentIndex": 0,
"Title": "queue _ctrl.cpp", "Title": "scan.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\\scan.cpp",
"RelativeDocumentMoniker": "queue _ctrl.cpp", "RelativeDocumentMoniker": "scan.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.cpp",
"RelativeToolTip": "queue _ctrl.cpp", "RelativeToolTip": "scan.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA", "ViewState": "AQIAAMwAAAAAAAAAAAAkwNgAAAA0AAAA",
"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.248Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 16, "DocumentIndex": 9,
"Title": "update.h", "Title": "connect.cpp",
"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\\connect.cpp",
"RelativeDocumentMoniker": "update.h", "RelativeDocumentMoniker": "connect.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp",
"RelativeToolTip": "update.h", "RelativeToolTip": "connect.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA", "ViewState": "AQIAAKcAAAAAAAAAAAAIwNsAAAAeAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.315Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "client_backend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
"RelativeDocumentMoniker": "client_backend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp",
"RelativeToolTip": "client_backend.cpp",
"ViewState": "AQIAAEIAAAAAAAAAAAAAAGkAAAAJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"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": "AQIAAAYAAAAAAAAAAAAAADUAAABGAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:52:01.533Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"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": "AQIAAAAAAAAAAAAAAAAAAAsAAAAXAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-17T16:34:14.678Z"
},
{
"$type": "Document",
"DocumentIndex": 8,
"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": "AQIAAEsAAAAAAAAAAAAIwHYAAAARAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-02-18T12:49:41.861Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h",
"RelativeToolTip": "virus_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:28.196Z", "WhenOpened": "2024-03-13T06:45:51.845Z"
},
{
"$type": "Document",
"DocumentIndex": 12,
"Title": "log.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeDocumentMoniker": "log.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeToolTip": "log.h",
"ViewState": "AQIAAEwAAAAAAAAAAABBwG4AAAA2AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:47:02.038Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
"RelativeToolTip": "local_com.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:49:41.823Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"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": "AQIAAAAAAAAAAAAAAAAAABUAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:31.009Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "utils.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeDocumentMoniker": "utils.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeToolTip": "utils.cpp",
"ViewState": "AQIAAD8AAAAAAAAAAAAAABgAAAAFAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T15:55:22.469Z",
"EditorCaption": "" "EditorCaption": ""
}, },
{ {
@@ -166,164 +272,7 @@
"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",
"DocumentIndex": 19,
"Title": "settings.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeDocumentMoniker": "settings.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeToolTip": "settings.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:03.328Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 11,
"Title": "scan.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeDocumentMoniker": "scan.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h",
"RelativeToolTip": "scan.h",
"ViewState": "AQIAAAkAAAAAAAAAAABRwBMAAAAPAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:41:43.701Z",
"EditorCaption": ""
},
{
"$type": "Document",
"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": "AQIAAKYAAAAAAAAAAAAkwMsAAAAOAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"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": "AQIAAKcAAAAAAAAAAAAIwNsAAAAeAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.315Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"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": "AQIAADMAAAAAAAAAAAAkwE8AAAA6AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"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": "AQIAAAAAAAAAAAAAAAAAABwAAAAsAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:52:01.533Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"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": "AQIAAAAAAAAAAAAAAAAAAAsAAAAXAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-17T16:34:14.678Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"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": "AQIAAEsAAAAAAAAAAAAIwHYAAAARAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-02-18T12:49:41.861Z",
"EditorCaption": ""
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h",
"RelativeToolTip": "virus_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:45:51.845Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 9,
"Title": "log.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeDocumentMoniker": "log.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeToolTip": "log.h",
"ViewState": "AQIAAEwAAAAAAAAAAABBwG4AAAA2AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:47:02.038Z",
"EditorCaption": ""
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
"RelativeToolTip": "local_com.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:49:41.823Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 10,
"Title": "check_dir.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
"RelativeDocumentMoniker": "check_dir.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_dir.cpp",
"RelativeToolTip": "check_dir.cpp",
"ViewState": "AQIAAAQAAAAAAAAAAABBwC0AAAA7AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:31.009Z",
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
@@ -335,47 +284,80 @@
"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": 1, "DocumentIndex": 16,
"Title": "update.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeDocumentMoniker": "update.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeToolTip": "update.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:28.196Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp",
"RelativeToolTip": "queue _ctrl.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.295Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h",
"RelativeToolTip": "queue_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:43:48.22Z"
},
{
"$type": "Document",
"DocumentIndex": 10,
"Title": "connect.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
"RelativeDocumentMoniker": "connect.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
"RelativeToolTip": "connect.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABMAAAAdAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:44:13.879Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"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": "AQIAABUAAAAAAAAAAAAAADcAAABCAAAA", "ViewState": "AQIAABIAAAAAAAAAAAAAADgAAABGAAAA",
"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": "" "EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 13, "DocumentIndex": 3,
"Title": "utils.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeDocumentMoniker": "utils.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeToolTip": "utils.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T15:55:22.469Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 12,
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h",
"RelativeToolTip": "utils.h", "RelativeToolTip": "utils.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAMAAAAUAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAAuAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T15:55:30.524Z", "WhenOpened": "2024-03-14T15:55:30.524Z"
"EditorCaption": ""
}, },
{ {
"$type": "Document", "$type": "Document",
@@ -387,12 +369,11 @@
"RelativeToolTip": "update.cpp", "RelativeToolTip": "update.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAIBZwAkAAAARAAAA", "ViewState": "AQIAAAAAAAAAAAAAAIBZwAkAAAARAAAA",
"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": ""
}, },
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 8, "DocumentIndex": 11,
"Title": "local_schedule.cpp", "Title": "local_schedule.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\\local_schedule.cpp",
"RelativeDocumentMoniker": "local_schedule.cpp", "RelativeDocumentMoniker": "local_schedule.cpp",
@@ -400,8 +381,7 @@
"RelativeToolTip": "local_schedule.cpp", "RelativeToolTip": "local_schedule.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAEIAAAAAAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAEIAAAAAAAAA",
"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": ""
} }
] ]
} }

View File

@@ -0,0 +1,396 @@
{
"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\\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\\check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_dir.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:check_process.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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\\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\\utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:utils.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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\\connect.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:connect.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:log.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:settings.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue _ctrl.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:queue_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:local_com.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:virus_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 7,
"Children": [
{
"$type": "Document",
"DocumentIndex": 10,
"Title": "connect.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
"RelativeDocumentMoniker": "connect.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h",
"RelativeToolTip": "connect.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABMAAAAdAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:44:13.879Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h",
"RelativeToolTip": "queue_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAYAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:43:48.22Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp",
"RelativeToolTip": "queue _ctrl.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.295Z"
},
{
"$type": "Document",
"DocumentIndex": 16,
"Title": "update.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeDocumentMoniker": "update.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h",
"RelativeToolTip": "update.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:28.196Z"
},
{
"$type": "Document",
"DocumentIndex": 17,
"Title": "settings.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp",
"RelativeDocumentMoniker": "settings.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.cpp",
"RelativeToolTip": "settings.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAA1AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:40.364Z"
},
{
"$type": "Document",
"DocumentIndex": 19,
"Title": "settings.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeDocumentMoniker": "settings.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h",
"RelativeToolTip": "settings.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:42:03.328Z"
},
{
"$type": "Document",
"DocumentIndex": 13,
"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": "AQIAAAkAAAAAAAAAAABRwBMAAAAPAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:41:43.701Z"
},
{
"$type": "Document",
"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": "AQIAALkAAAAAAAAAAAAkwNsAAAApAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 9,
"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": "AQIAAKcAAAAAAAAAAAAIwNsAAAAeAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.315Z"
},
{
"$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": "AQIAAEUAAAAAAAAAAAAkwGcAAAAcAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"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": "AQIAAAAAAAAAAAAAAAAAABUAAAAqAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:52:01.533Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"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": "AQIAAAAAAAAAAAAAAAAAAAsAAAAXAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-17T16:34:14.678Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 8,
"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": "AQIAAEsAAAAAAAAAAAAIwHYAAAARAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-02-18T12:49:41.861Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\virus_ctrl.h",
"RelativeToolTip": "virus_ctrl.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAuAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:45:51.845Z"
},
{
"$type": "Document",
"DocumentIndex": 12,
"Title": "log.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeDocumentMoniker": "log.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\log.h",
"RelativeToolTip": "log.h",
"ViewState": "AQIAAEwAAAAAAAAAAABBwG4AAAA2AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:47:02.038Z"
},
{
"$type": "Document",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h",
"RelativeToolTip": "local_com.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAABSAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-13T06:49:41.823Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"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": "AQIAAAAAAAAAAAAAAAAAABUAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-13T06:48:31.009Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 15,
"Title": "well_known.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeDocumentMoniker": "well_known.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h",
"RelativeToolTip": "well_known.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAC0AAAAZAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T13:20:06.953Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"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": "AQIAAAMAAAAAAAAAAAAAAAoAAAASAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T13:35:33.369Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "utils.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeDocumentMoniker": "utils.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.cpp",
"RelativeToolTip": "utils.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABUAAAAsAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T15:55:22.469Z",
"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",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h",
"RelativeToolTip": "utils.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T15:55:30.524Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 14,
"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": "AQIAAAAAAAAAAAAAAIBZwAkAAAARAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.248Z"
},
{
"$type": "Document",
"DocumentIndex": 11,
"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": "AQIAAAAAAAAAAAAAAAAAAEIAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-01-28T20:40:06.279Z"
}
]
}
]
}
]
}

View File

@@ -12,6 +12,7 @@
#include <algorithm> // Include the algorithm header #include <algorithm> // Include the algorithm header
#include <string> // Include the string header #include <string> // Include the string header
#include <iostream> // Include the iostream header #include <iostream> // Include the iostream header
#include "utils.h"
// Define a mutex for thread synchronization // Define a mutex for thread synchronization
std::mutex monitorMutex; std::mutex monitorMutex;
@@ -36,6 +37,7 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
filename_str = "c:\\" + filename_str; filename_str = "c:\\" + filename_str;
// Scan the file and send it to virus_ctrl if it is a virus and then process it // Scan the file and send it to virus_ctrl if it is a virus and then process it
if (is_valid_path(filename_str)) { //filter out invalid paths and paths with weird characters
std::transform(filename_str.begin(), filename_str.end(), filename_str.begin(), ::tolower); std::transform(filename_str.begin(), filename_str.end(), filename_str.begin(), ::tolower);
if (!is_folder_included(filename_str.c_str()) || is_directory(filename_str) || is_folder_excluded(filename_str.c_str())) { if (!is_folder_included(filename_str.c_str()) || is_directory(filename_str) || is_folder_excluded(filename_str.c_str())) {
// Don't scan excluded files or folders // Don't scan excluded files or folders
@@ -47,6 +49,7 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
scan_thread.detach(); scan_thread.detach();
} }
} }
}
void monitor_directory(LPCSTR directory) { void monitor_directory(LPCSTR directory) {
// Open the directory for monitoring // Open the directory for monitoring

View File

@@ -0,0 +1,157 @@
#ifndef CHECK_DIR_CPP
#define CHECK_DIR_CPP
#include "check_dir.h"
#include "well_known.h"
#include "log.h"
#include "md5hash.h"
#include "scan.h"
#include "app_ctrl.h"
#include "virus_ctrl.h"
#include "settings.h"
#include <mutex> // Include the mutex header
#include <algorithm> // Include the algorithm header
#include <string> // Include the string header
#include <iostream> // Include the iostream header
// Define a mutex for thread synchronization
std::mutex monitorMutex;
bool is_directory(const std::string& path) {
DWORD attributes = GetFileAttributes(path.c_str());
if (attributes == INVALID_FILE_ATTRIBUTES) {
// Handle the error, e.g., by printing an error message
return false;
}
return (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
// Allocate a buffer for the file name and copy the content
std::wstring fileName(pInfo->FileName, pInfo->FileNameLength / sizeof(wchar_t));
// Convert wstring to string
std::string filename_str(fileName.begin(), fileName.end());
filename_str = "c:\\" + filename_str;
// Scan the file and send it to virus_ctrl if it is a virus and then process it
if (is_valid_path(filename_str)) { //filter out invalid paths and paths with weird characters
std::transform(filename_str.begin(), filename_str.end(), filename_str.begin(), ::tolower);
if (!is_folder_included(filename_str.c_str()) || is_directory(filename_str) || is_folder_excluded(filename_str.c_str())) {
// Don't scan excluded files or folders
return;
}
else {
//log(LOGLEVEL::INFO_NOSEND, "[process_changes()]: File ", filename_str, " has been changed. Scanning it for viruses");
std::thread scan_thread(scan_file_t, filename_str);
scan_thread.detach();
}
}
}
void monitor_directory(LPCSTR directory) {
// Open the directory for monitoring
HANDLE hDir = CreateFile(
directory,
FILE_LIST_DIRECTORY,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
NULL
);
if (hDir == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::ERR, "[monitor_directory()]: Error opening directory: ", directory, " while monitoring directory for changes");
return;
}
// Create a buffer for file change notifications
constexpr DWORD bufferSize = 4096;
BYTE buffer[bufferSize];
// Monitor the directory for changes
OVERLAPPED overlapped;
memset(&overlapped, 0, sizeof(overlapped));
memset(buffer, 0, bufferSize);
overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (ReadDirectoryChangesW(
hDir,
buffer,
bufferSize,
TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,
NULL,
&overlapped,
NULL) == 0) {
log(LOGLEVEL::ERR, "[monitor_directory()]: Error reading directory changes: ", GetLastError(), " while monitoring directory for changes");
CloseHandle(hDir);
return;
}
log(LOGLEVEL::INFO, "[monitor_directory()]: Monitoring directory: ", directory, " for changes");
// Wait for changes
while (!app_stop()) {
DWORD bytesReturned;
DWORD waitStatus = WaitForSingleObject(overlapped.hEvent, INFINITE);
if (waitStatus == WAIT_OBJECT_0) {
if (GetOverlappedResult(hDir, &overlapped, &bytesReturned, FALSE)) {
// Process the changes in the buffer
FILE_NOTIFY_INFORMATION* pInfo = reinterpret_cast<FILE_NOTIFY_INFORMATION*>(buffer);
do {
process_changes(pInfo);
pInfo = reinterpret_cast<FILE_NOTIFY_INFORMATION*>(
reinterpret_cast<BYTE*>(pInfo) + pInfo->NextEntryOffset);
} while (pInfo->NextEntryOffset != 0);
// Reset the event for the next wait
ResetEvent(overlapped.hEvent);
memset(buffer, 0, bufferSize);
// Continue monitoring
if (ReadDirectoryChangesW(
hDir,
buffer,
bufferSize,
TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_CREATION,
NULL,
&overlapped,
NULL) == 0) {
log(LOGLEVEL::ERR, "[monitor_directory()]: Error reading directory changes: ", GetLastError(), " while monitoring directory for changes");
break;
}
}
else {
log(LOGLEVEL::ERR, "[monitor_directory()]: GetOverlappedResult failed: ", GetLastError());
break;
}
}
else {
log(LOGLEVEL::ERR, "[monitor_directory()]: WaitForSingleObject failed: ", GetLastError());
break;
}
}
// Cleanup
CloseHandle(overlapped.hEvent);
CloseHandle(hDir);
}
void folder_scanner() {
// Lock access to the monitor function
std::lock_guard<std::mutex> lock(monitorMutex);
// We are in a completely separate thread than the main thread; unlimited resources wuhuii
// Start the watch dir function used to monitor the dir for new files
monitor_directory("C:\\");
}
#endif // !CHECK_DIR_CPP

View File

@@ -8,6 +8,7 @@
#include <mutex> // Include the mutex header #include <mutex> // Include the mutex header
#include <thread> // Include the thread header #include <thread> // Include the thread header
#include <Windows.h> // Include the Windows header #include <Windows.h> // Include the Windows header
#include "utils.h"
std::mutex mtx; // Declare a mutex for thread synchronization std::mutex mtx; // Declare a mutex for thread synchronization
@@ -48,7 +49,7 @@ void monitor_processes() {
strcpy_s(path, MAX_PATH, exePath); strcpy_s(path, MAX_PATH, exePath);
for (size_t z = 0; z < strlen(path); z++) for (size_t z = 0; z < strlen(path); z++)
path[z] = tolower(path[z]); path[z] = tolower(path[z]);
if (is_valid_path(path)) { //filter out invalid paths and paths with weird characters
if (!is_folder_included(path) || is_folder_excluded(path)) { if (!is_folder_included(path) || is_folder_excluded(path)) {
// Don't scan excluded files or folders // Don't scan excluded files or folders
} }
@@ -57,6 +58,7 @@ void monitor_processes() {
scan_thread.detach(); scan_thread.detach();
} }
} }
}
CloseHandle(hProcess); CloseHandle(hProcess);
} }
} }

View File

@@ -1,3 +1,2 @@
 Quellen werden auf Modulabhängigkeiten überprüft...  Quellen werden auf Modulabhängigkeiten überprüft...
scan.cpp
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe

View File

@@ -0,0 +1,299 @@
#ifndef SCAN_CPP
#define SCAN_CPP
#include "scan.h"
#include <windows.h>
#include <iostream>
#include <openssl/md5.h>
#include <windows.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <time.h>
#include "md5hash.h"
#include <string>
#include "well_known.h"
#include "log.h"
#include "virus_ctrl.h"
#include "app_ctrl.h"
#include <mutex> // Include the mutex header
// Define mutexes for thread synchronization
std::mutex fileHandlesMutex;
std::mutex mappingHandlesMutex;
std::mutex fileDataMutex;
std::mutex cntMutex;
std::mutex numThreadsMutex;
std::unordered_map<std::string, HANDLE> fileHandles;
std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData;
int cnt = 0;
int num_threads = 0;
//load all the db files into memory
int initialize(const std::string& folderPath) {
for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) {
for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) {
// Ensure that the characters are valid hexadecimal digits
if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) {
continue;
}
// Create the filename based on the naming convention
std::string filename = folderPath + "\\" + firstChar + secondChar + ".jdbf";
//printf("Loading %s\n", filename.c_str());
// Open the file
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
//log(LOGLEVEL::ERR, "[initialize()]: Error opening database file: ", filename);
return 1;
}
// Create the file mapping
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping == NULL) {
// log(LOGLEVEL::ERR, "[initialize()]: Error creating database file mapping: ", filename);
CloseHandle(hFile);
return 2;
}
// Map the file into memory
char* fileDataPtr = static_cast<char*>(MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0));
if (fileDataPtr == NULL) {
//log(LOGLEVEL::ERR, "[initialize()]: Error mapping database file: ", filename);
CloseHandle(hMapping);
CloseHandle(hFile);
return 3;
}
// Store the handles in the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles[filename] = hFile;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles[filename] = hMapping;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData[filename] = fileDataPtr;
}
}
}
return 0;
}
// Call this function when you are done using the file mappings
void cleanup() {
for (const auto& entry : fileHandles) {
UnmapViewOfFile(fileData[entry.first]);
CloseHandle(mappingHandles[entry.first]);
CloseHandle(entry.second);
}
// Clear the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles.clear();
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles.clear();
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData.clear();
}
}
//the latest and fastest version of searching a hash by now
int search_hash(const std::string& dbname_, const std::string& hash_, const std::string& filepath_) {
// Check if the file mapping is already open for the given filename
std::string dbname;
std::string hash;
std::string filepath;
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
dbname = dbname_;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
hash = hash_;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
filepath = filepath_;
}
auto fileIter = fileHandles.find(dbname);
if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
return 2;
}
else if (fileIter == fileHandles.end()) {
return 2;
}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileSize = GetFileSize(fileHandles[dbname], NULL);
fileContent = std::string(fileData[dbname], fileSize);
}
// Search for the specific string in the file content
size_t foundPos = fileContent.find(hash);
if (foundPos != std::string::npos) {
//log(LOGLEVEL::VIRUS, "[search_hash()]: Found virus: ", hash, " in file: ", filepath);
virus_ctrl_store(filepath.c_str(), hash.c_str(), hash.c_str());
//afterwards do the processing with that file
virus_ctrl_process(hash.c_str());
return 1; // Found
}
return 0; // Not found
}
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
// The file does not exist or there was an error
return false;
}
// Check if it's a regular file and not a directory
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
void scan_folder(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::WARN, "[scan_folder()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
scan_folder(full_path);
}
else {
//action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str());
//do multithreading here
int cnt = 0;
while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10);
cnt++;
if(cnt==100*60)//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
}
//log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path, "threads: ",num_threads);
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
//Sleep(1);
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads);
}
if(num_threads<0)
printf("Number of threads: %d\n", num_threads);
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
//for singlethreaded scans
void action_scanfile(const std::string& filepath_) {
thread_init();
const std::string filepath(filepath_);
char* db_path = new char[300];
char* hash = new char[300];
std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else {
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
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) {
thread_init();
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();
}
void scan_file_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
thread_local std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else{
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
num_threads--;
}
void scan_process_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
strcpy_s(hash, 295, md5_file_t(filepath).c_str());
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
if (search_hash(db_path, hash, filepath) == 1) {
//check if need to kill process
if (get_setting("virus_ctrl:virus_process_found:kill") == 1) {
//kill the process
kill_process(filepath.c_str());
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
}
}
num_threads--;
}
#endif

View File

@@ -0,0 +1,103 @@
#include "utils.h"
#include <windows.h>
#include <string.h>
#include <iostream>
#include "log.h"
#include <tlhelp32.h>
#include <regex>
#include <filesystem>
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) {
// Split a string at the delimiter. The delimiter only occurs once.
// The first part is stored in out1 and the second part in out2.
size_t pos = input.find(delimiter);
if (pos != std::string::npos) {
out1 = input.substr(0, pos);
out2 = input.substr(pos + 1);
}
}
bool is_valid_path(const std::string& filename) {
// Regular expression to match Windows path name criteria and illegal characters
std::regex pattern(R"(^(?:[a-zA-Z]:)?(?:\\[^<>:"/\\|?*]*)*$)");
// Check if the path matches the pattern
return std::regex_match(path, pattern);
}
void startup(LPCTSTR lpApplicationName)
{
// additional information
STARTUPINFO si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
CreateProcess(lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
std::string get_filename(const std::string& path) {
auto pos = path.find_last_of("\\");
if (pos == std::string::npos) {
// No directory separator found, return the original path
return path;
}
else {
// Return the substring after the last directory separator
return path.substr(pos + 1);
}
}
int strcasecmp(const std::string& s1, const std::string& s2) {
auto it1 = s1.begin();
auto it2 = s2.begin();
while (it1 != s1.end() && it2 != s2.end()) {
int diff = std::tolower(*it1) - std::tolower(*it2);
if (diff != 0)
return diff;
++it1;
++it2;
}
return 0;
}
void kill_process(const std::string& path) {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
PROCESSENTRY32 pEntry;
pEntry.dwSize = sizeof(pEntry);
BOOL hRes = Process32First(hSnapShot, &pEntry);
while (hRes)
{
if (strcasecmp(pEntry.szExeFile, get_filename(path).c_str()) == 0)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, static_cast<DWORD>(pEntry.th32ProcessID));
if (hProcess != NULL)
{
TerminateProcess(hProcess, 9);
CloseHandle(hProcess);
}
else
log(LOGLEVEL::ERR, "[kill_process()]: Error while killing process: ", path);
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}

View File

@@ -16,6 +16,8 @@
#include "virus_ctrl.h" #include "virus_ctrl.h"
#include "app_ctrl.h" #include "app_ctrl.h"
#include <mutex> // Include the mutex header #include <mutex> // Include the mutex header
#include <filesystem>
#include "utils.h"
// Define mutexes for thread synchronization // Define mutexes for thread synchronization
std::mutex fileHandlesMutex; std::mutex fileHandlesMutex;
@@ -29,7 +31,8 @@ std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData; std::unordered_map<std::string, char*> fileData;
int cnt = 0; int cnt = 0;
unsigned int num_threads = 0; int num_threads = 0;
int all_files = 0;
//load all the db files into memory //load all the db files into memory
int initialize(const std::string& folderPath) { int initialize(const std::string& folderPath) {
@@ -158,17 +161,33 @@ int search_hash(const std::string& dbname_, const std::string& hash_, const std:
return 0; // Not found return 0; // Not found
} }
//function to get num of files in idr and its subdirs etc
bool file_exists(const std::string& filePath) { int get_num_files(const std::string& directory) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str()); std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
if (fileAttributes == INVALID_FILE_ATTRIBUTES) { HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
// The file does not exist or there was an error int num_files = 0;
return false; if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::ERR_NOSEND, "[get_num_files()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return 0;
} }
// Check if it's a regular file and not a directory do {
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0; if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
num_files += get_num_files(full_path);
}
else {
num_files++;
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
return num_files;
} }
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings //this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
@@ -196,21 +215,40 @@ void scan_folder(const std::string& directory) {
else { else {
//action scanfile_t will start the trheads for scanning the hashes //action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str()); //action_scanfile_t(full_path.c_str());
//do multithreading here //do multithreading here
int thread_timeout = 0;
while (num_threads >= std::thread::hardware_concurrency()) { while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10); Sleep(10);
thread_timeout++;
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
} }
//log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path, "threads: ",num_threads); }
if (is_valid_path(full_path)) { //filter out invalid paths and paths with weird characters
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) {//4gb
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path); std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach(); scan_thread.detach();
//Sleep(1); }
}else
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
cnt++; cnt++;
if (cnt % 100 == 0) { if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt); printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads); //printf("Number of threads: %d\n", num_threads);
} }
if (cnt % 1000 == 0) {
//send progress to com file
std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app);
if (answer_com.is_open()) {
answer_com << "progress " << (cnt*100/(all_files+1)) << "\n";
answer_com.close();
}
}
} }
} while (FindNextFile(hFind, &find_file_data) != 0); } while (FindNextFile(hFind, &find_file_data) != 0);
@@ -225,6 +263,7 @@ void action_scanfile(const std::string& filepath_) {
const std::string filepath(filepath_); const std::string filepath(filepath_);
char* db_path = new char[300]; char* db_path = new char[300];
char* hash = new char[300]; char* hash = new char[300];
if (is_valid_path(filepath_)) { //filter out invalid paths and paths with weird characters
std::string hash_(md5_file_t(filepath)); std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290) if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str()); strcpy_s(hash, 295, hash_.c_str());
@@ -242,12 +281,22 @@ void action_scanfile(const std::string& filepath_) {
answer_com.close(); answer_com.close();
} }
} }
}
else
log(LOGLEVEL::INFO_NOSEND, "[action_scanfile()]: Invalid path: ", filepath_);
thread_shutdown(); thread_shutdown();
} }
void action_scanfolder(const std::string& folderpath) { void action_scanfolder(const std::string& folderpath) {
thread_init(); thread_init();
cnt = 0;
thread_local std::string folderpath_(folderpath); thread_local std::string folderpath_(folderpath);
cnt = 0;
all_files = get_num_files(folderpath_);
//tell the desktop client that the scan has started
std::ofstream answer_com1(ANSWER_COM_PATH, std::ios::app);
if (answer_com1.is_open()) {
answer_com1 << "start " << all_files << "\n";
answer_com1.close();
}
scan_folder(folderpath_); scan_folder(folderpath_);
std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app); std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app);
if (answer_com.is_open()) { if (answer_com.is_open()) {
@@ -274,7 +323,6 @@ void scan_file_t(const std::string& filepath_) {
num_threads--; num_threads--;
} }
void scan_process_t(const std::string& filepath_) { void scan_process_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_); thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300]; thread_local char* db_path = new char[300];
thread_local char* hash = new char[300]; thread_local char* hash = new char[300];
@@ -288,6 +336,5 @@ void scan_process_t(const std::string& filepath_) {
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath); log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
} }
} }
num_threads--;
} }
#endif #endif

View File

@@ -0,0 +1,312 @@
#ifndef SCAN_CPP
#define SCAN_CPP
#include "scan.h"
#include <windows.h>
#include <iostream>
#include <openssl/md5.h>
#include <windows.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <time.h>
#include "md5hash.h"
#include <string>
#include "well_known.h"
#include "log.h"
#include "virus_ctrl.h"
#include "app_ctrl.h"
#include <mutex> // Include the mutex header
#include <filesystem>
#include "utils.h"
// Define mutexes for thread synchronization
std::mutex fileHandlesMutex;
std::mutex mappingHandlesMutex;
std::mutex fileDataMutex;
std::mutex cntMutex;
std::mutex numThreadsMutex;
std::unordered_map<std::string, HANDLE> fileHandles;
std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData;
int cnt = 0;
int num_threads = 0;
//load all the db files into memory
int initialize(const std::string& folderPath) {
for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) {
for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) {
// Ensure that the characters are valid hexadecimal digits
if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) {
continue;
}
// Create the filename based on the naming convention
std::string filename = folderPath + "\\" + firstChar + secondChar + ".jdbf";
//printf("Loading %s\n", filename.c_str());
// Open the file
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
//log(LOGLEVEL::ERR, "[initialize()]: Error opening database file: ", filename);
return 1;
}
// Create the file mapping
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping == NULL) {
// log(LOGLEVEL::ERR, "[initialize()]: Error creating database file mapping: ", filename);
CloseHandle(hFile);
return 2;
}
// Map the file into memory
char* fileDataPtr = static_cast<char*>(MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0));
if (fileDataPtr == NULL) {
//log(LOGLEVEL::ERR, "[initialize()]: Error mapping database file: ", filename);
CloseHandle(hMapping);
CloseHandle(hFile);
return 3;
}
// Store the handles in the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles[filename] = hFile;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles[filename] = hMapping;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData[filename] = fileDataPtr;
}
}
}
return 0;
}
// Call this function when you are done using the file mappings
void cleanup() {
for (const auto& entry : fileHandles) {
UnmapViewOfFile(fileData[entry.first]);
CloseHandle(mappingHandles[entry.first]);
CloseHandle(entry.second);
}
// Clear the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles.clear();
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles.clear();
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData.clear();
}
}
//the latest and fastest version of searching a hash by now
int search_hash(const std::string& dbname_, const std::string& hash_, const std::string& filepath_) {
// Check if the file mapping is already open for the given filename
std::string dbname;
std::string hash;
std::string filepath;
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
dbname = dbname_;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
hash = hash_;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
filepath = filepath_;
}
auto fileIter = fileHandles.find(dbname);
if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
return 2;
}
else if (fileIter == fileHandles.end()) {
return 2;
}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileSize = GetFileSize(fileHandles[dbname], NULL);
fileContent = std::string(fileData[dbname], fileSize);
}
// Search for the specific string in the file content
size_t foundPos = fileContent.find(hash);
if (foundPos != std::string::npos) {
//log(LOGLEVEL::VIRUS, "[search_hash()]: Found virus: ", hash, " in file: ", filepath);
virus_ctrl_store(filepath.c_str(), hash.c_str(), hash.c_str());
//afterwards do the processing with that file
virus_ctrl_process(hash.c_str());
return 1; // Found
}
return 0; // Not found
}
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
// The file does not exist or there was an error
return false;
}
// Check if it's a regular file and not a directory
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
void scan_folder(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::WARN, "[scan_folder()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
scan_folder(full_path);
}
else {
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path, "threads: ", num_threads);
//action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str());
//do multithreading here
int thread_timeout = 0;
while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10);
thread_timeout++;
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
printf("Number of threads_max: %d\n", num_threads);
}
}
//log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path, "threads: ",num_threads);
if (is_valid_path(full_path)==0) {
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) {//4gb
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
//Sleep(1);
}
}else
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads);
}
if(num_threads<0)
printf("Number of threads_min: %d\n", num_threads);
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
//for singlethreaded scans
void action_scanfile(const std::string& filepath_) {
thread_init();
const std::string filepath(filepath_);
char* db_path = new char[300];
char* hash = new char[300];
std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else {
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
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) {
thread_init();
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();
}
void scan_file_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
thread_local std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else{
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
num_threads--;
}
void scan_process_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
strcpy_s(hash, 295, md5_file_t(filepath).c_str());
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
if (search_hash(db_path, hash, filepath) == 1) {
//check if need to kill process
if (get_setting("virus_ctrl:virus_process_found:kill") == 1) {
//kill the process
kill_process(filepath.c_str());
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
}
}
num_threads--;
}
#endif

View File

@@ -0,0 +1,311 @@
#ifndef SCAN_CPP
#define SCAN_CPP
#include "scan.h"
#include <windows.h>
#include <iostream>
#include <openssl/md5.h>
#include <windows.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <time.h>
#include "md5hash.h"
#include <string>
#include "well_known.h"
#include "log.h"
#include "virus_ctrl.h"
#include "app_ctrl.h"
#include <mutex> // Include the mutex header
#include <filesystem>
#include "utils.h"
// Define mutexes for thread synchronization
std::mutex fileHandlesMutex;
std::mutex mappingHandlesMutex;
std::mutex fileDataMutex;
std::mutex cntMutex;
std::mutex numThreadsMutex;
std::unordered_map<std::string, HANDLE> fileHandles;
std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData;
int cnt = 0;
int num_threads = 0;
//load all the db files into memory
int initialize(const std::string& folderPath) {
for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) {
for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) {
// Ensure that the characters are valid hexadecimal digits
if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) {
continue;
}
// Create the filename based on the naming convention
std::string filename = folderPath + "\\" + firstChar + secondChar + ".jdbf";
//printf("Loading %s\n", filename.c_str());
// Open the file
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
//log(LOGLEVEL::ERR, "[initialize()]: Error opening database file: ", filename);
return 1;
}
// Create the file mapping
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping == NULL) {
// log(LOGLEVEL::ERR, "[initialize()]: Error creating database file mapping: ", filename);
CloseHandle(hFile);
return 2;
}
// Map the file into memory
char* fileDataPtr = static_cast<char*>(MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0));
if (fileDataPtr == NULL) {
//log(LOGLEVEL::ERR, "[initialize()]: Error mapping database file: ", filename);
CloseHandle(hMapping);
CloseHandle(hFile);
return 3;
}
// Store the handles in the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles[filename] = hFile;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles[filename] = hMapping;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData[filename] = fileDataPtr;
}
}
}
return 0;
}
// Call this function when you are done using the file mappings
void cleanup() {
for (const auto& entry : fileHandles) {
UnmapViewOfFile(fileData[entry.first]);
CloseHandle(mappingHandles[entry.first]);
CloseHandle(entry.second);
}
// Clear the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles.clear();
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles.clear();
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData.clear();
}
}
//the latest and fastest version of searching a hash by now
int search_hash(const std::string& dbname_, const std::string& hash_, const std::string& filepath_) {
// Check if the file mapping is already open for the given filename
std::string dbname;
std::string hash;
std::string filepath;
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
dbname = dbname_;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
hash = hash_;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
filepath = filepath_;
}
auto fileIter = fileHandles.find(dbname);
if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
return 2;
}
else if (fileIter == fileHandles.end()) {
return 2;
}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileSize = GetFileSize(fileHandles[dbname], NULL);
fileContent = std::string(fileData[dbname], fileSize);
}
// Search for the specific string in the file content
size_t foundPos = fileContent.find(hash);
if (foundPos != std::string::npos) {
//log(LOGLEVEL::VIRUS, "[search_hash()]: Found virus: ", hash, " in file: ", filepath);
virus_ctrl_store(filepath.c_str(), hash.c_str(), hash.c_str());
//afterwards do the processing with that file
virus_ctrl_process(hash.c_str());
return 1; // Found
}
return 0; // Not found
}
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
// The file does not exist or there was an error
return false;
}
// Check if it's a regular file and not a directory
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
void scan_folder(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::WARN, "[scan_folder()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
scan_folder(full_path);
}
else {
//action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str());
//do multithreading here
int thread_timeout = 0;
while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10);
thread_timeout++;
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
printf("Number of threads_max: %d\n", num_threads);
}
}
if (is_valid_path(full_path)) { //filter out invalid paths and paths with weird characters
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) {//4gb
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
Sleep(10);
}
}else
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads);
}
if(num_threads<0)
printf("Number of threads_min: %d\n", num_threads);
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
//for singlethreaded scans
void action_scanfile(const std::string& filepath_) {
thread_init();
const std::string filepath(filepath_);
char* db_path = new char[300];
char* hash = new char[300];
std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else {
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
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) {
thread_init();
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();
}
void scan_file_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
thread_local std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else{
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
num_threads--;
}
void scan_process_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
strcpy_s(hash, 295, md5_file_t(filepath).c_str());
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
if (search_hash(db_path, hash, filepath) == 1) {
//check if need to kill process
if (get_setting("virus_ctrl:virus_process_found:kill") == 1) {
//kill the process
kill_process(filepath.c_str());
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
}
}
num_threads--;
}
#endif

View File

@@ -0,0 +1,323 @@
#ifndef SCAN_CPP
#define SCAN_CPP
#include "scan.h"
#include <windows.h>
#include <iostream>
#include <openssl/md5.h>
#include <windows.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <time.h>
#include "md5hash.h"
#include <string>
#include "well_known.h"
#include "log.h"
#include "virus_ctrl.h"
#include "app_ctrl.h"
#include <mutex> // Include the mutex header
#include <filesystem>
#include "utils.h"
// Define mutexes for thread synchronization
std::mutex fileHandlesMutex;
std::mutex mappingHandlesMutex;
std::mutex fileDataMutex;
std::mutex cntMutex;
std::mutex numThreadsMutex;
std::unordered_map<std::string, HANDLE> fileHandles;
std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData;
int cnt = 0;
int num_threads = 0;
//load all the db files into memory
int initialize(const std::string& folderPath) {
for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) {
for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) {
// Ensure that the characters are valid hexadecimal digits
if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) {
continue;
}
// Create the filename based on the naming convention
std::string filename = folderPath + "\\" + firstChar + secondChar + ".jdbf";
//printf("Loading %s\n", filename.c_str());
// Open the file
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
//log(LOGLEVEL::ERR, "[initialize()]: Error opening database file: ", filename);
return 1;
}
// Create the file mapping
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping == NULL) {
// log(LOGLEVEL::ERR, "[initialize()]: Error creating database file mapping: ", filename);
CloseHandle(hFile);
return 2;
}
// Map the file into memory
char* fileDataPtr = static_cast<char*>(MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0));
if (fileDataPtr == NULL) {
//log(LOGLEVEL::ERR, "[initialize()]: Error mapping database file: ", filename);
CloseHandle(hMapping);
CloseHandle(hFile);
return 3;
}
// Store the handles in the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles[filename] = hFile;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles[filename] = hMapping;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData[filename] = fileDataPtr;
}
}
}
return 0;
}
// Call this function when you are done using the file mappings
void cleanup() {
for (const auto& entry : fileHandles) {
UnmapViewOfFile(fileData[entry.first]);
CloseHandle(mappingHandles[entry.first]);
CloseHandle(entry.second);
}
// Clear the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles.clear();
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles.clear();
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData.clear();
}
}
//the latest and fastest version of searching a hash by now
int search_hash(const std::string& dbname_, const std::string& hash_, const std::string& filepath_) {
// Check if the file mapping is already open for the given filename
std::string dbname;
std::string hash;
std::string filepath;
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
dbname = dbname_;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
hash = hash_;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
filepath = filepath_;
}
auto fileIter = fileHandles.find(dbname);
if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
return 2;
}
else if (fileIter == fileHandles.end()) {
return 2;
}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileSize = GetFileSize(fileHandles[dbname], NULL);
fileContent = std::string(fileData[dbname], fileSize);
}
// Search for the specific string in the file content
size_t foundPos = fileContent.find(hash);
if (foundPos != std::string::npos) {
//log(LOGLEVEL::VIRUS, "[search_hash()]: Found virus: ", hash, " in file: ", filepath);
virus_ctrl_store(filepath.c_str(), hash.c_str(), hash.c_str());
//afterwards do the processing with that file
virus_ctrl_process(hash.c_str());
return 1; // Found
}
return 0; // Not found
}
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
// The file does not exist or there was an error
return false;
}
// Check if it's a regular file and not a directory
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
void scan_folder(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::WARN, "[scan_folder()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
scan_folder(full_path);
}
else {
//action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str());
//do multithreading here
int thread_timeout = 0;
while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10);
thread_timeout++;
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
printf("Number of threads_max: %d\n", num_threads);
}
}
if (is_valid_path(full_path)) { //filter out invalid paths and paths with weird characters
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) {//4gb
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
}
}else
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads);
}
if (cnt % 1000 == 0) {
//send progress to com file
printf("Processed %d files; Sending to frontend\n", cnt);
std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app);
if (answer_com.is_open()) {
answer_com << "progress " << 50 << "\n";
answer_com.close();
}
}
if(num_threads<0)
printf("Number of threads_min: %d\n", num_threads);
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
//for singlethreaded scans
void action_scanfile(const std::string& filepath_) {
thread_init();
const std::string filepath(filepath_);
char* db_path = new char[300];
char* hash = new char[300];
if (is_valid_path(filepath_)) { //filter out invalid paths and paths with weird characters
std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else {
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
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();
}
}
}
else
log(LOGLEVEL::INFO_NOSEND, "[action_scanfile()]: Invalid path: ", filepath_);
thread_shutdown();
}
void action_scanfolder(const std::string& folderpath) {
thread_init();
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();
}
void scan_file_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
thread_local std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else{
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
num_threads--;
}
void scan_process_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
strcpy_s(hash, 295, md5_file_t(filepath).c_str());
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
if (search_hash(db_path, hash, filepath) == 1) {
//check if need to kill process
if (get_setting("virus_ctrl:virus_process_found:kill") == 1) {
//kill the process
kill_process(filepath.c_str());
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
}
}
num_threads--;
}
#endif

View File

@@ -0,0 +1,344 @@
#ifndef SCAN_CPP
#define SCAN_CPP
#include "scan.h"
#include <windows.h>
#include <iostream>
#include <openssl/md5.h>
#include <windows.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <time.h>
#include "md5hash.h"
#include <string>
#include "well_known.h"
#include "log.h"
#include "virus_ctrl.h"
#include "app_ctrl.h"
#include <mutex> // Include the mutex header
#include <filesystem>
#include "utils.h"
// Define mutexes for thread synchronization
std::mutex fileHandlesMutex;
std::mutex mappingHandlesMutex;
std::mutex fileDataMutex;
std::mutex cntMutex;
std::mutex numThreadsMutex;
std::unordered_map<std::string, HANDLE> fileHandles;
std::unordered_map<std::string, HANDLE> mappingHandles;
std::unordered_map<std::string, char*> fileData;
int cnt = 0;
int num_threads = 0;
int all_files = 0;
//load all the db files into memory
int initialize(const std::string& folderPath) {
for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) {
for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) {
// Ensure that the characters are valid hexadecimal digits
if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) {
continue;
}
// Create the filename based on the naming convention
std::string filename = folderPath + "\\" + firstChar + secondChar + ".jdbf";
//printf("Loading %s\n", filename.c_str());
// Open the file
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
//log(LOGLEVEL::ERR, "[initialize()]: Error opening database file: ", filename);
return 1;
}
// Create the file mapping
HANDLE hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping == NULL) {
// log(LOGLEVEL::ERR, "[initialize()]: Error creating database file mapping: ", filename);
CloseHandle(hFile);
return 2;
}
// Map the file into memory
char* fileDataPtr = static_cast<char*>(MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0));
if (fileDataPtr == NULL) {
//log(LOGLEVEL::ERR, "[initialize()]: Error mapping database file: ", filename);
CloseHandle(hMapping);
CloseHandle(hFile);
return 3;
}
// Store the handles in the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles[filename] = hFile;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles[filename] = hMapping;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData[filename] = fileDataPtr;
}
}
}
return 0;
}
// Call this function when you are done using the file mappings
void cleanup() {
for (const auto& entry : fileHandles) {
UnmapViewOfFile(fileData[entry.first]);
CloseHandle(mappingHandles[entry.first]);
CloseHandle(entry.second);
}
// Clear the global maps
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
fileHandles.clear();
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
mappingHandles.clear();
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileData.clear();
}
}
//the latest and fastest version of searching a hash by now
int search_hash(const std::string& dbname_, const std::string& hash_, const std::string& filepath_) {
// Check if the file mapping is already open for the given filename
std::string dbname;
std::string hash;
std::string filepath;
{
std::lock_guard<std::mutex> lock(fileHandlesMutex);
dbname = dbname_;
}
{
std::lock_guard<std::mutex> lock(fileDataMutex);
hash = hash_;
}
{
std::lock_guard<std::mutex> lock(mappingHandlesMutex);
filepath = filepath_;
}
auto fileIter = fileHandles.find(dbname);
if (fileIter == fileHandles.end() && dbname_.find("c:.jdbf") == std::string::npos) {
log(LOGLEVEL::ERR_NOSEND, "[search_hash()]: File mapping not initialized for ", dbname);
return 2;
}
else if (fileIter == fileHandles.end()) {
return 2;
}
// Use fileData for subsequent searches
DWORD fileSize;
std::string fileContent;
{
std::lock_guard<std::mutex> lock(fileDataMutex);
fileSize = GetFileSize(fileHandles[dbname], NULL);
fileContent = std::string(fileData[dbname], fileSize);
}
// Search for the specific string in the file content
size_t foundPos = fileContent.find(hash);
if (foundPos != std::string::npos) {
//log(LOGLEVEL::VIRUS, "[search_hash()]: Found virus: ", hash, " in file: ", filepath);
virus_ctrl_store(filepath.c_str(), hash.c_str(), hash.c_str());
//afterwards do the processing with that file
virus_ctrl_process(hash.c_str());
return 1; // Found
}
return 0; // Not found
}
//function to get num of files in idr and its subdirs etc
int get_num_files(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
int num_files = 0;
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::ERR_NOSEND, "[get_num_files()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return 0;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
num_files += get_num_files(full_path);
}
else {
num_files++;
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
return num_files;
}
//this is the main function to scan folders. it will then start multuiple threads based on the number of cores / settings
void scan_folder(const std::string& directory) {
std::string search_path = directory + "\\*.*";
WIN32_FIND_DATA find_file_data;
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
if (hFind == INVALID_HANDLE_VALUE) {
log(LOGLEVEL::WARN, "[scan_folder()]: Could not open directory: ", search_path.c_str(), " while scanning files inside directory.");
return;
}
do {
if (strcmp(find_file_data.cFileName, ".") == 0 || strcmp(find_file_data.cFileName, "..") == 0) {
continue; // Skip the current and parent directories
}
const std::string full_path = directory + "\\" + find_file_data.cFileName;
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it's a directory, recurse into it
scan_folder(full_path);
}
else {
//action scanfile_t will start the trheads for scanning the hashes
//action_scanfile_t(full_path.c_str());
if (cnt > 47400) {
//say which file we are scanning now
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Scanning file: ", full_path);
}
//do multithreading here
int thread_timeout = 0;
while (num_threads >= std::thread::hardware_concurrency()) {
Sleep(10);
thread_timeout++;
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
num_threads = 0;
}
}
if (is_valid_path(full_path)) { //filter out invalid paths and paths with weird characters
std::uintmax_t fileSize = std::filesystem::file_size(full_path);
if (fileSize > 4000000000) {//4gb
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: File too large to scan: ", full_path);
}
else {
std::thread scan_thread(scan_file_t, full_path);
scan_thread.detach();
}
}else
log(LOGLEVEL::INFO_NOSEND, "[scan_folder()]: Invalid path: ", full_path);
cnt++;
if (cnt % 100 == 0) {
printf("Processed %d files;\n", cnt);
//printf("Number of threads: %d\n", num_threads);
}
if (cnt % 1000 == 0) {
//send progress to com file
std::ofstream answer_com(ANSWER_COM_PATH, std::ios::app);
if (answer_com.is_open()) {
answer_com << "progress " << (cnt*100/(all_files+1)) << "\n";
answer_com.close();
}
}
}
} while (FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
//for singlethreaded scans
void action_scanfile(const std::string& filepath_) {
thread_init();
const std::string filepath(filepath_);
char* db_path = new char[300];
char* hash = new char[300];
if (is_valid_path(filepath_)) { //filter out invalid paths and paths with weird characters
std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else {
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
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();
}
}
}
else
log(LOGLEVEL::INFO_NOSEND, "[action_scanfile()]: Invalid path: ", filepath_);
thread_shutdown();
}
void action_scanfolder(const std::string& folderpath) {
thread_init();
thread_local std::string folderpath_(folderpath);
cnt = 0;
all_files = get_num_files(folderpath_);
//tell the desktop client that the scan has started
std::ofstream answer_com1(ANSWER_COM_PATH, std::ios::app);
if (answer_com1.is_open()) {
answer_com1 << "start " << all_files << "\n";
answer_com1.close();
}
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();
}
void scan_file_t(const std::string& filepath_) {
num_threads++;
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
thread_local std::string hash_(md5_file_t(filepath));
if (strlen(hash_.c_str()) < 290)
strcpy_s(hash, 295, hash_.c_str());
else{
strcpy_s(hash, 295, "");
log(LOGLEVEL::ERR_NOSEND, "[scan_file_t()]: Could not calculate hash for file: ", filepath);
}
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
search_hash(db_path, hash, filepath);
num_threads--;
}
void scan_process_t(const std::string& filepath_) {
thread_local const std::string filepath(filepath_);
thread_local char* db_path = new char[300];
thread_local char* hash = new char[300];
strcpy_s(hash, 295, md5_file_t(filepath).c_str());
sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]);
if (search_hash(db_path, hash, filepath) == 1) {
//check if need to kill process
if (get_setting("virus_ctrl:virus_process_found:kill") == 1) {
//kill the process
kill_process(filepath.c_str());
log(LOGLEVEL::VIRUS, "[scan_process_t()]: Killing process: ", filepath);
}
}
}
#endif

View File

@@ -51,12 +51,7 @@ int start_thread(const std::string& command) {
t1.detach(); t1.detach();
has_run = 1; has_run = 1;
} }
if (has_run) { Sleep(10); // Sleep for 10 ms to give the thread time to start
while (can_run_thread()) {
// Delay a bit to wait until the thread is started
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
} }
return 0; return 0;
} }

View File

@@ -4,6 +4,9 @@
#include <iostream> #include <iostream>
#include "log.h" #include "log.h"
#include <tlhelp32.h> #include <tlhelp32.h>
#include <regex>
#include <filesystem>
#include <regex>
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) { void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) {
// Split a string at the delimiter. The delimiter only occurs once. // Split a string at the delimiter. The delimiter only occurs once.
@@ -14,6 +17,17 @@ void split(const std::string& input, char delimiter, std::string& out1, std::str
out2 = input.substr(pos + 1); out2 = input.substr(pos + 1);
} }
} }
bool is_valid_path(const std::string& filename) {
for (char c : filename) {
if (c == '<' || c == '>' || c == '"' || c == '|' || c == '?' || c == '*' || c > 126 || c < 32 ) {
return 0; // Special character found
}
}
if (!std::filesystem::exists(filename)) {
return 0; // File does not exist
}
return 1; // No special character found
}
void startup(LPCTSTR lpApplicationName) void startup(LPCTSTR lpApplicationName)
@@ -92,3 +106,16 @@ void kill_process(const std::string& path) {
} }
CloseHandle(hSnapShot); CloseHandle(hSnapShot);
} }
bool file_exists(const std::string& filePath) {
DWORD fileAttributes = GetFileAttributes(filePath.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
// The file does not exist or there was an error
return false;
}
// Check if it's a regular file and not a directory
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
}

View File

@@ -0,0 +1,102 @@
#include "utils.h"
#include <windows.h>
#include <string.h>
#include <iostream>
#include "log.h"
#include <tlhelp32.h>
#include <regex>
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) {
// Split a string at the delimiter. The delimiter only occurs once.
// The first part is stored in out1 and the second part in out2.
size_t pos = input.find(delimiter);
if (pos != std::string::npos) {
out1 = input.substr(0, pos);
out2 = input.substr(pos + 1);
}
}
bool is_valid_path(const std::string& filename) {
// Define a regular expression pattern for allowed characters
// This pattern allows letters (upper and lower case), numbers, underscores, and hyphens
std::regex pattern("[^<>:\"/\\\\|?*]+");
// Check if the filename matches the pattern
return std::regex_match(filename, pattern);
}
void startup(LPCTSTR lpApplicationName)
{
// additional information
STARTUPINFO si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
CreateProcess(lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
std::string get_filename(const std::string& path) {
auto pos = path.find_last_of("\\");
if (pos == std::string::npos) {
// No directory separator found, return the original path
return path;
}
else {
// Return the substring after the last directory separator
return path.substr(pos + 1);
}
}
int strcasecmp(const std::string& s1, const std::string& s2) {
auto it1 = s1.begin();
auto it2 = s2.begin();
while (it1 != s1.end() && it2 != s2.end()) {
int diff = std::tolower(*it1) - std::tolower(*it2);
if (diff != 0)
return diff;
++it1;
++it2;
}
return 0;
}
void kill_process(const std::string& path) {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
PROCESSENTRY32 pEntry;
pEntry.dwSize = sizeof(pEntry);
BOOL hRes = Process32First(hSnapShot, &pEntry);
while (hRes)
{
if (strcasecmp(pEntry.szExeFile, get_filename(path).c_str()) == 0)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, static_cast<DWORD>(pEntry.th32ProcessID));
if (hProcess != NULL)
{
TerminateProcess(hProcess, 9);
CloseHandle(hProcess);
}
else
log(LOGLEVEL::ERR, "[kill_process()]: Error while killing process: ", path);
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}

View File

@@ -0,0 +1,105 @@
#include "utils.h"
#include <windows.h>
#include <string.h>
#include <iostream>
#include "log.h"
#include <tlhelp32.h>
#include <regex>
#include <filesystem>
#include <regex>
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) {
// Split a string at the delimiter. The delimiter only occurs once.
// The first part is stored in out1 and the second part in out2.
size_t pos = input.find(delimiter);
if (pos != std::string::npos) {
out1 = input.substr(0, pos);
out2 = input.substr(pos + 1);
}
}
bool is_valid_path(const std::string& filename) {
for (char c : filename) {
if (c == '<' || c == '>' || c == '"' || c == '|' || c == '?' || c == '*') {
return 0; // Special character found
}
}
return 1; // No special character found
}
void startup(LPCTSTR lpApplicationName)
{
// additional information
STARTUPINFO si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
CreateProcess(lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
std::string get_filename(const std::string& path) {
auto pos = path.find_last_of("\\");
if (pos == std::string::npos) {
// No directory separator found, return the original path
return path;
}
else {
// Return the substring after the last directory separator
return path.substr(pos + 1);
}
}
int strcasecmp(const std::string& s1, const std::string& s2) {
auto it1 = s1.begin();
auto it2 = s2.begin();
while (it1 != s1.end() && it2 != s2.end()) {
int diff = std::tolower(*it1) - std::tolower(*it2);
if (diff != 0)
return diff;
++it1;
++it2;
}
return 0;
}
void kill_process(const std::string& path) {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
PROCESSENTRY32 pEntry;
pEntry.dwSize = sizeof(pEntry);
BOOL hRes = Process32First(hSnapShot, &pEntry);
while (hRes)
{
if (strcasecmp(pEntry.szExeFile, get_filename(path).c_str()) == 0)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, static_cast<DWORD>(pEntry.th32ProcessID));
if (hProcess != NULL)
{
TerminateProcess(hProcess, 9);
CloseHandle(hProcess);
}
else
log(LOGLEVEL::ERR, "[kill_process()]: Error while killing process: ", path);
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}

View File

@@ -0,0 +1,105 @@
#include "utils.h"
#include <windows.h>
#include <string.h>
#include <iostream>
#include "log.h"
#include <tlhelp32.h>
#include <regex>
#include <filesystem>
#include <regex>
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2) {
// Split a string at the delimiter. The delimiter only occurs once.
// The first part is stored in out1 and the second part in out2.
size_t pos = input.find(delimiter);
if (pos != std::string::npos) {
out1 = input.substr(0, pos);
out2 = input.substr(pos + 1);
}
}
bool is_valid_path(const std::string& filename) {
for (char c : filename) {
if (c == '<' || c == '>' || c == '"' || c == '|' || c == '?' || c == '*' || c > 126 || c < 32 ) {
return 0; // Special character found
}
}
return 1; // No special character found
}
void startup(LPCTSTR lpApplicationName)
{
// additional information
STARTUPINFO si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
CreateProcess(lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
std::string get_filename(const std::string& path) {
auto pos = path.find_last_of("\\");
if (pos == std::string::npos) {
// No directory separator found, return the original path
return path;
}
else {
// Return the substring after the last directory separator
return path.substr(pos + 1);
}
}
int strcasecmp(const std::string& s1, const std::string& s2) {
auto it1 = s1.begin();
auto it2 = s2.begin();
while (it1 != s1.end() && it2 != s2.end()) {
int diff = std::tolower(*it1) - std::tolower(*it2);
if (diff != 0)
return diff;
++it1;
++it2;
}
return 0;
}
void kill_process(const std::string& path) {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
PROCESSENTRY32 pEntry;
pEntry.dwSize = sizeof(pEntry);
BOOL hRes = Process32First(hSnapShot, &pEntry);
while (hRes)
{
if (strcasecmp(pEntry.szExeFile, get_filename(path).c_str()) == 0)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, static_cast<DWORD>(pEntry.th32ProcessID));
if (hProcess != NULL)
{
TerminateProcess(hProcess, 9);
CloseHandle(hProcess);
}
else
log(LOGLEVEL::ERR, "[kill_process()]: Error while killing process: ", path);
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}

View File

@@ -7,3 +7,5 @@ int strcasecmp(const std::string& s1, const std::string& s2);
void kill_process(const std::string& path); void kill_process(const std::string& path);
void startup(LPCTSTR lpApplicationName); void startup(LPCTSTR lpApplicationName);
void split(const std::string& input, char delimiter, std::string& out1, std::string& out2); void split(const std::string& input, char delimiter, std::string& out1, std::string& out2);
bool is_valid_path(const std::string& filename);
bool file_exists(const std::string& filename);

View File

View File

View File

@@ -3,28 +3,8 @@
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\", "WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\",
"Documents": [ "Documents": [
{ {
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "AbsoluteMoniker": "D:0:0:{4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" "RelativeMoniker": "D:0:0:{4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}|client_frontend.vcxproj|solutionrelative:client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -34,84 +14,19 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 4, "SelectedChildIndex": 0,
"Children": [ "Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "choose_element.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeDocumentMoniker": "choose_element.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeToolTip": "choose_element.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAGAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T17:06:27.941Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "choose_element.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeDocumentMoniker": "choose_element.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeToolTip": "choose_element.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABcAAABJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T17:06:16.884Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "id.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeDocumentMoniker": "id.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeToolTip": "id.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:31:43.692Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "ui.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeDocumentMoniker": "ui.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeToolTip": "ui.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAMAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:28:38.361Z",
"EditorCaption": ""
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
"Title": "ui.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeDocumentMoniker": "ui.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeToolTip": "ui.cpp",
"ViewState": "AQIAACoAAAAAAAAAAAAwwC8AAAAwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:28:29.863Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "client_frontend.cpp", "Title": "client_frontend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeDocumentMoniker": "client_frontend.cpp", "RelativeDocumentMoniker": "client_frontend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeToolTip": "client_frontend.cpp", "RelativeToolTip": "client_frontend.cpp",
"ViewState": "AQIAAHsAAAAAAAAAAAAAAJwAAAA3AAAA", "ViewState": "AQIAAA4BAAAAAAAAAAAAADYBAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:22:29.931Z", "WhenOpened": "2024-03-23T13:52:32.121Z",
"EditorCaption": "" "EditorCaption": ""
} }
] ]

View File

@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}|client_frontend.vcxproj|solutionrelative:client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "client_frontend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeDocumentMoniker": "client_frontend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeToolTip": "client_frontend.cpp",
"ViewState": "AQIAAIQAAAAAAAAAAAAAALAAAAA7AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-23T13:52:32.121Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -1,33 +0,0 @@
#include "choose_element.h"
#include <Windows.h>
#include <iostream>
#include <string>
std::wstring open_file(HWND hWnd)
{
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L"";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Filter for all files
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE)
{
// User selected a file, 'szFile' contains the selected file path
return std::wstring(szFile);
}
else
{
// User canceled the dialog
//MessageBox(hWnd, L"File selection canceled.", L"Canceled", MB_OK | MB_ICONEXCLAMATION);
return L"cancel";
}
}

View File

@@ -1,6 +0,0 @@
#pragma once
#include "id.h"
#include <Windows.h>
#include <string>
#include <iostream>
std::wstring open_file(HWND hWnd);

View File

@@ -1,210 +1,380 @@
// client_frontend.cpp : Definiert den Einstiegspunkt für die Anwendung. #include <Windows.h>
// #include <shlobj.h>
#include <windows.h> #include <thread>
#include "framework.h" #include <chrono>
#include "client_frontend.h" #include <fstream>
#include "ui.h" #include <codecvt>
#include "id.h" #include <locale>
#include "choose_element.h" #include "../client_backend/well_known.h"
#define MAX_LOADSTRING 100
#define IDM_SCAN_FILE 101
#define IDM_SCAN_FOLDER 102
// Globale Variablen: std::wstring string_to_widestring(const std::string& str) {
HINSTANCE hInst; // Aktuelle Instanz std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
WCHAR szTitle[MAX_LOADSTRING]; // Titelleistentext return converter.from_bytes(str);
WCHAR szWindowClass[MAX_LOADSTRING]; // Der Klassenname des Hauptfensters.
// Vorwärtsdeklarationen der in diesem Codemodul enthaltenen Funktionen:
ATOM frontend_class(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Hier Code einfügen.
// Globale Zeichenfolgen initialisieren
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_CLIENTFRONTEND, szWindowClass, MAX_LOADSTRING);
frontend_class(hInstance);
// Anwendungsinitialisierung ausführen:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
} }
void send_command(const std::string& command) {
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CLIENTFRONTEND)); std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
MSG msg; outputFile << command;
outputFile.close();
// Hauptnachrichtenschleife:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} }
} }
return (int) msg.wParam; // Function to update the content of the text field with the provided text
void update_textfield(HWND hWndTextField, const std::string& text) {
// Get the current text length
int textLength = GetWindowTextLength(hWndTextField);
// Set the selection to the end of the text field
SendMessage(hWndTextField, EM_SETSEL, textLength, textLength);
// Append the new text
SendMessage(hWndTextField, EM_REPLACESEL, FALSE, (LPARAM)string_to_widestring(text).c_str());
}
void scan_file(HWND hWndTextField, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window
update_textfield(hWndTextField, "Scanning file: " + filePath + "\r\n");
bool answered = false;
// Write command into com file
//printf("%d\n",send_to_pipe("scanfile \"" + filePath + "\""));
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
}
else {
answered = true;
update_textfield(hWndTextField, "Error: Unable to talk to daemon!\n");
update_textfield(hWndTextField, "------------------------------------------\n");
}
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(HWND hProgressBar,HWND hWndTextField, const std::string& folderPath) {
//set progress bar to 0
SendMessage(hProgressBar, PBM_SETPOS, 0, 0);
int num_of_found = 0;
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window
update_textfield(hWndTextField, "Scanning folder: " + folderPath + "\r\n");
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << folderPath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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) {
if (status == "found" || status == "not_found") {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
num_of_found++;
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
else if (status == "progress") {
std::string progress;
inputFile.ignore(1); // Ignore space
inputFile >> progress;
SendMessage(hProgressBar, PBM_SETPOS, std::stoi(progress), 0);
}
else if (status == "start") {
std::string all_files;
inputFile.ignore(1); // Ignore space
inputFile >> all_files;
update_textfield(hWndTextField, "Folder scan started with "+ all_files +" files queued for scan\r\n");
}
else if (status == "end") {
answered = true;
}
}
}
inputFile.close();
std::ofstream(ANSWER_COM_PATH);//clear the file
Sleep(1000);//only see for new entrys ~ once a second
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
update_textfield(hWndTextField, "Folder scan completed\r\n");
update_textfield(hWndTextField, "Number of infected files: " + std::to_string(num_of_found) + "\r\n");
update_textfield(hWndTextField, "------------------------------------------\r\n");
SendMessage(hProgressBar, PBM_SETPOS, 100, 0);
// Remove the answer file
std::remove(ANSWER_COM_PATH);
} }
// std::string getFolderPath(HWND hWnd) {
// FUNKTION: MyRegisterClass() std::wstring selectedFolderPath;
//
// ZWECK: Registriert die Fensterklasse.
//
ATOM frontend_class(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX); // Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
wcex.style = CS_HREDRAW | CS_VREDRAW; // Display the folder picker dialog
wcex.lpfnWndProc = WndProc; BROWSEINFO browseInfo = { 0 };
wcex.cbClsExtra = 0; TCHAR selectedPath[MAX_PATH];
wcex.cbWndExtra = 0; browseInfo.hwndOwner = hWnd; // Set the owner window
wcex.hInstance = hInstance; browseInfo.pidlRoot = NULL; // Start from the desktop
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CLIENTFRONTEND)); browseInfo.pszDisplayName = selectedPath;
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); browseInfo.lpszTitle = TEXT("Select a folder");
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_CLIENTFRONTEND);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex); 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 = selectedPath;
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
} }
// // Uninitialize COM
// FUNKTION: InitInstance(HINSTANCE, int) CoUninitialize();
//
// ZWECK: Speichert das Instanzenhandle und erstellt das Hauptfenster.
//
// KOMMENTARE:
//
// In dieser Funktion wird das Instanzenhandle in einer globalen Variablen gespeichert, und das
// Hauptprogrammfenster wird erstellt und angezeigt.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, return std::string(selectedFolderPath.begin(), selectedFolderPath.end());
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
} }
ShowWindow(hWnd, nCmdShow); LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
UpdateWindow(hWnd); static HWND hWndTextField;
static HWND hProgressBar;
static HBRUSH hBackgroundBrush = CreateSolidBrush(RGB(255, 255, 255)); // White color
RECT rect;
GetClientRect(hWnd, &rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
switch (message) {
case WM_CREATE:
{
return TRUE; // Create the "Scan File" button
CreateWindowEx(NULL, L"BUTTON", L"Scan File",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 10, 100, 30, hWnd, (HMENU)IDM_SCAN_FILE, GetModuleHandle(NULL), NULL);
// Create the "Scan Folder" button
CreateWindowEx(NULL, L"BUTTON", L"Scan Folder",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 50, 100, 30, hWnd, (HMENU)IDM_SCAN_FOLDER, GetModuleHandle(NULL), NULL);
// Create a multi-line edit control for displaying text
hWndTextField = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY,
140, 10, width-140-20, height-10-50, hWnd, NULL, NULL, NULL);
update_textfield(hWndTextField, "Welcome to Cyberhex endpoint protection!\r\n");
hProgressBar = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
140, height-40, 200, 20, hWnd, NULL, NULL, NULL);
SendMessage(hProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
SendMessage(hProgressBar, PBM_SETSTEP, 1, 0);
} }
break;
// case WM_SIZE:
// FUNKTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// ZWECK: Verarbeitet Meldungen für das Hauptfenster.
//
// WM_COMMAND - Verarbeiten des Anwendungsmenüs
// WM_PAINT - Darstellen des Hauptfensters
// WM_DESTROY - Ausgeben einer Beendenmeldung und zurückkehren
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int windowWidth=0;
int windowHeight=0;
RECT clientRect;
GetClientRect(hWnd, &clientRect);
windowWidth = clientRect.right - clientRect.left;
windowHeight = clientRect.bottom - clientRect.top;
switch (message)
{ {
// Resize the text field to fit the window
MoveWindow(hWndTextField, 140, 10, width - 140 - 20, height - 10 - 50, TRUE);
MoveWindow(hProgressBar, 140, height - 40, 200, 20, TRUE);
break;
}
case WM_COMMAND: case WM_COMMAND:
{ {
int wmId = LOWORD(wParam); int wmId = LOWORD(wParam);
// Menüauswahl analysieren: // Parse the menu selections:
switch (wmId) switch (wmId) {
case IDM_SCAN_FILE:
{ {
case IDM_ABOUT: // Open file dialog to select a file
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); // Call scan_file function in a separate thread
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L""; // Use WCHAR for Unicode compatibility
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = L'\0'; // Use wide character constant L'\0'
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Use wide character string literal L""
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
std::wstring selectedFile = ofn.lpstrFile; // Use std::wstring for wide characters
std::string narrowSelectedFile(selectedFile.begin(), selectedFile.end());
std::thread(scan_file, hWndTextField, narrowSelectedFile).detach();
}
}
break; break;
case IDM_EXIT: case IDM_SCAN_FOLDER:
DestroyWindow(hWnd); {
break; // Open folder picker dialog
case ID_HOME_BUTTON: // Handle the home button click // Call scan_folder function in a separate thread
//set page to 0 std::string selected_folder = getFolderPath(hWnd);
ui_clear(); if(selected_folder!="")
ui_display_page(0, windowWidth, windowHeight, hWnd); std::thread(scan_folder,hProgressBar, hWndTextField, selected_folder).detach();
break; }
case ID_SCAN_FILE_BUTTON: // Handle the scan file button click
//set page to 1
ui_clear();
ui_display_page(1, windowWidth, windowHeight, hWnd);
break; break;
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }
} }
break; break;
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps); HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Zeichencode, der hdc verwendet, hier einfügen... RECT rect;
GetClientRect(hWnd, &rect);
FillRect(hdc, &rect, hBackgroundBrush); // Fill the entire client area with white color
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
break; break;
case WM_CREATE:
{
//ui_create();
ui_display_page(0, windowWidth, windowHeight, hWnd);
}
break;
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_SIZE:
//ui_resize();
ui_clear();
ui_display_page(0, windowWidth, windowHeight, hWnd);
break;
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }
return 0; return 0;
} }
// Meldungshandler für Infofeld. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) const wchar_t CLASS_NAME[] = L"Cyberhex endpoint protection frontend";
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND: WNDCLASS wc = { };
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{ wc.lpfnWndProc = WndProc;
EndDialog(hDlg, LOWORD(wParam)); wc.hInstance = hInstance;
return (INT_PTR)TRUE; wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
HWND hWnd = CreateWindowEx(
0,
CLASS_NAME,
L"Cyberhex endpoint protection",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
NULL,
NULL,
hInstance,
NULL
);
if (hWnd == NULL) {
return 0;
} }
break;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
} }
return (INT_PTR)FALSE;
return 0;
} }

View File

@@ -0,0 +1,368 @@
#include <Windows.h>
#include <shlobj.h>
#include <thread>
#include <chrono>
#include <fstream>
#include <codecvt>
#include <locale>
#include "../client_backend/well_known.h"
#define IDM_SCAN_FILE 101
#define IDM_SCAN_FOLDER 102
std::wstring string_to_widestring(const std::string& str) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(str);
}
void send_command(const std::string& command) {
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << command;
outputFile.close();
}
}
// Function to update the content of the text field with the provided text
void update_textfield(HWND hWndTextField, const std::string& text) {
// Get the current text length
int textLength = GetWindowTextLength(hWndTextField);
// Set the selection to the end of the text field
SendMessage(hWndTextField, EM_SETSEL, textLength, textLength);
// Append the new text
SendMessage(hWndTextField, EM_REPLACESEL, FALSE, (LPARAM)string_to_widestring(text).c_str());
}
void scan_file(HWND hWndTextField, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window
update_textfield(hWndTextField, "Scanning file: " + filePath + "\r\n");
bool answered = false;
// Write command into com file
//printf("%d\n",send_to_pipe("scanfile \"" + filePath + "\""));
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
}
else {
answered = true;
update_textfield(hWndTextField, "Error: Unable to talk to daemon!\n");
update_textfield(hWndTextField, "------------------------------------------\n");
}
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(HWND hProgressBar,HWND hWndTextField, const std::string& folderPath) {
int num_of_found = 0;
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window
update_textfield(hWndTextField, "Scanning folder: " + folderPath + "\r\n");
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << folderPath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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) {
if (status == "found" || status == "not_found") {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
num_of_found++;
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
else if (status == "progress") {
std::string progress;
inputFile.ignore(1); // Ignore space
inputFile >> progress;
MessageBox(NULL, string_to_widestring(progress).c_str(), L"Progress", MB_OK);
SendMessage(hProgressBar, PBM_SETPOS, atoi(progress.c_str()), 0);
}
else if (status == "end")
answered = true;
}
}
inputFile.close();
Sleep(1000);//only see for new entrys ~ once a second
std::ofstream(ANSWER_COM_PATH);//clear the file
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
update_textfield(hWndTextField, "Folder scan completed\r\n");
update_textfield(hWndTextField, "Number of infected files: " + std::to_string(num_of_found) + "\r\n");
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
std::string getFolderPath(HWND hWnd) {
std::wstring selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = hWnd; // Set the owner window
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 = selectedPath;
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return std::string(selectedFolderPath.begin(), selectedFolderPath.end());
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
static HWND hWndTextField;
static HWND hProgressBar;
static HBRUSH hBackgroundBrush = CreateSolidBrush(RGB(255, 255, 255)); // White color
RECT rect;
GetClientRect(hWnd, &rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
switch (message) {
case WM_CREATE:
{
// Create the "Scan File" button
CreateWindowEx(NULL, L"BUTTON", L"Scan File",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 10, 100, 30, hWnd, (HMENU)IDM_SCAN_FILE, GetModuleHandle(NULL), NULL);
// Create the "Scan Folder" button
CreateWindowEx(NULL, L"BUTTON", L"Scan Folder",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 50, 100, 30, hWnd, (HMENU)IDM_SCAN_FOLDER, GetModuleHandle(NULL), NULL);
// Create a multi-line edit control for displaying text
hWndTextField = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY,
140, 10, width-140-20, height-10-50, hWnd, NULL, NULL, NULL);
update_textfield(hWndTextField, "Welcome to Cyberhex endpoint protection!\r\n");
hProgressBar = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
140, height-40, 200, 20, hWnd, NULL, NULL, NULL);
SendMessage(hProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
SendMessage(hProgressBar, PBM_SETSTEP, 1, 0);
}
break;
case WM_SIZE:
{
// Resize the text field to fit the window
MoveWindow(hWndTextField, 140, 10, width - 140 - 20, height - 10 - 50, TRUE);
MoveWindow(hProgressBar, 140, height - 40, 200, 20, TRUE);
break;
}
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId) {
case IDM_SCAN_FILE:
{
// Open file dialog to select a file
// Call scan_file function in a separate thread
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L""; // Use WCHAR for Unicode compatibility
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = L'\0'; // Use wide character constant L'\0'
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Use wide character string literal L""
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
std::wstring selectedFile = ofn.lpstrFile; // Use std::wstring for wide characters
std::string narrowSelectedFile(selectedFile.begin(), selectedFile.end());
std::thread(scan_file, hWndTextField, narrowSelectedFile).detach();
}
}
break;
case IDM_SCAN_FOLDER:
{
// Open folder picker dialog
// Call scan_folder function in a separate thread
std::string selectedFolder = getFolderPath(hWnd);
std::thread(scan_folder,hProgressBar, hWndTextField, selectedFolder).detach();
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
RECT rect;
GetClientRect(hWnd, &rect);
FillRect(hdc, &rect, hBackgroundBrush); // Fill the entire client area with white color
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
const wchar_t CLASS_NAME[] = L"Cyberhex endpoint protection frontend";
WNDCLASS wc = { };
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
HWND hWnd = CreateWindowEx(
0,
CLASS_NAME,
L"Cyberhex endpoint protection",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
NULL,
NULL,
hInstance,
NULL
);
if (hWnd == NULL) {
return 0;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

View File

@@ -0,0 +1,367 @@
#include <Windows.h>
#include <shlobj.h>
#include <thread>
#include <chrono>
#include <fstream>
#include <codecvt>
#include <locale>
#include "../client_backend/well_known.h"
#define IDM_SCAN_FILE 101
#define IDM_SCAN_FOLDER 102
std::wstring string_to_widestring(const std::string& str) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(str);
}
void send_command(const std::string& command) {
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << command;
outputFile.close();
}
}
// Function to update the content of the text field with the provided text
void update_textfield(HWND hWndTextField, const std::string& text) {
// Get the current text length
int textLength = GetWindowTextLength(hWndTextField);
// Set the selection to the end of the text field
SendMessage(hWndTextField, EM_SETSEL, textLength, textLength);
// Append the new text
SendMessage(hWndTextField, EM_REPLACESEL, FALSE, (LPARAM)string_to_widestring(text).c_str());
}
void scan_file(HWND hWndTextField, const std::string& filePath) {
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned file path in the window
update_textfield(hWndTextField, "Scanning file: " + filePath + "\r\n");
bool answered = false;
// Write command into com file
//printf("%d\n",send_to_pipe("scanfile \"" + filePath + "\""));
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfile \"" << filePath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
}
else {
answered = true;
update_textfield(hWndTextField, "Error: Unable to talk to daemon!\n");
update_textfield(hWndTextField, "------------------------------------------\n");
}
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(HWND hProgressBar,HWND hWndTextField, const std::string& folderPath) {
int num_of_found = 0;
// Remove the answer file
std::remove(ANSWER_COM_PATH);
// Display the scanned folder path in the window
update_textfield(hWndTextField, "Scanning folder: " + folderPath + "\r\n");
bool answered = false;
// Write command into com file
std::ofstream outputFile(MAIN_COM_PATH);
if (outputFile.is_open()) {
outputFile << "scanfolder \"" << folderPath << "\"";
outputFile.close();
}
else {
update_textfield(hWndTextField, "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) {
if (status == "found" || status == "not_found") {
inputFile.ignore(1); // Ignore space
inputFile.ignore(1); // Ignore starting double quote
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") {
update_textfield(hWndTextField, "Virus found in file: " + scannedFilePath + "\r\n");
update_textfield(hWndTextField, "File: " + scannedFilePath + " is infected\r\n");
update_textfield(hWndTextField, "Hash: " + hash + "\r\n");
update_textfield(hWndTextField, "Action taken: " + action + "\r\n");
num_of_found++;
}
else {
update_textfield(hWndTextField, "No virus found in file: " + scannedFilePath + "\r\n");
}
update_textfield(hWndTextField, "------------------------------------------\r\n");
}
else if (status == "progress") {
std::string progress;
inputFile.ignore(1); // Ignore space
inputFile >> progress;
SendMessage(hProgressBar, PBM_SETPOS, atoi(progress.c_str()), 0);
}
else if (status == "end")
answered = true;
}
}
inputFile.close();
Sleep(1000);//only see for new entrys ~ once a second
std::ofstream(ANSWER_COM_PATH);//clear the file
}
// Wait for 1 second before checking again
std::this_thread::sleep_for(std::chrono::seconds(1));
}
update_textfield(hWndTextField, "Folder scan completed\r\n");
update_textfield(hWndTextField, "Number of infected files: " + std::to_string(num_of_found) + "\r\n");
// Remove the answer file
std::remove(ANSWER_COM_PATH);
}
std::string getFolderPath(HWND hWnd) {
std::wstring selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = hWnd; // Set the owner window
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 = selectedPath;
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return std::string(selectedFolderPath.begin(), selectedFolderPath.end());
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
static HWND hWndTextField;
static HWND hProgressBar;
static HBRUSH hBackgroundBrush = CreateSolidBrush(RGB(255, 255, 255)); // White color
RECT rect;
GetClientRect(hWnd, &rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
switch (message) {
case WM_CREATE:
{
// Create the "Scan File" button
CreateWindowEx(NULL, L"BUTTON", L"Scan File",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 10, 100, 30, hWnd, (HMENU)IDM_SCAN_FILE, GetModuleHandle(NULL), NULL);
// Create the "Scan Folder" button
CreateWindowEx(NULL, L"BUTTON", L"Scan Folder",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
20, 50, 100, 30, hWnd, (HMENU)IDM_SCAN_FOLDER, GetModuleHandle(NULL), NULL);
// Create a multi-line edit control for displaying text
hWndTextField = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY,
140, 10, width-140-20, height-10-50, hWnd, NULL, NULL, NULL);
update_textfield(hWndTextField, "Welcome to Cyberhex endpoint protection!\r\n");
hProgressBar = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
140, height-40, 200, 20, hWnd, NULL, NULL, NULL);
SendMessage(hProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
SendMessage(hProgressBar, PBM_SETSTEP, 1, 0);
}
break;
case WM_SIZE:
{
// Resize the text field to fit the window
MoveWindow(hWndTextField, 140, 10, width - 140 - 20, height - 10 - 50, TRUE);
MoveWindow(hProgressBar, 140, height - 40, 200, 20, TRUE);
break;
}
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId) {
case IDM_SCAN_FILE:
{
// Open file dialog to select a file
// Call scan_file function in a separate thread
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L""; // Use WCHAR for Unicode compatibility
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = L'\0'; // Use wide character constant L'\0'
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Use wide character string literal L""
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
std::wstring selectedFile = ofn.lpstrFile; // Use std::wstring for wide characters
std::string narrowSelectedFile(selectedFile.begin(), selectedFile.end());
std::thread(scan_file, hWndTextField, narrowSelectedFile).detach();
}
}
break;
case IDM_SCAN_FOLDER:
{
// Open folder picker dialog
// Call scan_folder function in a separate thread
std::string selectedFolder = getFolderPath(hWnd);
std::thread(scan_folder,hProgressBar, hWndTextField, selectedFolder).detach();
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
RECT rect;
GetClientRect(hWnd, &rect);
FillRect(hdc, &rect, hBackgroundBrush); // Fill the entire client area with white color
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
const wchar_t CLASS_NAME[] = L"Cyberhex endpoint protection frontend";
WNDCLASS wc = { };
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
HWND hWnd = CreateWindowEx(
0,
CLASS_NAME,
L"Cyberhex endpoint protection",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
NULL,
NULL,
hInstance,
NULL
);
if (hWnd == NULL) {
return 0;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34 VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{644C9824-2298-46C6-9A62-7E080C98A0BB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,19 +13,19 @@ Global
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.ActiveCfg = Debug|x64 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Debug|x64.ActiveCfg = Debug|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.Build.0 = Debug|x64 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Debug|x64.Build.0 = Debug|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.ActiveCfg = Debug|Win32 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Debug|x86.ActiveCfg = Debug|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.Build.0 = Debug|Win32 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Debug|x86.Build.0 = Debug|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.ActiveCfg = Release|x64 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Release|x64.ActiveCfg = Release|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.Build.0 = Release|x64 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Release|x64.Build.0 = Release|x64
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.ActiveCfg = Release|Win32 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Release|x86.ActiveCfg = Release|Win32
{644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.Build.0 = Release|Win32 {4A82AA44-A521-4B6B-99F1-F8F32D7AC57B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F67EF8DC-E0C4-4EE3-9BBA-D7BD7AC687A9} SolutionGuid = {47A5DC0C-22B2-47B0-8C56-FB80E8C063AE}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<ProjectGuid>{644c9824-2298-46c6-9a62-7e080c98a0bb}</ProjectGuid> <ProjectGuid>{4a82aa44-a521-4b6b-99f1-f8f32d7ac57b}</ProjectGuid>
<RootNamespace>clientfrontend</RootNamespace> <RootNamespace>clientfrontend</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
@@ -127,18 +127,13 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="choose_element.h" />
<ClInclude Include="client_frontend.h" /> <ClInclude Include="client_frontend.h" />
<ClInclude Include="framework.h" /> <ClInclude Include="framework.h" />
<ClInclude Include="id.h" />
<ClInclude Include="Resource.h" /> <ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
<ClInclude Include="ui.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="choose_element.cpp" />
<ClCompile Include="client_frontend.cpp" /> <ClCompile Include="client_frontend.cpp" />
<ClCompile Include="ui.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="client_frontend.rc" /> <ResourceCompile Include="client_frontend.rc" />

View File

@@ -27,26 +27,11 @@
<ClInclude Include="client_frontend.h"> <ClInclude Include="client_frontend.h">
<Filter>Headerdateien</Filter> <Filter>Headerdateien</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ui.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="id.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="choose_element.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="client_frontend.cpp"> <ClCompile Include="client_frontend.cpp">
<Filter>Quelldateien</Filter> <Filter>Quelldateien</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ui.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
<ClCompile Include="choose_element.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="client_frontend.rc"> <ResourceCompile Include="client_frontend.rc">

View File

@@ -1,2 +1 @@
 ui.cpp  client_frontend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe
client_frontend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe

View File

@@ -1,3 +1 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\choose_element.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\choose_element.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.obj C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\ui.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\ui.obj

View File

@@ -1,2 +1,2 @@
^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CHOOSE_ELEMENT.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.RES|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\UI.OBJ ^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.RES
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.ilk C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.ilk

View File

@@ -1,8 +0,0 @@
#pragma once
#define ID_HOME_BUTTON 0
#define ID_STARTUP_BUTTON 1
#define ID_SCAN_FILE_BUTTON 2
#define ID_SCAN_FOLDER_BUTTON 3
#define ID_SETTINGS_BUTTON 4
#define ID_WELCOME_TEXT 1000

View File

@@ -1,95 +0,0 @@
#include "ui.h"
#include "id.h"
#include <windows.h>
#include "choose_element.h"
HWND hwnd_[100];
int num_hwnd = 0;
void draw_main_page(int window_width, int window_height, HWND hwnd);
void draw_scan_file_page(int window_width, int window_height, HWND hwnd);
void ui_display_page(int page_id,int window_width, int window_height, HWND hwnd) {
//create one button in middle of screen
//hwnd_[num_hwnd] = CreateWindowW(L"BUTTON", L"OK", WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,(window_width-50)/2,(window_height-15)/2, 100, 30, hwnd, (HMENU)ID_STARTUP_BUTTON, NULL, NULL);
//num_hwnd++;
switch (page_id) {
case 0: //main page
draw_main_page(window_width,window_height,hwnd);
break;
case 1: //scan file page
draw_scan_file_page(window_width, window_height, hwnd);
break;
}
}
void ui_clear() {
//clear all windows
for (int i = 0; i < num_hwnd; i++) {
if (hwnd_[i] != NULL) {
DestroyWindow(hwnd_[i]);
}
}
num_hwnd = 0;
}
void draw_main_page(int window_width, int window_height, HWND hwnd) {
//draw main page
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
L"Welcome to cyberhex\r\n\r\nPlease select an option:\r\n\r\n",
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd]= CreateWindow(L"BUTTON",
L"Scan a file",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(window_width)/4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FILE_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Scan a folder",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(2* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FOLDER_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Settings",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(3* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SETTINGS_BUTTON, NULL, NULL);
num_hwnd++;
}
void draw_scan_file_page(int window_width, int window_height, HWND hwnd) {
//draw scan file page
std::wstring message = L"File to scan: ";
std::wstring path=open_file(hwnd);
if (path == L"cancel") {
ui_clear();
ui_display_page(0, window_width, window_height, hwnd);
return;
}
message += path;
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
message.c_str(),
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Home",
WS_VISIBLE | WS_CHILD | WS_BORDER,
10, window_height - 50, 200, 30,
hwnd, (HMENU)ID_HOME_BUTTON, NULL, NULL);
num_hwnd++;
}
void update_scan_results(int window_width, int window_height, HWND hwnd,std::wstring& message) {
//draw scan results
//get value from the text field of draw_scan_file_page
//add to thetextfield the string message
}

View File

@@ -1,4 +0,0 @@
#pragma once
#include <Windows.h>
void ui_display_page(int page_id, int window_width, int window_height, HWND hwnd);
void ui_clear();

View File

@@ -6,14 +6,6 @@
"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}", "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}" "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:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\connect.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:connect.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"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\\connect.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:connect.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}" "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}"
} }
@@ -25,35 +17,11 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 3, "SelectedChildIndex": 1,
"Children": [ "Children": [
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 1, "DocumentIndex": 1,
"Title": "connect.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\connect.cpp",
"RelativeDocumentMoniker": "connect.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\connect.cpp",
"RelativeToolTip": "connect.cpp",
"ViewState": "AQIAACEAAAAAAAAAAAAIwC0AAAArAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-19T18:03:49.536Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "connect.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\connect.h",
"RelativeDocumentMoniker": "connect.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\connect.h",
"RelativeToolTip": "connect.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAcAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-19T18:03:42.761Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"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": "..\\client_backend\\well_known.h", "RelativeDocumentMoniker": "..\\client_backend\\well_known.h",
@@ -71,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": "AQIAAGYAAAAAAAAAAAAAAJEAAAA0AAAA", "ViewState": "AQIAAGwAAAAAAAAAAAAAAJYAAAABAAAA",
"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

@@ -1,2 +1 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\connect.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\connect.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\main.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\main.obj C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\main.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\main.obj

View File

@@ -1,2 +1,2 @@
^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND_GUILITE\CLIENT_F.C434E5CA\X64\DEBUG\CONNECT.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND_GUILITE\CLIENT_F.C434E5CA\X64\DEBUG\MAIN.OBJ ^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND_GUILITE\CLIENT_F.C434E5CA\X64\DEBUG\MAIN.OBJ
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\client_frontend_guilite.ilk C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\client_frontend_guilite.ilk

View File

@@ -4,5 +4,6 @@ C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(1
C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\include\GLFW\glfw3.h(123,1): C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\include\GLFW\glfw3.h(123,1):
Siehe vorherige Definition von "APIENTRY" Siehe vorherige Definition von "APIENTRY"
LINK : warning LNK4044: Nicht erkannte Option /lOpenGL; wird ignoriert.
LINK : warning LNK4044: Nicht erkannte Option /lOpenGL; wird ignoriert. LINK : warning LNK4044: Nicht erkannte Option /lOpenGL; wird ignoriert.
client_frontend_guilite.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\client_frontend_guilite.exe client_frontend_guilite.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\client_frontend_guilite.exe

View File

@@ -134,12 +134,8 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="connect.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="connect.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -18,13 +18,5 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Quelldateien</Filter> <Filter>Quelldateien</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="connect.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="connect.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,64 +0,0 @@
#pragma warning(disable:4996)
#ifndef CONNECT_CPP
#define CONNECT_CPP
#include <Windows.h>
#include <string>
#include <fstream>
#include "../client_backend/well_known.h"
int send_to_pipe(const std::string& message) {
HANDLE hPipe;
DWORD dwWritten;
std::ofstream (MAIN_COM_PATH);//enshure the file exists
hPipe = CreateFile(TEXT(MAIN_COM_PATH),
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hPipe != INVALID_HANDLE_VALUE) {
if (WriteFile(hPipe,
message.c_str(),
static_cast<DWORD>(message.size()), // Size of the message
&dwWritten,
NULL)) {
CloseHandle(hPipe);
return 0; // Success
}
else {
// Failed to write to pipe
CloseHandle(hPipe);
return 2; // Error writing to pipe
}
}
else {
// Failed to open pipe
DWORD dwError = GetLastError();
return dwError; // Return the error code
}
}
std::string read_from_pipe() {
HANDLE hPipe;
DWORD dwRead;
DWORD dwWritten;
char buffer[1000];
hPipe = CreateFile(TEXT(MAIN_COM_PATH),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hPipe != INVALID_HANDLE_VALUE)
{
ReadFile(hPipe, buffer, sizeof(buffer), &dwRead, NULL);
CloseHandle(hPipe);
buffer[strlen(buffer) + 1] = '\0';
return std::string(buffer);
}
else {
return "Error";
}
}
#endif

View File

@@ -1,10 +0,0 @@
#pragma once
#include <iostream>
#include <iomanip>
#include <sstream>
#include <locale>
#include <string>
#include <curl/curl.h>
int send_to_pipe(const std::string& message);
std::string read_from_pipe();

View File

@@ -10,7 +10,6 @@
#include <fstream> #include <fstream>
#include "../client_backend/well_known.h" #include "../client_backend/well_known.h"
#include "connect.h"
// Function to simulate file scanning // Function to simulate file scanning
void scan_file(nanogui::Screen* screen, nanogui::Widget* contentWidget, const std::string& filePath) { void scan_file(nanogui::Screen* screen, nanogui::Widget* contentWidget, const std::string& filePath) {
// Remove the answer file // Remove the answer file
@@ -61,7 +60,6 @@ void scan_file(nanogui::Screen* screen, nanogui::Widget* contentWidget, const st
} }
else { else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n"); 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, "------------------------------------------"); nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout(); screen->performLayout();
@@ -133,7 +131,6 @@ void scan_folder(nanogui::Screen* screen, nanogui::Widget* contentWidget, const
} }
else { else {
nanogui::Label* lineLabel7 = new nanogui::Label(contentWidget, "No virus found in file: " + scannedFilePath + "\n"); 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, "------------------------------------------"); nanogui::Label* lineLabel9 = new nanogui::Label(contentWidget, "------------------------------------------");
screen->performLayout(); screen->performLayout();