diff --git a/src/client_backend/.vs/client_backend/v17/.suo b/src/client_backend/.vs/client_backend/v17/.suo index 27dcce4..ae0ce25 100644 Binary files a/src/client_backend/.vs/client_backend/v17/.suo and b/src/client_backend/.vs/client_backend/v17/.suo differ diff --git a/src/client_backend/.vs/client_backend/v17/Browse.VC.db b/src/client_backend/.vs/client_backend/v17/Browse.VC.db index 6032572..d5bce78 100644 Binary files a/src/client_backend/.vs/client_backend/v17/Browse.VC.db and b/src/client_backend/.vs/client_backend/v17/Browse.VC.db differ diff --git a/src/client_backend/.vs/client_backend/v17/DocumentLayout.json b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json index 6712d30..9aef536 100644 --- a/src/client_backend/.vs/client_backend/v17/DocumentLayout.json +++ b/src/client_backend/.vs/client_backend/v17/DocumentLayout.json @@ -2,22 +2,54 @@ "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\\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\\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\\deepscan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:deepscan.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:client_backend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\zip.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:zip.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_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\\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\\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}" + }, { "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\\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\\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}" @@ -38,10 +70,6 @@ "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:deepscan.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}", - "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\\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}" @@ -50,34 +78,14 @@ "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\\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\\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\\zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:zip.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, { "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:security.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" @@ -102,10 +110,6 @@ "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\app_ctrl.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|solutionrelative:app_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\\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}" @@ -121,10 +125,6 @@ { "AbsoluteMoniker": "D:0:0:{56E65283-AAC9-43F6-9613-72BE8D648AC4}|client_backend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\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\\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": [ @@ -134,36 +134,37 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 26, + "SelectedChildIndex": 0, "Children": [ { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 0, "Title": "deepscan.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.cpp", "RelativeDocumentMoniker": "deepscan.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.cpp", "RelativeToolTip": "deepscan.cpp", - "ViewState": "AQIAAG8AAAAAAAAAAAAAAJIAAAAuAAAA", + "ViewState": "AQIAANAAAAAAAAAAAAAqwPoAAAA6AAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-03-31T08:30:41.528Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 16, + "DocumentIndex": 1, "Title": "zip.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp", "RelativeDocumentMoniker": "zip.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.cpp", "RelativeToolTip": "zip.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAD0AAAABAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAARAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-29T07:57:04.198Z" + "WhenOpened": "2024-03-29T07:57:04.198Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 19, + "DocumentIndex": 21, "Title": "security.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.h", "RelativeDocumentMoniker": "security.h", @@ -175,19 +176,20 @@ }, { "$type": "Document", - "DocumentIndex": 18, + "DocumentIndex": 2, "Title": "security.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp", "RelativeDocumentMoniker": "security.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\security.cpp", "RelativeToolTip": "security.cpp", - "ViewState": "AQIAAC4AAAAAAAAAAAAawD0AAAA0AAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-29T07:05:00.157Z" + "WhenOpened": "2024-03-29T07:05:00.157Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 20, + "DocumentIndex": 22, "Title": "md5hash.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\md5hash.cpp", "RelativeDocumentMoniker": "md5hash.cpp", @@ -199,7 +201,7 @@ }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 12, "Title": "scan.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\scan.h", "RelativeDocumentMoniker": "scan.h", @@ -211,19 +213,19 @@ }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 10, "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": "AQIAAG8AAAAAAAAAAAAawHQAAAAAAAAA", + "ViewState": "AQIAACEBAAAAAAAAAAAawD0BAABxAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-01-28T20:40:06.248Z" }, { "$type": "Document", - "DocumentIndex": 26, + "DocumentIndex": 27, "Title": "connect.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.cpp", "RelativeDocumentMoniker": "connect.cpp", @@ -235,19 +237,20 @@ }, { "$type": "Document", - "DocumentIndex": 9, + "DocumentIndex": 3, "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": "AQIAAEUAAAAAAAAAAAAAAHIAAAACAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAAvAQAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.279Z" + "WhenOpened": "2024-01-28T20:40:06.279Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 13, "Title": "thread_ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\thread_ctrl.cpp", "RelativeDocumentMoniker": "thread_ctrl.cpp", @@ -259,55 +262,55 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 14, "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": "AQIAAAMAAAAAAAAAAAAAAAsAAAAXAAAA", + "ViewState": "AQIAAAEAAAAAAAAAAABBwAsAAAAXAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-03-17T16:34:14.678Z" }, { "$type": "Document", - "DocumentIndex": 25, + "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": "AQIAAFQAAAAAAAAAAAAAACoAAAAAAAAA", + "ViewState": "AQIAADgAAAAAAAAAAAAawFkAAAAtAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-02-18T12:49:41.861Z" }, { "$type": "Document", - "DocumentIndex": 30, + "DocumentIndex": 9, "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", + "ViewState": "AQIAAAsAAAAAAAAAAAAAABAAAAAWAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "WhenOpened": "2024-03-13T06:45:51.845Z" }, { "$type": "Document", - "DocumentIndex": 10, + "DocumentIndex": 17, "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": "AQIAAJYAAAAAAAAAAAAAAMEAAABnAAAA", + "ViewState": "AQIAAJQAAAAAAAAAAABBwMEAAABnAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-03-14T15:55:22.469Z" }, { "$type": "Document", - "DocumentIndex": 24, + "DocumentIndex": 26, "Title": "app_ctrl.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\app_ctrl.h", "RelativeDocumentMoniker": "app_ctrl.h", @@ -319,7 +322,7 @@ }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 15, "Title": "local_com.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\local_com.h", "RelativeDocumentMoniker": "local_com.h", @@ -331,43 +334,44 @@ }, { "$type": "Document", - "DocumentIndex": 11, + "DocumentIndex": 18, "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": "AQIAAAYAAAAAAAAAAAAAADAAAABQAAAA", + "ViewState": "AQIAAAQAAAAAAAAAAABBwDAAAABQAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-03-13T06:48:31.009Z" }, { "$type": "Document", - "DocumentIndex": 21, + "DocumentIndex": 23, "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": "AQIAABgAAAAAAAAAAAAAAD0AAAA1AAAA", + "ViewState": "AQIAABYAAAAAAAAAAABBwD0AAAA1AAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-03-13T06:48:40.364Z" }, { "$type": "Document", - "DocumentIndex": 14, + "DocumentIndex": 4, "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": "AQIAAAgAAAAAAAAAAAAawC4AAAAZAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAADcAAABBAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2024-03-14T13:20:06.953Z" + "WhenOpened": "2024-03-14T13:20:06.953Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 15, + "DocumentIndex": 20, "Title": "update.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\update.h", "RelativeDocumentMoniker": "update.h", @@ -379,7 +383,7 @@ }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 11, "Title": "queue _ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue _ctrl.cpp", "RelativeDocumentMoniker": "queue _ctrl.cpp", @@ -387,12 +391,11 @@ "RelativeToolTip": "queue _ctrl.cpp", "ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAArAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-01-28T20:40:06.295Z", - "EditorCaption": "" + "WhenOpened": "2024-01-28T20:40:06.295Z" }, { "$type": "Document", - "DocumentIndex": 29, + "DocumentIndex": 30, "Title": "queue_ctrl.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\queue_ctrl.h", "RelativeDocumentMoniker": "queue_ctrl.h", @@ -404,7 +407,7 @@ }, { "$type": "Document", - "DocumentIndex": 27, + "DocumentIndex": 28, "Title": "connect.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\connect.h", "RelativeDocumentMoniker": "connect.h", @@ -416,19 +419,20 @@ }, { "$type": "Document", - "DocumentIndex": 12, + "DocumentIndex": 7, "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": "AQIAAAwAAAAAAAAAAAAAADoAAABhAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAsAAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2024-03-14T13:35:33.369Z" + "WhenOpened": "2024-03-14T13:35:33.369Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 13, + "DocumentIndex": 19, "Title": "utils.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\utils.h", "RelativeDocumentMoniker": "utils.h", @@ -440,32 +444,33 @@ }, { "$type": "Document", - "DocumentIndex": 17, + "DocumentIndex": 6, "Title": "zip.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.h", "RelativeDocumentMoniker": "zip.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\zip.h", "RelativeToolTip": "zip.h", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAARAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAIAAAA/AAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2024-03-29T07:57:13.208Z" + "WhenOpened": "2024-03-29T07:57:13.208Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 5, "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": "AQIAACcAAAAAAAAAAAAAAEoAAAAkAAAA", + "ViewState": "AQIAAAYAAAAAAAAAAAAAAGsAAAABAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-01-28T20:40:06.248Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 16, "Title": "deepscan.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\deepscan.h", "RelativeDocumentMoniker": "deepscan.h", @@ -477,7 +482,7 @@ }, { "$type": "Document", - "DocumentIndex": 28, + "DocumentIndex": 29, "Title": "settings.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\settings.h", "RelativeDocumentMoniker": "settings.h", @@ -489,7 +494,7 @@ }, { "$type": "Document", - "DocumentIndex": 23, + "DocumentIndex": 25, "Title": "app_ctrl.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\app_ctrl.cpp", "RelativeDocumentMoniker": "app_ctrl.cpp", @@ -501,13 +506,13 @@ }, { "$type": "Document", - "DocumentIndex": 22, + "DocumentIndex": 24, "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": "AQIAAEUAAAAAAAAAAAAAAE4AAAAKAAAA", + "ViewState": "AQIAAEMAAAAAAAAAAABBwE4AAAAKAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2024-01-28T20:40:06.279Z" } diff --git a/src/client_backend/client_backend.cpp b/src/client_backend/client_backend.cpp index a42384c..63a7e45 100644 --- a/src/client_backend/client_backend.cpp +++ b/src/client_backend/client_backend.cpp @@ -1,3 +1,10 @@ +/* +This file is the main file for the client backend. It is responsible for starting the main thread and initializing all the other threads and functions. It also contains the main loop for the main thread which checks for tasks from the user interface, scheduled tasks, and tasks from the queue. It also initializes the hash databases, the yara rules, and the real-time protection threads. The main thread will run until the app_stop() function returns true, which is set by the user interface when the user wants to stop the application. + +Functions: +- main(): The main function of the client backend. It initializes the hash databases, yara rules, and real-time protection threads. It then enters a loop where it checks for tasks from the user interface, scheduled tasks, and tasks from the queue. It will run until the app_stop() function returns true. +*/ + #pragma warning(disable:4996) #include #include diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.ilk b/src/client_backend/client_backend/x64/Debug/client_backend.ilk index e663733..e97ef83 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.ilk and b/src/client_backend/client_backend/x64/Debug/client_backend.ilk differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.log b/src/client_backend/client_backend/x64/Debug/client_backend.log index 648c73e..08bd94f 100644 --- a/src/client_backend/client_backend/x64/Debug/client_backend.log +++ b/src/client_backend/client_backend/x64/Debug/client_backend.log @@ -1,2 +1,3 @@  Quellen werden auf Modulabhängigkeiten überprüft... client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe +C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\vcpkg.targets(228,5): warning : [vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: -ExecutionPolicy Bypass -noprofile -File "C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\applocal.ps1" "C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe" "C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\debug\bin" "client_backend\x64\Debug\client_backend.tlog\client_backend.write.1u.tlog" "client_backend\x64\Debug\vcpkg.applocal.log" diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog index 44d43aa..e85c371 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.command.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog index 2c28f3e..b0371bf 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.read.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog index 1c1943f..dafa1d0 100644 Binary files a/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog and b/src/client_backend/client_backend/x64/Debug/client_backend.tlog/CL.write.1.tlog differ diff --git a/src/client_backend/client_backend/x64/Debug/vc143.idb b/src/client_backend/client_backend/x64/Debug/vc143.idb index 4bfb7ea..fab2b50 100644 Binary files a/src/client_backend/client_backend/x64/Debug/vc143.idb and b/src/client_backend/client_backend/x64/Debug/vc143.idb differ diff --git a/src/client_backend/client_backend/x64/Debug/vc143.pdb b/src/client_backend/client_backend/x64/Debug/vc143.pdb index b36d331..f876e63 100644 Binary files a/src/client_backend/client_backend/x64/Debug/vc143.pdb and b/src/client_backend/client_backend/x64/Debug/vc143.pdb differ diff --git a/src/client_backend/deepscan.cpp b/src/client_backend/deepscan.cpp index 76e55ac..4863309 100644 --- a/src/client_backend/deepscan.cpp +++ b/src/client_backend/deepscan.cpp @@ -1,3 +1,17 @@ +/* +This is the deepscan.cpp file. This file contains the implementation of the deepscan functions + +Functions: +- load_yara_rules(): This function loads the YARA rules from a file and compiles them. +- init_yara_rules(): This function initializes the YARA rules by loading them from a folder. +- deepscan_folder(): This function scans all the files in a folder recursively. +- deepscan_file_t(): This function scans a single file using YARA rules. +- action_deepscanfolder(): This function is the action function for deepscanfolder. +- action_deepscanfile(): This function is the action function for deepscanfile. + + +*/ + #include "deepscan.h" #include "virus_ctrl.h" #include "md5hash.h" @@ -192,6 +206,7 @@ int process_callback(YR_SCAN_CONTEXT* context,int message, void* message_data, v } return CALLBACK_CONTINUE; } +/* bool deepscan_file_t(const std::string&file_path) { set_num_threads(get_num_threads() + 1); //we do not need to make a new instance of yara rules, because they are global and do not get deteled or modified @@ -212,6 +227,42 @@ bool deepscan_file_t(const std::string&file_path) { } return true; } +*/ +bool deepscan_file_t(const std::string& file_path) { + set_num_threads(get_num_threads() + 1); + // we do not need to make a new instance of yara rules, because they are global and do not get deleted or modified + thread_local std::string file_path_(file_path); + // first we scan the file with the normal scanner, which means md5 + thread_local std::string hash(md5_file_t(file_path)); + thread_local char* db_path = new char[300]; + + sprintf_s(db_path, 295, "%s\\%c%c.jdbf", DB_DIR, hash[0], hash[1]); + if (search_hash(db_path, hash, file_path) != 1) { // if we already found a match in the database, we do not need to scan the file with yara + // Load file into memory + std::ifstream file_stream(file_path, std::ios::binary | std::ios::ate); + if (!file_stream.is_open()) { + // handle error if file cannot be opened + return false; + } + std::streamsize file_size = file_stream.tellg(); + file_stream.seekg(0, std::ios::beg); + std::vector file_content(file_size); + if (!file_stream.read(file_content.data(), file_size)) { + // handle error if file content cannot be read + return false; + } + file_stream.close(); + + // get globally set yara rules and iterate over them + Callback_data* callback_data = new Callback_data(); + for (YR_RULES* rule : compiled_rules) { + callback_data->filepath = file_path_; + yr_rules_scan_mem(rule, reinterpret_cast(file_content.data()), file_content.size(), 0, process_callback, callback_data, 5000); + } + set_num_threads(get_num_threads() - 1); + } + return true; +} void action_deepscanfolder(const std::string& folderpath) { thread_init(); diff --git a/src/client_backend/security.cpp b/src/client_backend/security.cpp index 62761bb..df074b6 100644 --- a/src/client_backend/security.cpp +++ b/src/client_backend/security.cpp @@ -1,3 +1,14 @@ +/* +This file contains the implementation of the security functions. + +Functions: +- check_cert(): This function checks if the certificate is valid. +- get_apikey(): This function returns the API key. +- get_machineid(): This function returns the machine ID. +- selfcheck(): This function checks if the files have been tampered with. + +*/ + #include "security.h" #include // Include the mutex header #include // Include the string header diff --git a/src/client_backend/x64/Debug/client_backend.pdb b/src/client_backend/x64/Debug/client_backend.pdb index c28dd39..170d032 100644 Binary files a/src/client_backend/x64/Debug/client_backend.pdb and b/src/client_backend/x64/Debug/client_backend.pdb differ diff --git a/src/client_backend/zip.cpp b/src/client_backend/zip.cpp index 3500076..2470621 100644 --- a/src/client_backend/zip.cpp +++ b/src/client_backend/zip.cpp @@ -1,10 +1,19 @@ +/* +This file includes the unzip function which is used to unzip files. The function uses the IShellDispatch interface to interact with the Windows Shell and extract the contents of a ZIP file to a specified destination folder. The function takes two parameters: the source ZIP file path and the destination folder path where the contents will be extracted. + +Functions: +- unzip(): This function extracts the contents of a ZIP file to a specified destination folder using the IShellDispatch interface. It takes two parameters: the source ZIP file path and the destination folder path. + +Code copied from: +- https://vcpptips.wordpress.com/2013/10/28/how-to-zipunzip-files/ +*/ + #include "zip.h" #include #include #include #include #include -//thanks https://vcpptips.wordpress.com/2013/10/28/how-to-zipunzip-files/ void unzip(const std::string& source, const std::string& dest) { diff --git a/src/ma_installer/.vs/ma_installer/FileContentIndex/a9928a98-d3ff-4e17-b270-e9c8ff57ac65.vsidx b/src/ma_installer/.vs/ma_installer/FileContentIndex/a9928a98-d3ff-4e17-b270-e9c8ff57ac65.vsidx deleted file mode 100644 index 4a4a594..0000000 Binary files a/src/ma_installer/.vs/ma_installer/FileContentIndex/a9928a98-d3ff-4e17-b270-e9c8ff57ac65.vsidx and /dev/null differ diff --git a/src/ma_installer/.vs/ma_installer/FileContentIndex/cc03696b-4b72-475b-a0e5-a0228cc1300c.vsidx b/src/ma_installer/.vs/ma_installer/FileContentIndex/cc03696b-4b72-475b-a0e5-a0228cc1300c.vsidx deleted file mode 100644 index e541381..0000000 Binary files a/src/ma_installer/.vs/ma_installer/FileContentIndex/cc03696b-4b72-475b-a0e5-a0228cc1300c.vsidx and /dev/null differ diff --git a/src/ma_installer/.vs/ma_installer/v17/.suo b/src/ma_installer/.vs/ma_installer/v17/.suo index 459427b..9a0bfb4 100644 Binary files a/src/ma_installer/.vs/ma_installer/v17/.suo and b/src/ma_installer/.vs/ma_installer/v17/.suo differ diff --git a/src/ma_installer/.vs/ma_installer/v17/Browse.VC.db b/src/ma_installer/.vs/ma_installer/v17/Browse.VC.db index c997d44..15fa960 100644 Binary files a/src/ma_installer/.vs/ma_installer/v17/Browse.VC.db and b/src/ma_installer/.vs/ma_installer/v17/Browse.VC.db differ diff --git a/src/ma_installer/.vs/ma_installer/v17/DocumentLayout.json b/src/ma_installer/.vs/ma_installer/v17/DocumentLayout.json index e0b8cc0..70f8ade 100644 --- a/src/ma_installer/.vs/ma_installer/v17/DocumentLayout.json +++ b/src/ma_installer/.vs/ma_installer/v17/DocumentLayout.json @@ -7,16 +7,56 @@ "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:ma_installer.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, { - "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:download.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:create_folder.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:service.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:setup_var.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:update.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:zip.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:download.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:create_folder.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:service.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:setup_var.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:update.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, { "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:well_known.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, { - "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:download.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:zip.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{AAE7A550-D2C0-45AC-8C26-ED57DF20BFC3}|ma_installer.vcxproj|solutionrelative:download.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" } ], "DocumentGroupContainers": [ @@ -26,35 +66,161 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 3, + "SelectedChildIndex": 13, "Children": [ + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "create_folder.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.h", + "RelativeDocumentMoniker": "create_folder.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.h", + "RelativeToolTip": "create_folder.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAAUAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-04-04T15:28:46.78Z" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "create_folder.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.cpp", + "RelativeDocumentMoniker": "create_folder.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\create_folder.cpp", + "RelativeToolTip": "create_folder.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAABFAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-04-04T15:28:38.27Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "service.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.h", + "RelativeDocumentMoniker": "service.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.h", + "RelativeToolTip": "service.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAASAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-04-04T15:26:27.978Z" + }, { "$type": "Document", "DocumentIndex": 2, + "Title": "service.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.cpp", + "RelativeDocumentMoniker": "service.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\service.cpp", + "RelativeToolTip": "service.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAABvAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-04-04T15:26:20.564Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "setup_var.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.h", + "RelativeDocumentMoniker": "setup_var.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.h", + "RelativeToolTip": "setup_var.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAArAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-04-04T15:23:38.898Z" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "setup_var.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.cpp", + "RelativeDocumentMoniker": "setup_var.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\setup_var.cpp", + "RelativeToolTip": "setup_var.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAcAAAAfAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-04-04T15:23:26.149Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 10, + "Title": "update.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.h", + "RelativeDocumentMoniker": "update.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.h", + "RelativeToolTip": "update.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAARAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-04-04T15:21:36.65Z" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "update.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.cpp", + "RelativeDocumentMoniker": "update.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\update.cpp", + "RelativeToolTip": "update.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAcAAABCAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-04-04T15:21:28.758Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 12, + "Title": "zip.h", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.h", + "RelativeDocumentMoniker": "zip.h", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.h", + "RelativeToolTip": "zip.h", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAMAAAA/AAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", + "WhenOpened": "2024-04-04T15:07:00.819Z" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "zip.cpp", + "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.cpp", + "RelativeDocumentMoniker": "zip.cpp", + "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\zip.cpp", + "RelativeToolTip": "zip.cpp", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAAA3AAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2024-04-04T15:06:51.493Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 11, "Title": "well_known.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\well_known.h", "RelativeDocumentMoniker": "well_known.h", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\well_known.h", "RelativeToolTip": "well_known.h", - "ViewState": "AQIAAAAAAAAAAAAAAAAAABoAAAAOAAAA", + "ViewState": "AQIAABAAAAAAAAAAAAAqwEgAAAAXAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", "WhenOpened": "2024-02-17T10:06:35.859Z" }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 6, "Title": "download.cpp", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.cpp", "RelativeDocumentMoniker": "download.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.cpp", "RelativeToolTip": "download.cpp", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAABAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAABRAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2023-12-22T19:47:31.583Z" + "WhenOpened": "2023-12-22T19:47:31.583Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 13, "Title": "download.h", "DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\download.h", "RelativeDocumentMoniker": "download.h", @@ -72,7 +238,7 @@ "RelativeDocumentMoniker": "ma_installer.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_installer\\ma_installer.cpp", "RelativeToolTip": "ma_installer.cpp", - "ViewState": "AQIAAPMCAAAAAAAAAAAAAB8DAABXAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABYAAAAUAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2023-12-22T18:52:51.74Z", "EditorCaption": "" diff --git a/src/ma_installer/.vs/ma_installer/v17/ipch/AutoPCH/d30ea52e71910fa3/MA_INSTALLER.ipch b/src/ma_installer/.vs/ma_installer/v17/ipch/AutoPCH/d30ea52e71910fa3/MA_INSTALLER.ipch index 01c43f2..2181bc8 100644 Binary files a/src/ma_installer/.vs/ma_installer/v17/ipch/AutoPCH/d30ea52e71910fa3/MA_INSTALLER.ipch and b/src/ma_installer/.vs/ma_installer/v17/ipch/AutoPCH/d30ea52e71910fa3/MA_INSTALLER.ipch differ diff --git a/src/ma_installer/create_folder.cpp b/src/ma_installer/create_folder.cpp new file mode 100644 index 0000000..49045f7 --- /dev/null +++ b/src/ma_installer/create_folder.cpp @@ -0,0 +1,283 @@ +/* +This file contains the functions to create a folder with a secure or insecure DACL, copy a file, and create a shortcut. + +Functions: + - create_dacl: Creates a DACL with secure permissions. + - create_insecure_dacl: Creates a DACL with insecure permissions. + - create_secure_folder: Creates a folder with a secure DACL. + - create_insecure_folder: Creates a folder with an insecure DACL. + - copy: Copies a file from the source path to the destination path. + - create_shortcut: Creates a shortcut to a target file with an icon. + +*/ + + +#include "create_folder.h" +#include +#include +#include // For CoInitialize and CoUninitialize +#include // For IPersistFile +#include // For InitPropVariantFromString +#include // For IShellLink +#include +#include // For PKEY_AppUserModel_ID +#include +#include +#include +BOOL create_dacl(SECURITY_ATTRIBUTES* pSA) +{ + // Define the SDDL for the DACL. This example sets + // the following access: + // Built-in guests are denied all access. + // Anonymous logon is denied all access. + // Authenticated users are allowed + // read/write/execute access. + // Administrators are allowed full control. + // Modify these values as needed to generate the proper + // DACL for your application. + const wchar_t* szSD = TEXT("D:") + TEXT("(D;OICI;GA;;;BG)") // Deny access to authenticated users + TEXT("(D;OICI;GA;;;AN)") // Deny access to authenticated users + //TEXT("(D;OICI;GA;;;AU)") // Deny access to authenticated users + TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtinadministrators + //TEXT("(A;OICI;GA;;;AA)"); // Allow full control to administrators + + + if (NULL == pSA) + return FALSE; + + return ConvertStringSecurityDescriptorToSecurityDescriptor( + szSD, + SDDL_REVISION_1, + &(pSA->lpSecurityDescriptor), + NULL); +} +BOOL create_insecure_dacl(SECURITY_ATTRIBUTES* pSA) +{ + // Define the SDDL for the DACL. This example sets + // the following access: + // Built-in guests are denied all access. + // Anonymous logon is denied all access. + // Authenticated users are allowed + // read/write/execute access. + // Administrators are allowed full control. + // Modify these values as needed to generate the proper + // DACL for your application. + const wchar_t* szSD = TEXT("D:") + TEXT("(D;OICI;GA;;;BG)") // Deny access to authenticated users + TEXT("(D;OICI;GA;;;AN)") // Deny access to authenticated users + TEXT("(A;OICI;GA;;;AU)") // Deny access to authenticated users + TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtinadministrators + //TEXT("(A;OICI;GA;;;AA)"); // Allow full control to administrators + + + if (NULL == pSA) + return FALSE; + + return ConvertStringSecurityDescriptorToSecurityDescriptor( + szSD, + SDDL_REVISION_1, + &(pSA->lpSecurityDescriptor), + NULL); +} +int create_secure_folder(LPCWSTR folderpath) { + int error = 0; + SECURITY_ATTRIBUTES sa; + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = FALSE;// objects are not inherited + + // Call function to set the DACL. The DACL + // is set in the SECURITY_ATTRIBUTES + // lpSecurityDescriptor member. + if (!create_dacl(&sa)) + { + // Error encountered; generate message and exit. + //printf("Failed to create access control list\n"); + error = 1; + } + + // Use the updated SECURITY_ATTRIBUTES to specify + // security attributes for securable objects. + // This example uses security attributes during + // creation of a new directory. + if (error == 0) { + if (0 == CreateDirectory(folderpath, &sa)) + { + // Error encountered; generate message and exit. + //could not create directory + error = 2; + } + } + // Free the memory allocated for the SECURITY_DESCRIPTOR. + if (error == 0) { + if (NULL != LocalFree(sa.lpSecurityDescriptor)) + { + // Error encountered; generate message and exit. + //printf("Failed to free the allocated memory\n"); + error = 3; + } + } + return error; +} +int create_insecure_folder(LPCWSTR folderpath) { + int error = 0; + SECURITY_ATTRIBUTES sa; + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = FALSE;// objects are not inherited + + // Call function to set the DACL. The DACL + // is set in the SECURITY_ATTRIBUTES + // lpSecurityDescriptor member. + if (!create_insecure_dacl(&sa)) + { + // Error encountered; generate message and exit. + //printf("Failed to create access control list\n"); + error = 1; + } + + // Use the updated SECURITY_ATTRIBUTES to specify + // security attributes for securable objects. + // This example uses security attributes during + // creation of a new directory. + if (error == 0) { + if (0 == CreateDirectory(folderpath, &sa)) + { + // Error encountered; generate message and exit. + //could not create directory + error = 2; + } + } + // Free the memory allocated for the SECURITY_DESCRIPTOR. + if (error == 0) { + if (NULL != LocalFree(sa.lpSecurityDescriptor)) + { + // Error encountered; generate message and exit. + //printf("Failed to free the allocated memory\n"); + error = 3; + } + } + return error; +} + + +int copy(const char* source_path, const char* destination_path) { + FILE* source_file, * destination_file; + char buffer[4096]; // Buffer to store data read from source file + + // Open source file for reading + if (fopen_s(&source_file, source_path, "rb") != 0) { + return 1; + } + + // Open destination file for writing + if (fopen_s(&destination_file, destination_path, "wb") != 0) { + fclose(source_file); + return 1; + } + + // Copy contents from source to destination + size_t bytes_read; + while ((bytes_read = fread(buffer, 1, sizeof(buffer), source_file)) > 0) { + fwrite(buffer, 1, bytes_read, destination_file); + } + + // Close files + fclose(source_file); + fclose(destination_file); + + + return 0; + +} + + +HRESULT create_shortcut(const wchar_t* targetPath, const wchar_t* shortcutPath, const wchar_t* iconPath) { + // Initialize the COM library + HRESULT hr = CoInitialize(NULL); + if (FAILED(hr)) { + return hr; + } + + // Create an instance of the ShellLink interface + IShellLink* pShellLink = NULL; + hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&pShellLink); + if (FAILED(hr)) { + CoUninitialize(); + return hr; + } + + // Set the path of the target file + pShellLink->SetPath(targetPath); + + // Query the IPropertyStore interface + IPropertyStore* pPropertyStore = NULL; + hr = pShellLink->QueryInterface(IID_IPropertyStore, (void**)&pPropertyStore); + if (FAILED(hr)) { + pShellLink->Release(); + CoUninitialize(); + return hr; + } + + // Load the icon file and set the System.Icon property + PROPVARIANT propvar; + hr = InitPropVariantFromString(iconPath, &propvar); + if (SUCCEEDED(hr)) { + hr = pPropertyStore->SetValue(PKEY_AppUserModel_ID, propvar); + if (SUCCEEDED(hr)) { + hr = pPropertyStore->Commit(); + if (FAILED(hr)) { + CoUninitialize(); + pPropertyStore->Release(); + pShellLink->Release(); + return hr; + } + } + else { + CoUninitialize(); + pPropertyStore->Release(); + pShellLink->Release(); + return hr; + } + PropVariantClear(&propvar); // Free memory allocated by InitPropVariantFromString + } + else { + CoUninitialize(); + pPropertyStore->Release(); + pShellLink->Release(); + return hr; + } + + // Release the IPropertyStore interface + pPropertyStore->Release(); + + // Query the IPersistFile interface + IPersistFile* pPersistFile = NULL; + hr = pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile); + if (FAILED(hr)) { + pShellLink->Release(); + CoUninitialize(); + return hr; + } + + // Save the shortcut to disk + hr = pPersistFile->Save(shortcutPath, TRUE); + if (FAILED(hr)) { + pPersistFile->Release(); + pShellLink->Release(); + CoUninitialize(); + return hr; + } + + // Release COM interfaces + pPersistFile->Release(); + pShellLink->Release(); + + // Uninitialize the COM library + CoUninitialize(); + + return S_OK; // Success +} + + diff --git a/src/ma_installer/create_folder.h b/src/ma_installer/create_folder.h new file mode 100644 index 0000000..036cd36 --- /dev/null +++ b/src/ma_installer/create_folder.h @@ -0,0 +1,8 @@ +#pragma once +#include +BOOL create_dacl(SECURITY_ATTRIBUTES* pSA); +BOOL create_insecure_dacl(SECURITY_ATTRIBUTES* pSA); +int create_secure_folder(LPCWSTR folderpath); +int create_insecure_folder(LPCWSTR folderpath); +int copy(const char* src, const char* dest); +HRESULT create_shortcut(const wchar_t* targetPath, const wchar_t* shortcutPath, const wchar_t* iconPath); \ No newline at end of file diff --git a/src/ma_installer/download.cpp b/src/ma_installer/download.cpp index 125ecb8..1b23659 100644 --- a/src/ma_installer/download.cpp +++ b/src/ma_installer/download.cpp @@ -1,3 +1,12 @@ +/* +This file is part of the download library. This library is used to download files from a server. + +Functions: + - download_file_from_srv: Downloads a file from a server and saves it to a file. + +*/ + + #pragma warning(disable:4996) #ifndef CONNECT_CPP #define CONNECT_CPP diff --git a/src/ma_installer/install.bat b/src/ma_installer/install.bat index d72fae5..94bf5a0 100644 --- a/src/ma_installer/install.bat +++ b/src/ma_installer/install.bat @@ -17,6 +17,6 @@ curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/msvcp140d.dl curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/vcruntime140d.dll curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/ucrtbased.dll curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/zlibd1.dll -curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/cyberhex_logo2.ico.dll +curl -O -L https://github.com/jakani24/cyberhex_bin_distro/raw/main/cyberhex_logo2.ico echo "Download finished, starting installer" start ma_installer.exe diff --git a/src/ma_installer/ma_installer.cpp b/src/ma_installer/ma_installer.cpp index 8e530b7..d9d04f2 100644 --- a/src/ma_installer/ma_installer.cpp +++ b/src/ma_installer/ma_installer.cpp @@ -1,5 +1,27 @@ -// ma_installer.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms. -// +/* +This is the main installer for the Cyberhex application. It creates the necessary folders, downloads the files from the server, and moves them to the correct folders. It also creates a shortcut on the desktop and starts the service. + +DO: +- create folder for application +- create folder for communication +- create folder for secure files +- create folder for database +- create folder for folder database +- create folder for settings +- create folder for quarantined files +- create folder for log files +- create folder for communication +- create folder for application +- create folder for yara +- download files from server +- create task +- download settings +- download databases +- move files into secure directorys +- create shortcut +- display error messages +- reboot the machine +*/ #define _WIN32_WINNT 0x0500 #include @@ -8,272 +30,25 @@ #include #include "download.h" #include "well_known.h" -#include -#include -#include // For CoInitialize and CoUninitialize -#include // For IPersistFile -#include // For InitPropVariantFromString -#include // For IShellLink +#include "zip.h" +#include "service.h" +#include "setup_var.h" +#include "update.h" +#include "create_folder.h" +#include +#include +#include +#include #include -#include // For PKEY_AppUserModel_ID - -/* -Tasks to do: -- launch as admin -- create secure folder -- download app files from server -- install app files -- create background service -- create folder for communication - -*/ -//create task thx chatgpt ;)#define _WIN32_DCOM - -#include -#include -#include +#include #include #include + #pragma comment(lib, "taskschd.lib") #pragma comment(lib, "comsupp.lib") using namespace std; -int create_task() -{ - HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - if (FAILED(hr)) - { - cout << "CoInitializeEx failed: " << hex << hr << endl; - return 1; - } - - hr = CoInitializeSecurity( - NULL, - -1, - NULL, - NULL, - RPC_C_AUTHN_LEVEL_PKT_PRIVACY, - RPC_C_IMP_LEVEL_IMPERSONATE, - NULL, - 0, - NULL); - - if (FAILED(hr)) - { - cout << "CoInitializeSecurity failed: " << hex << hr << endl; - CoUninitialize(); - return 1; - } - - LPCWSTR wszTaskName = L"CyberhexBackgroundTask"; - wstring wstrExecutablePath = L"c:\\program files\\cyberhex\\secure\\app\\cyberhex.exe"; - - ITaskService* pService = NULL; - hr = CoCreateInstance(CLSID_TaskScheduler, - NULL, - CLSCTX_INPROC_SERVER, - IID_ITaskService, - (void**)&pService); - if (FAILED(hr)) - { - cout << "Failed to create an instance of ITaskService: " << hex << hr << endl; - CoUninitialize(); - return 1; - } - - hr = pService->Connect(_variant_t(), _variant_t(), - _variant_t(), _variant_t()); - if (FAILED(hr)) - { - cout << "ITaskService::Connect failed: " << hex << hr << endl; - pService->Release(); - CoUninitialize(); - return 1; - } - - ITaskFolder* pRootFolder = NULL; - hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder); - if (FAILED(hr)) - { - cout << "Cannot get Root Folder pointer: " << hex << hr << endl; - pService->Release(); - CoUninitialize(); - return 1; - } - - pRootFolder->DeleteTask(_bstr_t(wszTaskName), 0); - - ITaskDefinition* pTask = NULL; - hr = pService->NewTask(0, &pTask); - - pService->Release(); - if (FAILED(hr)) - { - cout << "Failed to create a task definition: " << hex << hr << endl; - pRootFolder->Release(); - CoUninitialize(); - return 1; - } - - IPrincipal* pPrincipal = NULL; - hr = pTask->get_Principal(&pPrincipal); - if (FAILED(hr)) - { - cout << "Cannot get principal pointer: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_HIGHEST); - pPrincipal->Release(); - if (FAILED(hr)) - { - cout << "Cannot set highest privilege level: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - ITaskSettings* pSettings = NULL; - hr = pTask->get_Settings(&pSettings); - if (FAILED(hr)) - { - cout << "Cannot get settings pointer: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - hr = pSettings->put_ExecutionTimeLimit(_bstr_t(L"PT0S")); // Set execution time limit to zero seconds - pSettings->Release(); - if (FAILED(hr)) - { - cout << "Cannot set execution time limit: " << hex << hr << endl; - pRootFolder->Release(); - pService->Release(); - CoUninitialize(); - return 1; - } - - - hr = pSettings->put_DisallowStartIfOnBatteries(VARIANT_FALSE); // Set to allow start on batteries - pSettings->Release(); - if (FAILED(hr)) - { - cout << "Cannot set start on batteries: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - ITriggerCollection* pTriggerCollection = NULL; - hr = pTask->get_Triggers(&pTriggerCollection); - if (FAILED(hr)) - { - cout << "Cannot get trigger collection: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - ITrigger* pTrigger = NULL; - hr = pTriggerCollection->Create(TASK_TRIGGER_BOOT, &pTrigger); - pTriggerCollection->Release(); - if (FAILED(hr)) - { - cout << "Cannot create the trigger: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - IActionCollection* pActionCollection = NULL; - hr = pTask->get_Actions(&pActionCollection); - if (FAILED(hr)) - { - cout << "Cannot get Task collection pointer: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - IAction* pAction = NULL; - hr = pActionCollection->Create(TASK_ACTION_EXEC, &pAction); - pActionCollection->Release(); - if (FAILED(hr)) - { - cout << "Cannot create the action: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - IExecAction* pExecAction = NULL; - hr = pAction->QueryInterface( - IID_IExecAction, (void**)&pExecAction); - pAction->Release(); - if (FAILED(hr)) - { - cout << "QueryInterface call failed for IExecAction: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - hr = pExecAction->put_Path(_bstr_t(wstrExecutablePath.c_str())); - pExecAction->Release(); - if (FAILED(hr)) - { - cout << "Cannot set path of executable: " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - IRegisteredTask* pRegisteredTask = NULL; - VARIANT varPassword; - varPassword.vt = VT_EMPTY; - hr = pRootFolder->RegisterTaskDefinition( - _bstr_t(wszTaskName), - pTask, - TASK_CREATE_OR_UPDATE, - _variant_t(L"SYSTEM"), - varPassword, - TASK_LOGON_SERVICE_ACCOUNT, - _variant_t(L""), - &pRegisteredTask); - if (FAILED(hr)) - { - cout << "Error saving the Task : " << hex << hr << endl; - pRootFolder->Release(); - pTask->Release(); - CoUninitialize(); - return 1; - } - - cout << "Success! Task successfully registered." << endl; - - pRootFolder->Release(); - pTask->Release(); - pRegisteredTask->Release(); - CoUninitialize(); - return 0; -} - - - //check if programm is run as admin bool is_admin() { @@ -318,434 +93,6 @@ bool run_as_admin() { } return false; } -BOOL create_dacl(SECURITY_ATTRIBUTES* pSA) -{ - // Define the SDDL for the DACL. This example sets - // the following access: - // Built-in guests are denied all access. - // Anonymous logon is denied all access. - // Authenticated users are allowed - // read/write/execute access. - // Administrators are allowed full control. - // Modify these values as needed to generate the proper - // DACL for your application. - const wchar_t* szSD = TEXT("D:") - TEXT("(D;OICI;GA;;;BG)") // Deny access to authenticated users - TEXT("(D;OICI;GA;;;AN)") // Deny access to authenticated users - //TEXT("(D;OICI;GA;;;AU)") // Deny access to authenticated users - TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtinadministrators - //TEXT("(A;OICI;GA;;;AA)"); // Allow full control to administrators - - - if (NULL == pSA) - return FALSE; - - return ConvertStringSecurityDescriptorToSecurityDescriptor( - szSD, - SDDL_REVISION_1, - &(pSA->lpSecurityDescriptor), - NULL); -} -BOOL create_insecure_dacl(SECURITY_ATTRIBUTES* pSA) -{ - // Define the SDDL for the DACL. This example sets - // the following access: - // Built-in guests are denied all access. - // Anonymous logon is denied all access. - // Authenticated users are allowed - // read/write/execute access. - // Administrators are allowed full control. - // Modify these values as needed to generate the proper - // DACL for your application. - const wchar_t* szSD = TEXT("D:") - TEXT("(D;OICI;GA;;;BG)") // Deny access to authenticated users - TEXT("(D;OICI;GA;;;AN)") // Deny access to authenticated users - TEXT("(A;OICI;GA;;;AU)") // Deny access to authenticated users - TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtinadministrators - //TEXT("(A;OICI;GA;;;AA)"); // Allow full control to administrators - - - if (NULL == pSA) - return FALSE; - - return ConvertStringSecurityDescriptorToSecurityDescriptor( - szSD, - SDDL_REVISION_1, - &(pSA->lpSecurityDescriptor), - NULL); -} -int create_secure_folder(LPCWSTR folderpath) { - int error = 0; - SECURITY_ATTRIBUTES sa; - - sa.nLength = sizeof(SECURITY_ATTRIBUTES); - sa.bInheritHandle = FALSE;// objects are not inherited - - // Call function to set the DACL. The DACL - // is set in the SECURITY_ATTRIBUTES - // lpSecurityDescriptor member. - if (!create_dacl(&sa)) - { - // Error encountered; generate message and exit. - //printf("Failed to create access control list\n"); - error = 1; - } - - // Use the updated SECURITY_ATTRIBUTES to specify - // security attributes for securable objects. - // This example uses security attributes during - // creation of a new directory. - if (error == 0) { - if (0 == CreateDirectory(folderpath, &sa)) - { - // Error encountered; generate message and exit. - //could not create directory - error = 2; - } - } - // Free the memory allocated for the SECURITY_DESCRIPTOR. - if (error == 0) { - if (NULL != LocalFree(sa.lpSecurityDescriptor)) - { - // Error encountered; generate message and exit. - //printf("Failed to free the allocated memory\n"); - error = 3; - } - } - return error; -} -int create_insecure_folder(LPCWSTR folderpath) { - int error = 0; - SECURITY_ATTRIBUTES sa; - - sa.nLength = sizeof(SECURITY_ATTRIBUTES); - sa.bInheritHandle = FALSE;// objects are not inherited - - // Call function to set the DACL. The DACL - // is set in the SECURITY_ATTRIBUTES - // lpSecurityDescriptor member. - if (!create_insecure_dacl(&sa)) - { - // Error encountered; generate message and exit. - //printf("Failed to create access control list\n"); - error = 1; - } - - // Use the updated SECURITY_ATTRIBUTES to specify - // security attributes for securable objects. - // This example uses security attributes during - // creation of a new directory. - if (error == 0) { - if (0 == CreateDirectory(folderpath, &sa)) - { - // Error encountered; generate message and exit. - //could not create directory - error = 2; - } - } - // Free the memory allocated for the SECURITY_DESCRIPTOR. - if (error == 0) { - if (NULL != LocalFree(sa.lpSecurityDescriptor)) - { - // Error encountered; generate message and exit. - //printf("Failed to free the allocated memory\n"); - error = 3; - } - } - return error; -} - -int check_cert(const char* cert, const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return 1; - } - else { - char* secrets = new char[505]; - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp("cert", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp(cert, secrets) == 0) { - delete[] secrets; - return 0; - } - } - } - delete[] secrets; - return 2; - } - -} -char* get_apikey(const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return 0; - } - else { - char* secrets = new char[505]; - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - if (strcmp("apikey", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 500); // get the secret - fclose(fp); - return secrets; - } - } - fclose(fp); - delete[] secrets; - return 0; - } - -} -char* get_machineid(const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return 0; - } - else { - char* secrets = new char[300]; - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - if (strcmp("machineid", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - fclose(fp); - return secrets; - } - } - fclose(fp); - delete[] secrets; - return 0; - } - fclose(fp); -} -char* get_server(const char* secrets_path) { - FILE* fp; - if (fopen_s(&fp, secrets_path, "r") != 0) { - return 0; - } - else { - char* secrets = new char[300]; - while (!feof(fp)) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - if (strcmp("server", secrets) == 0) { - fscanf_s(fp, "%s", secrets, 295); // get the secret - fclose(fp); - return secrets; - } - } - fclose(fp); - delete[] secrets; - return 0; - } - fclose(fp); -} - -int update_db(const char* folder_path) { - //download the databases from the server - for (char firstChar = '0'; firstChar <= 'f'; ++firstChar) { - for (char secondChar = '0'; secondChar <= 'f'; ++secondChar) { - // Ensure that the characters are valid hexadecimal digits - if (!std::isxdigit(firstChar) || !std::isxdigit(secondChar) or std::isupper(firstChar) or std::isupper(secondChar)) { - continue; - } - - // Create the filename based on the naming convention - - char file_name[]= { firstChar, secondChar ,'.','j','d','b','f','\0' }; - //create the strings to download the files - char* url = new char[300]; - char* output_path = new char[300]; - strcpy_s(url, 295, get_server("setup.txt")); - strcat_s(url, 295, "/database_srv/"); - strcat_s(url, 295, file_name); - strcpy_s(output_path, 295, folder_path); - strcat_s(output_path, 295, "\\"); - strcat_s(output_path, 295, file_name); - printf("%s\n", url); - int res = download_file_from_srv(url, output_path); - if (res != 0) { - return 10; - } - - - delete[] url; - delete[] output_path; - - } - } - return 0; -} -int update_settings(const char* settings_type) { - //create the strings to download the files - char* url = new char[1000]; - strcpy_s(url, 1000, get_server("setup.txt")); - strcat_s(url, 1000, "/api/php/settings/get_settings.php?");//need to add machine_id and apikey - strcat_s(url, 1000, settings_type); - strcat_s(url, 1000, "&machine_id="); - strcat_s(url, 1000, get_machineid(SECRETS)); - strcat_s(url, 1000, "&apikey="); - strcat_s(url, 1000, get_apikey(SECRETS)); - int res = 1; - if (strcmp(settings_type, "settings") == 0) - res = download_file_from_srv(url, SETTINGS_DB); - else if (strcmp(settings_type, "rtp_included") == 0) - res = download_file_from_srv(url, INCLUDED_FOLDERS); - else if (strcmp(settings_type, "rtp_excluded") == 0) - res = download_file_from_srv(url, EXCLUDED_FOLDERS); - else if (strcmp(settings_type, "sched") == 0) - res = download_file_from_srv(url, SCHED_PATH); - //int res = 0; - if (res != 0) { - return 1; - } - - delete[] url; - return 0; -} -int action_update_settings() { - //update the settings - int err = 0; - if (update_settings("settings") != 0) { - err = 9; - } - //update the included folders - if (update_settings("rtp_included") != 0) { - err = 9; - } - //update the excluded folders - if (update_settings("rtp_excluded") != 0) { - err = 9; - } - //update the schedule - if (update_settings("sched") != 0) { - err = 9; - } - return err; -} -int action_update_db() { - //update the databases - return update_db(DB_DIR); -} -int copy(const char* source_path, const char* destination_path) { - FILE* source_file, * destination_file; - char buffer[4096]; // Buffer to store data read from source file - - // Open source file for reading - if (fopen_s(&source_file, source_path, "rb") != 0) { - return 1; - } - - // Open destination file for writing - if (fopen_s(&destination_file, destination_path, "wb") != 0) { - fclose(source_file); - return 1; - } - - // Copy contents from source to destination - size_t bytes_read; - while ((bytes_read = fread(buffer, 1, sizeof(buffer), source_file)) > 0) { - fwrite(buffer, 1, bytes_read, destination_file); - } - - // Close files - fclose(source_file); - fclose(destination_file); - - - return 0; - -} - - -HRESULT create_shortcut(const wchar_t* targetPath, const wchar_t* shortcutPath, const wchar_t* iconPath) { - // Initialize the COM library - HRESULT hr = CoInitialize(NULL); - if (FAILED(hr)) { - return hr; - } - - // Create an instance of the ShellLink interface - IShellLink* pShellLink = NULL; - hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&pShellLink); - if (FAILED(hr)) { - CoUninitialize(); - return hr; - } - - // Set the path of the target file - pShellLink->SetPath(targetPath); - - // Query the IPropertyStore interface - IPropertyStore* pPropertyStore = NULL; - hr = pShellLink->QueryInterface(IID_IPropertyStore, (void**)&pPropertyStore); - if (FAILED(hr)) { - pShellLink->Release(); - CoUninitialize(); - return hr; - } - - // Load the icon file and set the System.Icon property - PROPVARIANT propvar; - hr = InitPropVariantFromString(iconPath, &propvar); - if (SUCCEEDED(hr)) { - hr = pPropertyStore->SetValue(PKEY_AppUserModel_ID, propvar); - if (SUCCEEDED(hr)) { - hr = pPropertyStore->Commit(); - if (FAILED(hr)) { - CoUninitialize(); - pPropertyStore->Release(); - pShellLink->Release(); - return hr; - } - } - else { - CoUninitialize(); - pPropertyStore->Release(); - pShellLink->Release(); - return hr; - } - PropVariantClear(&propvar); // Free memory allocated by InitPropVariantFromString - } - else { - CoUninitialize(); - pPropertyStore->Release(); - pShellLink->Release(); - return hr; - } - - // Release the IPropertyStore interface - pPropertyStore->Release(); - - // Query the IPersistFile interface - IPersistFile* pPersistFile = NULL; - hr = pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile); - if (FAILED(hr)) { - pShellLink->Release(); - CoUninitialize(); - return hr; - } - - // Save the shortcut to disk - hr = pPersistFile->Save(shortcutPath, TRUE); - if (FAILED(hr)) { - pPersistFile->Release(); - pShellLink->Release(); - CoUninitialize(); - return hr; - } - - // Release COM interfaces - pPersistFile->Release(); - pShellLink->Release(); - - // Uninitialize the COM library - CoUninitialize(); - - return S_OK; // Success -} - - int main() { @@ -813,6 +160,17 @@ int main() if (rename("secrets.txt", SECRETS)!=0) { error = 8; } + + printf("Creating task\n"); + if (error == 0) { + error = create_task(); + if (error == 1) + { + std::cerr << "Task creation failed!" << std::endl; + error = 5; + } + } + //download all the other files //download the settings: if (error == 0) { @@ -827,41 +185,39 @@ int main() if (error == 0) { printf("Moving files into secure directorys\n"); - printf("Movin cyberhex.exe\n"); - //!!need to change: download in advance and then move to the correct folder - //error=download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/client_backend.exe", "C:\\Program Files\\cyberhex\\secure\\app\\cyberhex.exe"); + printf("Moving cyberhex.exe\n"); if(rename("client_backend.exe", "C:\\Program Files\\cyberhex\\secure\\app\\cyberhex.exe")!=0) error = 7; if (error == 0) { printf("Moving libcrypto-3-x64.dll\n"); - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/libcrypto-3-x64.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcrypto-3-x64.dll"); + if(rename("libcrypto-3-x64.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcrypto-3-x64.dll")!=0) error = 7; }if (error == 0) { printf("Moving libcurl.dll\n"); - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/libcurl.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll"); + if(rename("libcurl.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll")!=0) error = 7; }if (error == 0) { printf("Moving zlib1.dll\n"); if(rename("zlib1.dll", "C:\\Program Files\\cyberhex\\secure\\app\\zlib1.dll")!=0) error = 7; - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/zlib1.dll", "C:\\Program Files\\cyberhex\\secure\\app\\zlib1.dll"); + }if (error == 0) { printf("Moving cyberhex_desktop.exe\n"); if(rename("client_frontend.exe", "C:\\Program Files\\cyberhex\\app\\cyberhex_desktop.exe")!=0) error = 7; - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/client_frontend.exe", "C:\\Program Files\\cyberhex\\app\\cyberhex_desktop.exe"); + }if (error == 0) { printf("Moving msvcp140.dll\n"); - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/libcurl.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll"); + if (copy("msvcp140.dll", "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140.dll") != 0) error = 7; if (copy("msvcp140.dll", "C:\\Program Files\\cyberhex\\app\\msvcp140.dll") != 0) error = 7; }if (error == 0) { printf("Moving msvcp140d.dll\n"); - //error = download_file_from_srv("https://github.com/jakani24/cyberhex_bin_distro/raw/main/libcurl.dll", "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll"); + if (copy("msvcp140d.dll", "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140d.dll") != 0) error = 7; if (copy("msvcp140d.dll", "C:\\Program Files\\cyberhex\\app\\msvcp140d.dll") != 0) @@ -890,17 +246,13 @@ int main() error = 7; if (copy("ucrtbased.dll", "C:\\Program Files\\cyberhex\\app\\ucrtbased.dll") != 0) error = 7; + }if (error == 0) { + printf("Moving icon\n"); + if (copy("cyberhex_logo2.ico", "C:\\Program Files\\cyberhex\\app\\icon.ico") != 0) + error = 7; } } - - HRESULT hr = create_task(); - if (FAILED(hr)) - { - std::cerr << "Task creation failed!" << std::endl; - error=5; - } - //create the shortcut if (error == 0) { printf("Creating shortcut\n"); diff --git a/src/ma_installer/ma_installer.vcxproj b/src/ma_installer/ma_installer.vcxproj index 0bffe84..ab3d407 100644 --- a/src/ma_installer/ma_installer.vcxproj +++ b/src/ma_installer/ma_installer.vcxproj @@ -127,12 +127,22 @@ + + + + + + + + + + diff --git a/src/ma_installer/ma_installer.vcxproj.filters b/src/ma_installer/ma_installer.vcxproj.filters index 282946b..65582ac 100644 --- a/src/ma_installer/ma_installer.vcxproj.filters +++ b/src/ma_installer/ma_installer.vcxproj.filters @@ -21,6 +21,21 @@ Headerdateien + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + @@ -29,5 +44,20 @@ Headerdateien + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + \ No newline at end of file diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.ilk b/src/ma_installer/ma_installer/x64/Debug/ma_installer.ilk index 5199e79..6406c01 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.ilk and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.ilk differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.log b/src/ma_installer/ma_installer/x64/Debug/ma_installer.log index c86d6b5..bdabbf8 100644 --- a/src/ma_installer/ma_installer/x64/Debug/ma_installer.log +++ b/src/ma_installer/ma_installer/x64/Debug/ma_installer.log @@ -1,4 +1,11 @@ - ma_installer.cpp -C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer.cpp(807,15): warning C4101: "fp": Unreferenzierte lokale Variable + create_folder.cpp + download.cpp + ma_installer.cpp +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer.cpp(154,15): warning C4101: "fp": Unreferenzierte lokale Variable + service.cpp + setup_var.cpp + update.cpp + zip.cpp + Code wird generiert... ma_installer.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\x64\Debug\ma_installer.exe C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\vcpkg.targets(228,5): warning : [vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: -ExecutionPolicy Bypass -noprofile -File "C:\vcpkg\vcpkg-2023.08.09\scripts\buildsystems\msbuild\applocal.ps1" "C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\x64\Debug\ma_installer.exe" "C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\debug\bin" "ma_installer\x64\Debug\ma_installer.tlog\ma_installer.write.1u.tlog" "ma_installer\x64\Debug\vcpkg.applocal.log" diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.command.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.command.1.tlog index 7be3e99..b0c375f 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.command.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.command.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.read.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.read.1.tlog index 9c8568d..35fb930 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.read.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.read.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.write.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.write.1.tlog index 14c6630..4c6cfbf 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.write.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/CL.write.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/Cl.items.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/Cl.items.tlog index f0097a7..48a826e 100644 --- a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/Cl.items.tlog +++ b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/Cl.items.tlog @@ -1,2 +1,7 @@ +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\create_folder.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\create_folder.obj C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\download.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\download.obj C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\ma_installer.obj +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\service.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\service.obj +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\setup_var.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\setup_var.obj +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\update.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\update.obj +C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\zip.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\zip.obj diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.command.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.command.1.tlog index c67561c..9b8be10 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.command.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.command.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.read.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.read.1.tlog index 0e3bedb..b1d7537 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.read.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.read.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.secondary.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.secondary.1.tlog index 9ee4ad1..ca7568d 100644 --- a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.secondary.1.tlog +++ b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.secondary.1.tlog @@ -1,2 +1,2 @@ -^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\DOWNLOAD.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\MA_INSTALLER.OBJ +^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\CREATE_FOLDER.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\DOWNLOAD.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\MA_INSTALLER.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\SERVICE.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\SETUP_VAR.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\UPDATE.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\MA_INSTALLER\MA_INSTALLER\X64\DEBUG\ZIP.OBJ C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\ma_installer\ma_installer\x64\Debug\ma_installer.ilk diff --git a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.write.1.tlog b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.write.1.tlog index 45ed7cd..1f5b660 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.write.1.tlog and b/src/ma_installer/ma_installer/x64/Debug/ma_installer.tlog/link.write.1.tlog differ diff --git a/src/ma_installer/ma_installer/x64/Debug/vc143.idb b/src/ma_installer/ma_installer/x64/Debug/vc143.idb index 736d584..b6526eb 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/vc143.idb and b/src/ma_installer/ma_installer/x64/Debug/vc143.idb differ diff --git a/src/ma_installer/ma_installer/x64/Debug/vc143.pdb b/src/ma_installer/ma_installer/x64/Debug/vc143.pdb index 312343e..72c61aa 100644 Binary files a/src/ma_installer/ma_installer/x64/Debug/vc143.pdb and b/src/ma_installer/ma_installer/x64/Debug/vc143.pdb differ diff --git a/src/ma_installer/service.cpp b/src/ma_installer/service.cpp new file mode 100644 index 0000000..bec3a02 --- /dev/null +++ b/src/ma_installer/service.cpp @@ -0,0 +1,249 @@ +/* +This file contains the implementation of the create_task function. This function creates a task in the Windows Task Scheduler that runs the Cyberhex application on system boot. The task is created with the highest privilege level and is set to run on system boot. The task is set to run with the SYSTEM account and is set to run even if the system is on batteries. The task is set to have an execution time limit of zero seconds, meaning that it will run indefinitely. The task is registered with the Task Scheduler and saved to the system. + +Functions: + - create_task: Creates a task in the Windows Task Scheduler that runs the Cyberhex application on system boot. +*/ + +#include "service.h" +#include +#include +#include +#include +#include + +using namespace std; + + +int create_task() +{ + HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (FAILED(hr)) + { + cout << "CoInitializeEx failed: " << hex << hr << endl; + return 1; + } + + hr = CoInitializeSecurity( + NULL, + -1, + NULL, + NULL, + RPC_C_AUTHN_LEVEL_PKT_PRIVACY, + RPC_C_IMP_LEVEL_IMPERSONATE, + NULL, + 0, + NULL); + + if (FAILED(hr)) + { + cout << "CoInitializeSecurity failed: " << hex << hr << endl; + CoUninitialize(); + return 1; + } + + LPCWSTR wszTaskName = L"CyberhexBackgroundTask"; + wstring wstrExecutablePath = L"c:\\program files\\cyberhex\\secure\\app\\cyberhex.exe"; + + ITaskService* pService = NULL; + hr = CoCreateInstance(CLSID_TaskScheduler, + NULL, + CLSCTX_INPROC_SERVER, + IID_ITaskService, + (void**)&pService); + if (FAILED(hr)) + { + cout << "Failed to create an instance of ITaskService: " << hex << hr << endl; + CoUninitialize(); + return 1; + } + + hr = pService->Connect(_variant_t(), _variant_t(), + _variant_t(), _variant_t()); + if (FAILED(hr)) + { + cout << "ITaskService::Connect failed: " << hex << hr << endl; + pService->Release(); + CoUninitialize(); + return 1; + } + + ITaskFolder* pRootFolder = NULL; + hr = pService->GetFolder(_bstr_t(L"\\"), &pRootFolder); + if (FAILED(hr)) + { + cout << "Cannot get Root Folder pointer: " << hex << hr << endl; + pService->Release(); + CoUninitialize(); + return 1; + } + + pRootFolder->DeleteTask(_bstr_t(wszTaskName), 0); + + ITaskDefinition* pTask = NULL; + hr = pService->NewTask(0, &pTask); + + pService->Release(); + if (FAILED(hr)) + { + cout << "Failed to create a task definition: " << hex << hr << endl; + pRootFolder->Release(); + CoUninitialize(); + return 1; + } + + IPrincipal* pPrincipal = NULL; + hr = pTask->get_Principal(&pPrincipal); + if (FAILED(hr)) + { + cout << "Cannot get principal pointer: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_HIGHEST); + pPrincipal->Release(); + if (FAILED(hr)) + { + cout << "Cannot set highest privilege level: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + ITaskSettings* pSettings = NULL; + hr = pTask->get_Settings(&pSettings); + if (FAILED(hr)) + { + cout << "Cannot get settings pointer: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + hr = pSettings->put_ExecutionTimeLimit(_bstr_t(L"PT0S")); // Set execution time limit to zero seconds + pSettings->Release(); + if (FAILED(hr)) + { + cout << "Cannot set execution time limit: " << hex << hr << endl; + pRootFolder->Release(); + pService->Release(); + CoUninitialize(); + return 1; + } + + + hr = pSettings->put_DisallowStartIfOnBatteries(VARIANT_FALSE); // Set to allow start on batteries + pSettings->Release(); + if (FAILED(hr)) + { + cout << "Cannot set start on batteries: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + ITriggerCollection* pTriggerCollection = NULL; + hr = pTask->get_Triggers(&pTriggerCollection); + if (FAILED(hr)) + { + cout << "Cannot get trigger collection: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + ITrigger* pTrigger = NULL; + hr = pTriggerCollection->Create(TASK_TRIGGER_BOOT, &pTrigger); + pTriggerCollection->Release(); + if (FAILED(hr)) + { + cout << "Cannot create the trigger: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + IActionCollection* pActionCollection = NULL; + hr = pTask->get_Actions(&pActionCollection); + if (FAILED(hr)) + { + cout << "Cannot get Task collection pointer: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + IAction* pAction = NULL; + hr = pActionCollection->Create(TASK_ACTION_EXEC, &pAction); + pActionCollection->Release(); + if (FAILED(hr)) + { + cout << "Cannot create the action: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + IExecAction* pExecAction = NULL; + hr = pAction->QueryInterface( + IID_IExecAction, (void**)&pExecAction); + pAction->Release(); + if (FAILED(hr)) + { + cout << "QueryInterface call failed for IExecAction: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + hr = pExecAction->put_Path(_bstr_t(wstrExecutablePath.c_str())); + pExecAction->Release(); + if (FAILED(hr)) + { + cout << "Cannot set path of executable: " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + IRegisteredTask* pRegisteredTask = NULL; + VARIANT varPassword; + varPassword.vt = VT_EMPTY; + hr = pRootFolder->RegisterTaskDefinition( + _bstr_t(wszTaskName), + pTask, + TASK_CREATE_OR_UPDATE, + _variant_t(L"SYSTEM"), + varPassword, + TASK_LOGON_SERVICE_ACCOUNT, + _variant_t(L""), + &pRegisteredTask); + if (FAILED(hr)) + { + cout << "Error saving the Task : " << hex << hr << endl; + pRootFolder->Release(); + pTask->Release(); + CoUninitialize(); + return 1; + } + + cout << "Success! Task successfully registered." << endl; + + pRootFolder->Release(); + pTask->Release(); + pRegisteredTask->Release(); + CoUninitialize(); + return 0; +} diff --git a/src/ma_installer/service.h b/src/ma_installer/service.h new file mode 100644 index 0000000..aa206ba --- /dev/null +++ b/src/ma_installer/service.h @@ -0,0 +1,2 @@ +#pragma once +int create_task(); \ No newline at end of file diff --git a/src/ma_installer/setup_var.cpp b/src/ma_installer/setup_var.cpp new file mode 100644 index 0000000..e2b633d --- /dev/null +++ b/src/ma_installer/setup_var.cpp @@ -0,0 +1,98 @@ +/* +This file contains the functions that are used to read the secrets file and check the certificate. + +Functions: + - check_cert: Checks the certificate. + - get_apikey: Gets the apikey. + - get_machineid: Gets the machine id. + - get_server: Gets the server. +*/ + +#include "setup_var.h" +#include + +int check_cert(const char* cert, const char* secrets_path) { + FILE* fp; + if (fopen_s(&fp, secrets_path, "r") != 0) { + return 1; + } + else { + char* secrets = new char[505]; + while (!feof(fp)) { + fscanf_s(fp, "%s", secrets, 500); // get the secret + if (strcmp("cert", secrets) == 0) { + fscanf_s(fp, "%s", secrets, 500); // get the secret + if (strcmp(cert, secrets) == 0) { + delete[] secrets; + return 0; + } + } + } + delete[] secrets; + return 2; + } + +} +char* get_apikey(const char* secrets_path) { + FILE* fp; + if (fopen_s(&fp, secrets_path, "r") != 0) { + return 0; + } + else { + char* secrets = new char[505]; + while (!feof(fp)) { + fscanf_s(fp, "%s", secrets, 500); // get the secret + if (strcmp("apikey", secrets) == 0) { + fscanf_s(fp, "%s", secrets, 500); // get the secret + fclose(fp); + return secrets; + } + } + fclose(fp); + delete[] secrets; + return 0; + } + +} +char* get_machineid(const char* secrets_path) { + FILE* fp; + if (fopen_s(&fp, secrets_path, "r") != 0) { + return 0; + } + else { + char* secrets = new char[300]; + while (!feof(fp)) { + fscanf_s(fp, "%s", secrets, 295); // get the secret + if (strcmp("machineid", secrets) == 0) { + fscanf_s(fp, "%s", secrets, 295); // get the secret + fclose(fp); + return secrets; + } + } + fclose(fp); + delete[] secrets; + return 0; + } + fclose(fp); +} +char* get_server(const char* secrets_path) { + FILE* fp; + if (fopen_s(&fp, secrets_path, "r") != 0) { + return 0; + } + else { + char* secrets = new char[300]; + while (!feof(fp)) { + fscanf_s(fp, "%s", secrets, 295); // get the secret + if (strcmp("server", secrets) == 0) { + fscanf_s(fp, "%s", secrets, 295); // get the secret + fclose(fp); + return secrets; + } + } + fclose(fp); + delete[] secrets; + return 0; + } + fclose(fp); +} diff --git a/src/ma_installer/setup_var.h b/src/ma_installer/setup_var.h new file mode 100644 index 0000000..0f05a5b --- /dev/null +++ b/src/ma_installer/setup_var.h @@ -0,0 +1,5 @@ +#pragma once +int check_cert(const char* cert, const char* secrets_path); +char* get_apikey(const char* secrets_path); +char* get_machineid(const char* secrets_path); +char* get_server(const char* secrets_path); \ No newline at end of file diff --git a/src/ma_installer/update.cpp b/src/ma_installer/update.cpp new file mode 100644 index 0000000..ed1d3e1 --- /dev/null +++ b/src/ma_installer/update.cpp @@ -0,0 +1,107 @@ +/* +This file contains the functions to update the databases and settings of the program. + +Functions: + - update_yara: Updates the yara database. + - update_db: Updates the signature database. + - update_settings: Updates the settings. + - action_update_settings: starts the update functions (settings). + - action_update_db: starts the update functions (signatures and yara) +*/ + + +#include +#include +#include "update.h" +#include "zip.h" +#include "setup_var.h" +#include "download.h" +#include "well_known.h" + +int update_yara(const std::string& folder_path) { + //remove the old databases + char* url = new char[1000]; + strcpy_s(url, 1000, get_server("setup.txt")); + strcat_s(url, 1000, "/database_srv/yara.zip");//need to add machine_id and apikey + + std::string output_path = folder_path + "\\" + "sig.zip"; + int res = download_file_from_srv(url, output_path.c_str()); + + if (res != 0) { + return 10; // Error downloading file + } + + //unzip the file + unzip(output_path, folder_path); + return 0; +} + +int update_db(const std::string& folder_path) { + //remove the old databases + char* url = new char[1000]; + strcpy_s(url, 1000, get_server("setup.txt")); + strcat_s(url, 1000, "/database_srv/sig.zip");//need to add machine_id and apikey + + std::string output_path = folder_path + "\\" + "sig.zip"; + int res = download_file_from_srv(url, output_path.c_str()); + + if (res != 0) { + return 10; // Error downloading file + } + + //unzip the file + unzip(output_path, folder_path); + return 0; +} +int update_settings(const char* settings_type) { + //create the strings to download the files + char* url = new char[1000]; + strcpy_s(url, 1000, get_server("setup.txt")); + strcat_s(url, 1000, "/api/php/settings/get_settings.php?");//need to add machine_id and apikey + strcat_s(url, 1000, settings_type); + strcat_s(url, 1000, "&machine_id="); + strcat_s(url, 1000, get_machineid(SECRETS)); + strcat_s(url, 1000, "&apikey="); + strcat_s(url, 1000, get_apikey(SECRETS)); + int res = 1; + if (strcmp(settings_type, "settings") == 0) + res = download_file_from_srv(url, SETTINGS_DB); + else if (strcmp(settings_type, "rtp_included") == 0) + res = download_file_from_srv(url, INCLUDED_FOLDERS); + else if (strcmp(settings_type, "rtp_excluded") == 0) + res = download_file_from_srv(url, EXCLUDED_FOLDERS); + else if (strcmp(settings_type, "sched") == 0) + res = download_file_from_srv(url, SCHED_PATH); + //int res = 0; + if (res != 0) { + return 1; + } + + delete[] url; + return 0; +} +int action_update_settings() { + //update the settings + int err = 0; + if (update_settings("settings") != 0) { + err = 9; + } + //update the included folders + if (update_settings("rtp_included") != 0) { + err = 9; + } + //update the excluded folders + if (update_settings("rtp_excluded") != 0) { + err = 9; + } + //update the schedule + if (update_settings("sched") != 0) { + err = 9; + } + return err; +} +int action_update_db() { + //update the databases + update_db(DB_DIR); + return update_yara(YARA_DB_DIR); +} \ No newline at end of file diff --git a/src/ma_installer/update.h b/src/ma_installer/update.h new file mode 100644 index 0000000..0594dc3 --- /dev/null +++ b/src/ma_installer/update.h @@ -0,0 +1,8 @@ +#pragma once +#include +int update_yara(const std::string& folder_path); +int update_db(const std::string& folder_path); +int update_settings(const char* settings_type); + +int action_update_settings(); +int action_update_db(); diff --git a/src/ma_installer/well_known.h b/src/ma_installer/well_known.h index dd6feb0..5da1661 100644 --- a/src/ma_installer/well_known.h +++ b/src/ma_installer/well_known.h @@ -1,5 +1,4 @@ #pragma once -#pragma once #ifndef WELL_KNOWN_H #define WELL_KNOWN_H #define MAIN_COM "main_com.txt" @@ -19,12 +18,16 @@ #define ERRORFILE "C:\\Program Files\\cyberhex\\secure\\log\\error.txt" #define VIRUSFILE "C:\\Program Files\\cyberhex\\secure\\log\\virus.txt" #define RISKFILE "C:\\Program Files\\cyberhex\\secure\\log\\risk.txt" +#define PANICFILE "C:\\Program Files\\cyberhex\\secure\\log\\panic.txt" #define SRV_LOGFILE "C:\\Program Files\\cyberhex\\secure\\log\\srv_log.txt" #define FOLDER_DATABASE_DIR "C:\\Program Files\\cyberhex\\secure\\database\\folder" +#define APP_DIR "C:\\Program Files\\cyberhex\\secure\\app" + #define DB_DIR "C:\\Program Files\\cyberhex\\secure\\database" +#define YARA_DB_DIR "C:\\Program Files\\cyberhex\\secure\\yara" #define VIRUS_CTRL_DB "C:\\Program Files\\cyberhex\\secure\\database\\virus_ctrl_db.txt" @@ -39,4 +42,32 @@ #define INCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\included_folders.txt" #define EXCLUDED_FOLDERS "C:\\Program Files\\cyberhex\\secure\\settings\\excluded_folders.txt" + +#define JAKACH_UPDATE_SRV "https://jakach.duckdns.org/cyberhex/latest/" +#define CURRENT_VERSION 1 + +//hashes for self check +#define APP_HASH "aa" +#define DLL_LIBCRYPTO_HASH "06431d044cf37522e1434019522d11a0" +#define DLL_LIBCURL_HASH "cec7fb7e6cfb46be0740b02fb828900d" +#define DLL_MSVCP140_HASH "ebf8072a3c5c586979313f76e503aabf" +#define DLL_MSVCP140D_HASH "f265bdccc3d8dbc56344c0d900a833bc" +#define DLL_VCRUNTIME140_HASH "699dd61122d91e80abdfcc396ce0ec10" +#define DLL_VCRUNTIME140D_HASH "8e32121bc62367042f6d105df057d6b4" +#define DLL_VCRUNTIME140_1D_HASH "75e81353c004a6bea844c212db09e1ed" +#define DLL_ZLIB1_HASH "a966f1c10844493269521fef54e4cdef" +#define DLL_UCRTBASED_HASH "ffc3b14a9c1280517429e805ed9625b2" + +#define APP_PATH "C:\\Program Files\\cyberhex\\secure\\app\\cyberhex.exe" +#define DLL_LIBCRYPTO_PATH "c:\\Program Files\\cyberhex\\secure\\app\\libcrypto-3-x64.dll" +#define DLL_LIBCURL_PATH "C:\\Program Files\\cyberhex\\secure\\app\\libcurl.dll" +#define DLL_MSVCP140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140.dll" +#define DLL_MSVCP140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\msvcp140d.dll" +#define DLL_VCRUNTIME140_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140.dll" +#define DLL_VCRUNTIME140D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140d.dll" +#define DLL_VCRUNTIME140_1D_PATH "C:\\Program Files\\cyberhex\\secure\\app\\vcruntime140_1d.dll" +#define DLL_ZLIB1_PATH "C:\\Program Files\\cyberhex\\secure\\app\\zlib1.dll" +#define DLL_UCRTBASED_PATH "C:\\Program Files\\cyberhex\\secure\\app\\ucrtbased.dll" + + #endif // !WELL_KNOWN_H \ No newline at end of file diff --git a/src/ma_installer/x64/Debug/ma_installer.pdb b/src/ma_installer/x64/Debug/ma_installer.pdb index 99b2c96..e7686e3 100644 Binary files a/src/ma_installer/x64/Debug/ma_installer.pdb and b/src/ma_installer/x64/Debug/ma_installer.pdb differ diff --git a/src/ma_installer/zip.cpp b/src/ma_installer/zip.cpp new file mode 100644 index 0000000..2b49433 --- /dev/null +++ b/src/ma_installer/zip.cpp @@ -0,0 +1,69 @@ +/* +This file houses the unzip function. This function is used to unzip a file from a source to a destination. + +Functions: + - unzip: Unzips a file from a source to a destination. +*/ + +#include "zip.h" +#include +#include +#include +#include +#include +//thanks https://vcpptips.wordpress.com/2013/10/28/how-to-zipunzip-files/ + +void unzip(const std::string& source, const std::string& dest) +{ + HRESULT hResult = S_FALSE; + IShellDispatch* pIShellDispatch = NULL; + Folder* pToFolder = NULL; + VARIANT variantDir, variantFile, variantOpt; + + CoInitialize(NULL); + + hResult = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, + IID_IShellDispatch, (void**)&pIShellDispatch); + if (SUCCEEDED(hResult)) + { + VariantInit(&variantDir); + variantDir.vt = VT_BSTR; + variantDir.bstrVal = SysAllocStringLen(NULL, MultiByteToWideChar(CP_UTF8, 0, dest.c_str(), -1, NULL, 0)); + MultiByteToWideChar(CP_UTF8, 0, dest.c_str(), -1, variantDir.bstrVal, SysStringLen(variantDir.bstrVal)); + + hResult = pIShellDispatch->NameSpace(variantDir, &pToFolder); + + if (SUCCEEDED(hResult)) + { + Folder* pFromFolder = NULL; + VariantInit(&variantFile); + variantFile.vt = VT_BSTR; + variantFile.bstrVal = SysAllocStringLen(NULL, MultiByteToWideChar(CP_UTF8, 0, source.c_str(), -1, NULL, 0)); + MultiByteToWideChar(CP_UTF8, 0, source.c_str(), -1, variantFile.bstrVal, SysStringLen(variantFile.bstrVal)); + + pIShellDispatch->NameSpace(variantFile, &pFromFolder); + + FolderItems* fi = NULL; + pFromFolder->Items(&fi); + + VariantInit(&variantOpt); + variantOpt.vt = VT_I4; + variantOpt.lVal = FOF_NO_UI; + + VARIANT newV; + VariantInit(&newV); + newV.vt = VT_DISPATCH; + newV.pdispVal = fi; + hResult = pToFolder->CopyHere(newV, variantOpt); + Sleep(1000); + + pFromFolder->Release(); + pToFolder->Release(); + } + pIShellDispatch->Release(); + } + + CoUninitialize(); + SysFreeString(variantDir.bstrVal); + SysFreeString(variantFile.bstrVal); +} \ No newline at end of file diff --git a/src/ma_installer/zip.h b/src/ma_installer/zip.h new file mode 100644 index 0000000..d22d9ae --- /dev/null +++ b/src/ma_installer/zip.h @@ -0,0 +1,4 @@ +#pragma once +#pragma once +#include +void unzip(const std::string& source, const std::string& dest); \ No newline at end of file diff --git a/src/ma_uninstaller/.vs/ma_uninstaller/v17/.suo b/src/ma_uninstaller/.vs/ma_uninstaller/v17/.suo index 98308bc..1aee1d5 100644 Binary files a/src/ma_uninstaller/.vs/ma_uninstaller/v17/.suo and b/src/ma_uninstaller/.vs/ma_uninstaller/v17/.suo differ diff --git a/src/ma_uninstaller/.vs/ma_uninstaller/v17/Browse.VC.db b/src/ma_uninstaller/.vs/ma_uninstaller/v17/Browse.VC.db index f38d9f5..55840fb 100644 Binary files a/src/ma_uninstaller/.vs/ma_uninstaller/v17/Browse.VC.db and b/src/ma_uninstaller/.vs/ma_uninstaller/v17/Browse.VC.db differ diff --git a/src/ma_uninstaller/.vs/ma_uninstaller/v17/DocumentLayout.json b/src/ma_uninstaller/.vs/ma_uninstaller/v17/DocumentLayout.json index 735065c..ead0732 100644 --- a/src/ma_uninstaller/.vs/ma_uninstaller/v17/DocumentLayout.json +++ b/src/ma_uninstaller/.vs/ma_uninstaller/v17/DocumentLayout.json @@ -24,7 +24,7 @@ "RelativeDocumentMoniker": "ma_uninstaller.cpp", "ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\ma_uninstaller\\ma_uninstaller.cpp", "RelativeToolTip": "ma_uninstaller.cpp", - "ViewState": "AQIAAI0AAAAAAAAAAAAAALcAAAAUAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAACAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2023-12-23T09:04:19.505Z", "EditorCaption": "" diff --git a/src/ma_uninstaller/ma_uninstaller.cpp b/src/ma_uninstaller/ma_uninstaller.cpp index 3576614..6c907a8 100644 --- a/src/ma_uninstaller/ma_uninstaller.cpp +++ b/src/ma_uninstaller/ma_uninstaller.cpp @@ -1,8 +1,13 @@ -// ma_uninstaller.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms. -// -//todo: -/* remove folders -* remove background task +/* +This file contains the uninstaller for the Cyberhex application. It removes the application directory and the background task. + +DO: +- Check if the programm is run as admin +- If not, request admin rights +- Stop the Cyberhex application +- Remove the application directory +- Remove the background task +- Show a message box with the result */ #include #include @@ -217,6 +222,7 @@ int main() case 4: printf("Failed to remove directory.\n"); MessageBox(NULL, L"Failed to remove directory!", L"Error", MB_OK); + break; default: printf("Unknown error\n"); MessageBox(NULL, L"Unknown error!", L"Error", MB_OK); diff --git a/src/server/cyberhex-code/system/secure_zone/php/database_settings.php b/src/server/cyberhex-code/system/secure_zone/php/database_settings.php index bae268e..faa0fab 100644 --- a/src/server/cyberhex-code/system/secure_zone/php/database_settings.php +++ b/src/server/cyberhex-code/system/secure_zone/php/database_settings.php @@ -239,7 +239,7 @@ async function add_item(db,element_id1,field1,element_id2,field2){ //we have two echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -256,7 +256,7 @@ async function add_item(db,element_id1,field1,element_id2,field2){ //we have two echo ''; echo ''; echo ''; - echo ''; //NEED TO BE DONE + //echo ''; //NEED TO BE DONE echo ''; } $i++;
Entry idNameDownload RuleDelete RuleEntry idNameDownload Rule
' . $i . '' . basename($yara_file) . 'Downloaddeletedelete