created installer
Created an installer which can create secure folders, create a background process and downloa the main applications files.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/client_backend/.vs/client_backend/v17/Solution.VC.db
Normal file
BIN
src/client_backend/.vs/client_backend/v17/Solution.VC.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,49 +3,33 @@
|
||||
#include <thread>
|
||||
#include <curl/curl.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <yara.h>
|
||||
//#include <yara.h>
|
||||
#include "md5hash.h"
|
||||
#include "connect.h"
|
||||
#include "scan.h"
|
||||
#include "app_ctrl.h"
|
||||
#include "queue_ctrl.h"
|
||||
int main() {
|
||||
printf("welcome to the jakach security tool\n");
|
||||
//main loop, call queue function and so on.
|
||||
char a[100] = "hello_from_queue0\n";
|
||||
char b[100] = "hello_from_queue1\n";
|
||||
char c[100] = "hello_from_queue2\n";
|
||||
printf("a:%s\n", a);
|
||||
printf("b:%s\n", b);
|
||||
printf("c:%s\n\n\n", c);
|
||||
printf("welcome to the jakach security tool main thread\n");
|
||||
//main thread:
|
||||
/* watches for notifications on bus
|
||||
* start threads (scans etc); only one at a time may run
|
||||
* updates settings etc
|
||||
* start scheduled tasks
|
||||
|
||||
|
||||
*/
|
||||
while (!app_stop()) {
|
||||
//run all the tasks described above
|
||||
|
||||
|
||||
printf("pushing a:%d\n", queue_push(a));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("pushing b:%d\n", queue_push(b));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("pushing c:%d\n", queue_push(c));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("a:%s\n", a);
|
||||
printf("b:%s\n", b);
|
||||
printf("c: % s\n\n\n", c);
|
||||
|
||||
printf("popping a:%d\n", queue_pop(a));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("popping b:%d\n", queue_pop(b));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("popping c:%d\n", queue_pop(c));
|
||||
printf("size:%d\n", get_queue_size());
|
||||
printf("a:%s\n", a);
|
||||
printf("b:%s\n", b);
|
||||
printf("c:%s\n", c);
|
||||
|
||||
|
||||
/*
|
||||
}
|
||||
|
||||
|
||||
|
||||
char md5Hash[2 * MD5_DIGEST_LENGTH + 1]; // +1 for null-terminator
|
||||
|
||||
|
||||
//ListFilesRecursive("C:\\", 0);
|
||||
/*char md5Hash[2 * MD5_DIGEST_LENGTH + 1]; // +1 for null-terminator
|
||||
printf("Hash of the executable: ");
|
||||
md5_file("C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_backend\\x64\\Debug\\client_backend.exe", md5Hash);
|
||||
printf("%s", md5Hash);
|
||||
@@ -54,7 +38,7 @@ int main() {
|
||||
printf("%s", a_); //error 6: not reachable
|
||||
download_file_from_srv("https://jakach.duckdns.org/php/login/v3/login.php", "c:\\programdata\\jakach\\out12.txt");
|
||||
/*
|
||||
const int numThreads = 12;
|
||||
const int numThreads = 12;
|
||||
std::thread threads[numThreads];
|
||||
|
||||
for (int i = 0; i < numThreads; ++i) {
|
||||
@@ -70,7 +54,7 @@ int main() {
|
||||
*/
|
||||
|
||||
//printf("code:%d",scan_hash("C:\\Users\\janis\\Documents\\ma_av_tests\\OutputFile.txt", "1fddc13c02a79442c911a44b02ee0f58"));
|
||||
//ListFilesRecursive("C:\\Users\\janis\\Documents\\ma_av_tests",0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef PERMISSIONS_CPP
|
||||
#define PERMISSIONS_CPP
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
#include "permissions.h"
|
||||
/*
|
||||
1 create file (as admin)
|
||||
@@ -7,21 +9,134 @@
|
||||
file cannot be deleted or modified by anyone. admin can delete
|
||||
|
||||
*/
|
||||
/*
|
||||
int main() {
|
||||
FILE* fp;
|
||||
fp = fopen("c:\\programdata\\jakach\\aa.txt", "w");
|
||||
fprintf(fp, "secure text");
|
||||
fclose(fp);
|
||||
chmod("c:\\programdata\\jakach\\aa.txt", _S_IREAD);
|
||||
}
|
||||
|
||||
*/
|
||||
//mark as readonly
|
||||
int protect_file(char* path) {
|
||||
return _chmod(path, _S_IREAD);
|
||||
}
|
||||
//mark as readwrite
|
||||
int unprotect_file(char* path) {
|
||||
return _chmod(path, _S_IWRITE | _S_IREAD);
|
||||
}
|
||||
|
||||
//deny all access and only grant access to admins
|
||||
BOOL create_file_protection(SECURITY_ATTRIBUTES* pSA)
|
||||
{
|
||||
// Define the SDDL for the DACL. This example sets
|
||||
// the following access:
|
||||
// Built-in guests are denied all access.
|
||||
// Anonymous logon is denied all access.
|
||||
// Authenticated users are denied all access.
|
||||
// Administrators are allowed full control.
|
||||
// Modify these values as needed to generate the proper
|
||||
// DACL for your application.
|
||||
TCHAR* szSD = TEXT("D:")
|
||||
TEXT("(D;OICI;GA;;;BG)") // Deny access to guest users
|
||||
TEXT("(D;OICI;GA;;;AN)") // Deny access to unauthenticated users
|
||||
//TEXT("(D;OICI;GA;;;AU)") // Deny access to authenticated users do not execute else not even admins have rights anymore :(
|
||||
TEXT("(A;OICI;GA;;;BA)"); // Allow full control to builtin administrators
|
||||
TEXT("(A;OICI;GA;;;AA)"); // Allow full control to normal administrators
|
||||
|
||||
|
||||
if (NULL == pSA)
|
||||
return FALSE;
|
||||
|
||||
return ConvertStringSecurityDescriptorToSecurityDescriptor(
|
||||
szSD,
|
||||
SDDL_REVISION_1,
|
||||
&(pSA->lpSecurityDescriptor),
|
||||
NULL);
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
BOOL CreateMyDACL(SECURITY_ATTRIBUTES*);
|
||||
|
||||
int main()
|
||||
{
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sa.bInheritHandle = FALSE;
|
||||
|
||||
// Call function to set the DACL. The DACL
|
||||
// is set in the SECURITY_ATTRIBUTES
|
||||
// lpSecurityDescriptor member.
|
||||
if (!CreateMyDACL(&sa))
|
||||
{
|
||||
// Error encountered; generate message and exit.
|
||||
printf("Failed CreateMyDACL\n");
|
||||
exit(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 (0 == CreateDirectory(TEXT("C:\\MyFolder"), &sa))
|
||||
{
|
||||
// Error encountered; generate message and exit.
|
||||
printf("Failed CreateDirectory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Free the memory allocated for the SECURITY_DESCRIPTOR.
|
||||
if (NULL != LocalFree(sa.lpSecurityDescriptor))
|
||||
{
|
||||
// Error encountered; generate message and exit.
|
||||
printf("Failed LocalFree\n");
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// CreateMyDACL.
|
||||
// Create a security descriptor that contains the DACL
|
||||
// you want.
|
||||
// This function uses SDDL to make Deny and Allow ACEs.
|
||||
//
|
||||
// Parameter:
|
||||
// SECURITY_ATTRIBUTES * pSA
|
||||
// Pointer to a SECURITY_ATTRIBUTES structure. It is your
|
||||
// responsibility to properly initialize the
|
||||
// structure and to free the structure's
|
||||
// lpSecurityDescriptor member when you have
|
||||
// finished using it. To free the structure's
|
||||
// lpSecurityDescriptor member, call the
|
||||
// LocalFree function.
|
||||
//
|
||||
// Return value:
|
||||
// FALSE if the address to the structure is NULL.
|
||||
// Otherwise, this function returns the value from the
|
||||
// ConvertStringSecurityDescriptorToSecurityDescriptor
|
||||
// function.
|
||||
BOOL CreateMyDACL(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.
|
||||
TCHAR* 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);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
@@ -10,5 +10,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <windows.h>
|
||||
#include <sddl.h>
|
||||
#include <stdio.h>
|
||||
int protect_file(char* path);
|
||||
int unprotect_file(char* path);
|
||||
Binary file not shown.
@@ -1,3 +1,2 @@
|
||||
client_backend.cpp
|
||||
x64\Debug\app_ctrl.obj : warning LNK4042: Objekt mehrmals angegeben; zusätzliche Objekte werden ignoriert.
|
||||
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user