update
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,10 +20,11 @@
|
|||||||
int main() {
|
int main() {
|
||||||
log(LOGLEVEL::INFO, "[main()]:Starting main thread.");
|
log(LOGLEVEL::INFO, "[main()]:Starting main thread.");
|
||||||
printf("welcome to the jakach security tool main thread\n");
|
printf("welcome to the jakach security tool main thread\n");
|
||||||
load_settings();
|
load_settings();//load the settings from the settings file
|
||||||
initialize(DB_DIR);
|
initialize(DB_DIR); //load the hash databases into memory
|
||||||
|
|
||||||
//start a second thread which will scan for new files
|
//start a second thread which will scan for new files
|
||||||
if (get_setting("rtp:status") == 1) {
|
if (get_setting("rtp_folder_scan:status") == 1) {
|
||||||
log(LOGLEVEL::INFO, "[main()]:Starting real time protection.");
|
log(LOGLEVEL::INFO, "[main()]:Starting real time protection.");
|
||||||
std::thread folder_scannner_thread(folder_scanner);
|
std::thread folder_scannner_thread(folder_scanner);
|
||||||
folder_scannner_thread.detach();
|
folder_scannner_thread.detach();
|
||||||
@@ -42,12 +43,9 @@ int main() {
|
|||||||
//check for tasks in com
|
//check for tasks in com
|
||||||
//check for scheduled tasks
|
//check for scheduled tasks
|
||||||
//execute tasks
|
//execute tasks
|
||||||
//call_srv("8.8.8.8","","");
|
|
||||||
auto start = std::chrono::high_resolution_clock::now();
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
// printf("check_from_com:%d\n",check_for_com_tasks(MAIN_COM, MAIN_COM_PATH));
|
check_for_com_tasks(MAIN_COM, MAIN_COM_PATH); //check for tasks from user interface and add them to the queue
|
||||||
check_for_com_tasks(MAIN_COM, MAIN_COM_PATH);
|
check_for_sched_tasks(SCHED, SCHED_PATH); //check for scheduled tasks and add them to the queue
|
||||||
check_for_sched_tasks(SCHED, SCHED_PATH);
|
|
||||||
// printf("check_from_task:%d\n", check_for_sched_tasks(SCHED,SCHED_PATH));
|
|
||||||
//unlock_task("tsk1"); else it will only be executed once. but this function has to be called at the end of the task. else it will nvr be executed again. this would be bad :(
|
//unlock_task("tsk1"); else it will only be executed once. but this function has to be called at the end of the task. else it will nvr be executed again. this would be bad :(
|
||||||
//start a thread that executes check_scan_dir to scan folders for new files. this thread then should start a ock so only one scanfolder thread runs at a time
|
//start a thread that executes check_scan_dir to scan folders for new files. this thread then should start a ock so only one scanfolder thread runs at a time
|
||||||
//Sleep(1000);
|
//Sleep(1000);
|
||||||
@@ -68,8 +66,6 @@ int main() {
|
|||||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
|
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
|
||||||
if (duration.count() < 1000)
|
if (duration.count() < 1000)
|
||||||
Sleep(1000 - duration.count());
|
Sleep(1000 - duration.count());
|
||||||
|
|
||||||
// printf("\n\n\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ int check_for_com_tasks(const char* com_name, const char* com_path) {
|
|||||||
queue_entry[0] = '\0';
|
queue_entry[0] = '\0';
|
||||||
strcpy_s(queue_entry,600, command); //copy the command
|
strcpy_s(queue_entry,600, command); //copy the command
|
||||||
strcat_s(queue_entry, 600, ";"); //add a ; to seperate command and path
|
strcat_s(queue_entry, 600, ";"); //add a ; to seperate command and path
|
||||||
//printf("%d\n", strlen(path));
|
|
||||||
strcat_s(queue_entry, 600, path); //add the path
|
strcat_s(queue_entry, 600, path); //add the path
|
||||||
//printf("%s::%d\n",queue_entry,strlen(queue_entry));
|
|
||||||
|
|
||||||
queue_push(queue_entry);
|
queue_push(queue_entry);
|
||||||
//(queue_entry);
|
//(queue_entry);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ bool is_task_due(const std::string& task_name, const std::string& cron_expressio
|
|||||||
is_valid_field(fields[3], current_time.tm_mon + 1) &&
|
is_valid_field(fields[3], current_time.tm_mon + 1) &&
|
||||||
is_valid_field(fields[4], current_time.tm_wday + 1)) {
|
is_valid_field(fields[4], current_time.tm_wday + 1)) {
|
||||||
|
|
||||||
// Check if the task has already been executed
|
// Check if the task has not already been executed
|
||||||
if (!task_states[task_name]) {
|
if (!task_states[task_name]) {
|
||||||
// Set the flag to indicate that the task has been executed
|
// Set the flag to indicate that the task has been executed
|
||||||
task_states[task_name] = true;
|
task_states[task_name] = true;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "queue_ctrl.h"
|
#include "queue_ctrl.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define queue_limit 1000
|
#define queue_limit 1000
|
||||||
#define command_limit 300
|
#define command_limit 3000
|
||||||
char queue[queue_limit][command_limit];
|
char queue[queue_limit][command_limit];
|
||||||
int queue_size = 0;
|
int queue_size = 0;
|
||||||
int queue_start = 0;
|
int queue_start = 0;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ void scan_folder(const std::string& directory) {
|
|||||||
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
|
HANDLE hFind = FindFirstFile(search_path.c_str(), &find_file_data);
|
||||||
|
|
||||||
if (hFind == INVALID_HANDLE_VALUE) {
|
if (hFind == INVALID_HANDLE_VALUE) {
|
||||||
log(LOGLEVEL::ERR, "[ListFilesRecursive()]: Error opening directory: ", directory, " while scanning files inside folder.");
|
log(LOGLEVEL::ERR, "[scan_folder()]: Error opening directory: ", search_path.c_str() , " while scanning files inside folder.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,9 @@ void action_scanfile(const char*filepath) {
|
|||||||
}
|
}
|
||||||
void action_scanfolder(const char*folderpath) {
|
void action_scanfolder(const char*folderpath) {
|
||||||
thread_init();
|
thread_init();
|
||||||
scan_folder(folderpath);
|
cnt = 0;
|
||||||
|
thread_local std::string folderpath_ (folderpath);
|
||||||
|
scan_folder(folderpath_);
|
||||||
thread_shutdown();
|
thread_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ int setting_virus_ctrl_virus_found_action = 0;
|
|||||||
char*setting_server_server_url = new char[300];
|
char*setting_server_server_url = new char[300];
|
||||||
char exluded_folders[100][300];
|
char exluded_folders[100][300];
|
||||||
int excluded_folders_size = 0;
|
int excluded_folders_size = 0;
|
||||||
bool setting_rtp_status = 1; //0=off, 1=on
|
bool setting_rtp_folder_scan_status = 1; //0=off, 1=on
|
||||||
void load_excluded_folders();
|
void load_excluded_folders();
|
||||||
int load_settings() {
|
int load_settings() {
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
@@ -41,13 +41,13 @@ int load_settings() {
|
|||||||
fscanf_s(fp, "%s", settings_arg, 295); // get the argument
|
fscanf_s(fp, "%s", settings_arg, 295); // get the argument
|
||||||
strcpy_s(setting_server_server_url, 295, settings_arg);
|
strcpy_s(setting_server_server_url, 295, settings_arg);
|
||||||
}
|
}
|
||||||
else if (strcmp(settings_cmd, "rtp:status") == 0) {
|
else if (strcmp(settings_cmd, "rtp_folder_scan:status") == 0) {
|
||||||
fscanf_s(fp, "%s", settings_arg, 295); // get the argument
|
fscanf_s(fp, "%s", settings_arg, 295); // get the argument
|
||||||
if (strcmp(settings_arg, "on") == 0) {
|
if (strcmp(settings_arg, "on") == 0) {
|
||||||
setting_rtp_status = 1; //1=on
|
setting_rtp_folder_scan_status = 1; //1=on
|
||||||
}
|
}
|
||||||
else if (strcmp(settings_arg, "off") == 0) {
|
else if (strcmp(settings_arg, "off") == 0) {
|
||||||
setting_rtp_status = 0; //0=off
|
setting_rtp_folder_scan_status = 0; //0=off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +67,8 @@ int get_setting(const char*setting_name) {
|
|||||||
if (strcmp(setting_name, "virus_ctrl:virus_found:action") == 0) {
|
if (strcmp(setting_name, "virus_ctrl:virus_found:action") == 0) {
|
||||||
return setting_virus_ctrl_virus_found_action;
|
return setting_virus_ctrl_virus_found_action;
|
||||||
}
|
}
|
||||||
else if (strcmp(setting_name, "rtp:status") == 0) {
|
else if (strcmp(setting_name, "rtp_folder_scan:status") == 0) {
|
||||||
return setting_rtp_status;
|
return setting_rtp_folder_scan_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -115,9 +115,9 @@ void load_excluded_folders() {
|
|||||||
log(LOGLEVEL::ERR, "[load_excluded_folders()]: Excluded folders array is full. Cannot add more folders.");
|
log(LOGLEVEL::ERR, "[load_excluded_folders()]: Excluded folders array is full. Cannot add more folders.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
//else { we dont need to error out here. it is normal that it givs errors at the last lien of the file. but nothing bad happens, so errors arent needed
|
||||||
log(LOGLEVEL::ERR, "[load_excluded_folders()]: Error while processing excluded folders database. Expected \" but got ", chr);
|
// log(LOGLEVEL::ERR, "[load_excluded_folders()]: Error while processing excluded folders database. Expected \" but got ", chr);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
delete[] path;
|
delete[] path;
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
#include "well_known.h"
|
#include "well_known.h"
|
||||||
#include "scan.h"
|
#include "scan.h"
|
||||||
#include "app_ctrl.h"
|
#include "app_ctrl.h"
|
||||||
void split(char* input,char*delimiter, char* out1, char* out2) {
|
void split(char* input,const char delimiter, char* out1, char* out2) {
|
||||||
//split a string at the delimiter. the delimiter only occurs once. so the first part is out1 and the second part is out2
|
//split a string at the delimiter. the delimiter only occurs once. so the first part is out1 and the second part is out2
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (input[i] != '\0') {
|
while (input[i] != '\0') {
|
||||||
if (input[i] == delimiter[0]) {
|
if (input[i] == delimiter) {
|
||||||
out1[j] = '\0';
|
out1[j] = '\0';
|
||||||
i++;
|
i++;
|
||||||
while (input[i] != '\0') {
|
while (input[i] != '\0') {
|
||||||
@@ -33,18 +33,25 @@ int start_thread(const char* command) {
|
|||||||
if (can_run_thread()) {
|
if (can_run_thread()) {
|
||||||
char* out2 = new char[100]; //for the command
|
char* out2 = new char[100]; //for the command
|
||||||
char* out1 = new char[300]; //for the arguments
|
char* out1 = new char[300]; //for the arguments
|
||||||
split((char*)command, (char*)";", (char*)out1, (char*)out2);
|
split((char*)command,';', (char*)out1, (char*)out2);
|
||||||
|
log(LOGLEVEL::INFO, "[start_thread()]: starting command: ", out1, " with arguments: ",out2);
|
||||||
//printf("out1: %s\n", out1);
|
//printf("out1: %s\n", out1);
|
||||||
//printf("out2: %s\n", out2);
|
//printf("out2: %s\n", out2);
|
||||||
//determine what should be executed
|
//determine what should be executed
|
||||||
if (strcmp(out1, "scanfile") == 0) {
|
if (strcmp(out1, "scanfile") == 0) {
|
||||||
//start a new thread with the scanfile function
|
//start a new thread with the scanfile function
|
||||||
std::thread t1(action_scanfile, out2);
|
std::thread t1(action_scanfile, out2);
|
||||||
|
t1.detach();
|
||||||
}
|
}
|
||||||
else if (strcmp(out1, "scanfolder") == 0) {
|
else if (strcmp(out1, "scanfolder") == 0) {
|
||||||
//start a new thread with the scanfolder function
|
//start a new thread with the scanfolder function
|
||||||
std::thread t1(action_scanfolder, out2);
|
std::thread t1(action_scanfolder, out2);
|
||||||
|
t1.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (can_run_thread()) {
|
||||||
|
//delay a bit, in order to wait until the thread is started
|
||||||
|
Sleep(10);
|
||||||
}
|
}
|
||||||
delete[] out1;
|
delete[] out1;
|
||||||
delete[] out2;
|
delete[] out2;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#ifndef UPDATE_H
|
#ifndef UPDATE_H
|
||||||
#define UPDATE_H
|
#define UPDATE_H
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
#include<string>
|
||||||
int update_db(const std::string& folder_path);
|
int update_db(const std::string& folder_path);
|
||||||
int update_settings(const std::string& folder_path);
|
int update_settings(const std::string& folder_path);
|
||||||
#endif
|
#endif
|
||||||
@@ -101,9 +101,9 @@ int virus_ctrl_process( const char* id) {
|
|||||||
delete[] url_path;
|
delete[] url_path;
|
||||||
delete[] additional;
|
delete[] additional;
|
||||||
}
|
}
|
||||||
else {
|
//else { creates to many log entrys => entrys are not needed
|
||||||
log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while processing virus control database. Expected \" but got ", chr);
|
// log(LOGLEVEL::ERR, "[virus_ctrl_process()]:Error while processing virus control database. Expected \" but got ", chr);
|
||||||
}
|
//}
|
||||||
delete[] path;
|
delete[] path;
|
||||||
delete[] hash;
|
delete[] hash;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#define WELL_KNOWN_H
|
#define WELL_KNOWN_H
|
||||||
#define MAIN_COM "main_com.txt"
|
#define MAIN_COM "main_com.txt"
|
||||||
#define MAIN_COM_PATH "C:\\Program Files\\cyberhex\\com\\main_com.txt"
|
#define MAIN_COM_PATH "C:\\Program Files\\cyberhex\\com\\main_com.txt"
|
||||||
|
#define ANSWER_COM "answer_com.txt"
|
||||||
|
#define ANSWER_COM_PATH "C:\\Program Files\\cyberhex\\com\\answer_com.txt"
|
||||||
|
|
||||||
#define SECURE_COM "secure_com.txt"
|
#define SECURE_COM "secure_com.txt"
|
||||||
#define SECURE_COM_PATH "C:\\Program Files\\cyberhex\\secure\\com\\secure_com.txt"
|
#define SECURE_COM_PATH "C:\\Program Files\\cyberhex\\secure\\com\\secure_com.txt"
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +1,2 @@
|
|||||||
Quellen werden auf Modulabhängigkeiten überprüft...
|
Quellen werden auf Modulabhängigkeiten überprüft...
|
||||||
update.cpp
|
|
||||||
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
client_backend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_backend\x64\Debug\client_backend.exe
|
||||||
|
|||||||
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.
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Check if the user is logged in
|
||||||
|
if (!isset($_SESSION['username']) or !isset($_SESSION["login"])) {
|
||||||
|
// Redirect to the login page or handle unauthorized access
|
||||||
|
header("Location: /login.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$username = $_SESSION['username'];
|
||||||
|
$perms = $_SESSION["perms"];
|
||||||
|
$email = $_SESSION["email"];
|
||||||
|
if($perms[5]!=="1"){
|
||||||
|
header("location:/system/insecure_zone/php/no_access.php");
|
||||||
|
$block=1;
|
||||||
|
exit();
|
||||||
|
}else{
|
||||||
|
$block=0;
|
||||||
|
}
|
||||||
|
//for the get_perms_str() function
|
||||||
|
include "perms_functions.php";
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
||||||
|
<title>Change Password</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4>Client settings</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="client_settings.php?update=true" method="post">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
|
||||||
|
<label class="form-check-label" for="flexSwitchCheckDefault">Default switch checkbox input</label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -66,13 +66,13 @@ if(isset($_GET["page"])){
|
|||||||
<p>Cyberhex settings</p>
|
<p>Cyberhex settings</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php?page=server_settings.php">Server Settings</a></li>
|
<li><a href="index.php?page=server_settings.php">Server Settings</a></li>
|
||||||
<li><a href="index.php?page=cleint_settings.php">Client Settings</a></li>
|
<li><a href="index.php?page=client_settings.php">Client Settings</a></li>
|
||||||
<li><a href="index.php?page=database_settings.php">Database Settings</a></li>
|
<li><a href="index.php?page=database_settings.php">Database Settings</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Clients</p>
|
<p>Clients</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php?page=mass_add_clients.php">Mass Add CLients</a></li>
|
<li><a href="index.php?page=mass_add_clients.php">Mass Add CLients</a></li>
|
||||||
<li><a href="index.php?page=add_cleint.php">Add Client</a></li>
|
<li><a href="index.php?page=add_client.php">Add Client</a></li>
|
||||||
<li><a href="index.php?page=client_list.php">Client List</a></li>
|
<li><a href="index.php?page=client_list.php">Client List</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user