updating communication
This commit is contained in:
Binary file not shown.
BIN
src/client_backend/.vs/client_backend/v17/Browse.VC.db-shm
Normal file
BIN
src/client_backend/.vs/client_backend/v17/Browse.VC.db-shm
Normal file
Binary file not shown.
@@ -22,7 +22,16 @@ int main() {
|
||||
log(LOGLEVEL::INFO, "[main()]:Starting main thread.");
|
||||
printf("welcome to the jakach security tool main thread\n");
|
||||
load_settings();//load the settings from the settings file
|
||||
if (update_settings()) { //update the settings from the server
|
||||
if (update_settings("settings")) { //update the settings from the server
|
||||
log(LOGLEVEL::ERR, "[main()]:Could not update settings from server.");
|
||||
}
|
||||
if (update_settings("rtp_included")) { //update the settings from the server
|
||||
log(LOGLEVEL::ERR, "[main()]:Could not update settings from server.");
|
||||
}
|
||||
if (update_settings("rtp_excluded")) { //update the settings from the server
|
||||
log(LOGLEVEL::ERR, "[main()]:Could not update settings from server.");
|
||||
}
|
||||
if (update_settings("sched")) { //update the settings from the server
|
||||
log(LOGLEVEL::ERR, "[main()]:Could not update settings from server.");
|
||||
}
|
||||
load_settings();
|
||||
|
||||
@@ -46,7 +46,7 @@ size_t write_callback(void* contents, size_t size, size_t nmemb, void* userp) {
|
||||
int download_file_from_srv(const char* url, const char* output_file_path) {
|
||||
//use curl to download a file from a server
|
||||
char*temp_path = new char[515];
|
||||
char* buf = new char[55];
|
||||
char* buf = new char[505];
|
||||
strcpy_s(temp_path,495, output_file_path);
|
||||
strcat_s(temp_path,505, ".temp");
|
||||
CURL* curl;
|
||||
@@ -84,7 +84,7 @@ int download_file_from_srv(const char* url, const char* output_file_path) {
|
||||
return 4;
|
||||
}
|
||||
else {
|
||||
fscanf(output_file, "%50s", buf);
|
||||
fscanf(output_file, "%500s", buf);
|
||||
if (strcmp(buf, "no_auth") == 0) {
|
||||
fclose(output_file);
|
||||
return 5;
|
||||
|
||||
@@ -6,11 +6,11 @@ int check_cert(const char*cert,const char*secrets_path) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
char*secrets = new char[300];
|
||||
char*secrets = new char[505];
|
||||
while (!feof(fp)) {
|
||||
fscanf_s(fp, "%s", secrets, 295); // get the secret
|
||||
fscanf_s(fp, "%s", secrets, 500); // get the secret
|
||||
if (strcmp("cert", secrets) == 0) {
|
||||
fscanf_s(fp, "%s", secrets, 295); // get the secret
|
||||
fscanf_s(fp, "%s", secrets, 500); // get the secret
|
||||
if (strcmp(cert, secrets) == 0) {
|
||||
delete[] secrets;
|
||||
return 0;
|
||||
@@ -28,11 +28,11 @@ char* get_apikey(const char* secrets_path) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
char*secrets = new char[300];
|
||||
char*secrets = new char[505];
|
||||
while (!feof(fp)) {
|
||||
fscanf_s(fp, "%s", secrets, 295); // get the secret
|
||||
fscanf_s(fp, "%s", secrets, 500); // get the secret
|
||||
if (strcmp("apikey", secrets) == 0) {
|
||||
fscanf_s(fp, "%s", secrets, 295); // get the secret
|
||||
fscanf_s(fp, "%s", secrets, 500); // get the secret
|
||||
return secrets;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "log.h"
|
||||
#include "connect.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "security.h"
|
||||
|
||||
int update_db(const std::string& folder_path) {
|
||||
//download the databases from the server
|
||||
@@ -40,12 +40,25 @@ int update_db(const std::string& folder_path) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int update_settings() {
|
||||
int update_settings(const char*settings_type) {
|
||||
//create the strings to download the files
|
||||
char* url = new char[500];
|
||||
char* url = new char[1000];
|
||||
get_setting("server:server_url", url);
|
||||
strcat_s(url, 500, "/api/php/settings/get_settings.php?settings");
|
||||
int res = download_file_from_srv(url, SETTINGS_DB);
|
||||
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_inlcuded") == 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) {
|
||||
log(LOGLEVEL::ERR, "[update_settings()]: Error downloading settings database file from server", url, " ERROR:",res);
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
#include <curl/curl.h>
|
||||
#include<string>
|
||||
int update_db(const std::string& folder_path);
|
||||
int update_settings();
|
||||
int update_settings(const char*settings_type);
|
||||
#endif
|
||||
Binary file not shown.
@@ -1,53 +1,3 @@
|
||||
Quellen werden auf Modulabhängigkeiten überprüft...
|
||||
check_dir.cpp
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\check_dir.cpp(361,7): warning C4101: "fp": Unreferenzierte lokale Variable
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53): warning C4244: "Argument": Konvertierung von "wchar_t" in "const _Elem", möglicher Datenverlust
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53): warning C4244: with
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53): warning C4244: [
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53): warning C4244: _Elem=char
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53): warning C4244: ]
|
||||
(Quelldatei „check_dir.cpp“ wird kompiliert)
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2749,53):
|
||||
der Vorlageninstanziierungskontext (der älteste zuerst) ist
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\check_dir.cpp(155,29):
|
||||
Siehe Verweis auf die gerade kompilierte Instanziierung "std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,0>(_Iter,_Iter,const _Alloc &)" der Funktions-Vorlage.
|
||||
with
|
||||
[
|
||||
_Elem=wchar_t,
|
||||
_Iter=std::_String_iterator<std::_String_val<std::_Simple_types<wchar_t>>>,
|
||||
_Alloc=std::allocator<char>
|
||||
]
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\check_dir.cpp(155,29):
|
||||
Ersten Verweis auf "std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string" in "process_changes" anzeigen
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xstring(2590,17):
|
||||
Siehe Verweis auf die gerade kompilierte Instanziierung "void std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Construct_from_iter<wchar_t*,wchar_t*,_Size_type>(_Iter,const _Sent,_Size)" der Funktions-Vorlage.
|
||||
with
|
||||
[
|
||||
_Size_type=unsigned __int64,
|
||||
_Iter=wchar_t *,
|
||||
_Sent=wchar_t *,
|
||||
_Size=unsigned __int64
|
||||
]
|
||||
|
||||
client_backend.cpp
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp(73,24): warning C4244: "Argument": Konvertierung von "_Rep" in "DWORD", möglicher Datenverlust
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp(73,24): warning C4244: with
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp(73,24): warning C4244: [
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp(73,24): warning C4244: _Rep=__int64
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\client_backend.cpp(73,24): warning C4244: ]
|
||||
connect.cpp
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\connect.cpp(118,65): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust möglich
|
||||
local_com.cpp
|
||||
local_schedule.cpp
|
||||
log.cpp
|
||||
md5hash.cpp
|
||||
scan.cpp
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\scan.cpp(153,32): warning C4018: ">=": Konflikt zwischen "signed" und "unsigned"
|
||||
security.cpp
|
||||
settings.cpp
|
||||
thread_ctrl.cpp
|
||||
update.cpp
|
||||
virus_ctrl.cpp
|
||||
Code wird generiert...
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\md5hash.cpp(36): warning C4715: "md5_file": Nicht alle Codepfade geben einen Wert zurück.
|
||||
LINK : fatal error LNK1168: "C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe" kann nicht zum Schreiben geöffnet werden.
|
||||
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.
@@ -10,6 +10,7 @@ C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\md5hash.cpp;C:\
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\permissions.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\permissions.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\queue _ctrl.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\queue _ctrl.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\scan.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\scan.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\security.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\security.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\settings.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\settings.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\thread_ctrl.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\thread_ctrl.obj
|
||||
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\update.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\update.obj
|
||||
|
||||
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