diff --git a/src/server/cyberhex-code/api/php/database/compile_database.php b/src/server/cyberhex-code/api/php/database/compile_database.php index ca41b6c..9f417c7 100644 --- a/src/server/cyberhex-code/api/php/database/compile_database.php +++ b/src/server/cyberhex-code/api/php/database/compile_database.php @@ -1,6 +1,6 @@ connect_error) { + $success=0; + die("Connection failed: " . $conn->connect_error); +} +// Load excluded hashes from sig_ex table +$excluded = array(); +$sql = "SELECT signature FROM sig_ex"; +$result = $conn->query($sql); +if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $excluded[] = $row["hash"]; + } +} + +// Load included hashes from sig_in table +$included = array(); +$sql = "SELECT signature FROM sig_in"; +$result = $conn->query($sql); +if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $included[] = $row["hash"]; + } +} + +// Close the database connection +$conn->close(); + +// Add included array to output files this will then be processed like any other normal input file +file_put_contents("/var/www/html/database_srv/included_hashes.txt", implode(PHP_EOL, $included)); + +// This code updates and compiles our databases $directory = '/var/www/html/database_srv'; // Path to the directory // Get a list of all files in the directory @@ -67,7 +110,5 @@ foreach ($files as $file) { } } set_time_limit(0); -download_files(); - - +download_files($excluded); ?> 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 39bbaf1..9c901b0 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 @@ -123,7 +123,7 @@ async function add_item(db,element_id1,field1,element_id2,field2){ //we have two Excluded signatures