Skip to content

Commit

Permalink
Merge pull request #1496 from wazuh/1261-cve-alerts-inventory
Browse files Browse the repository at this point in the history
CVEs alerts inventory for Vulnerability Detector - Vulnerability Detector Integration Tests implementation
  • Loading branch information
DProvinciani authored Nov 9, 2021
2 parents 2c2bd04 + d5341b9 commit dae6d59
Show file tree
Hide file tree
Showing 79 changed files with 3,999 additions and 928 deletions.
5 changes: 2 additions & 3 deletions deps/wazuh_testing/wazuh_testing/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import time

import pytest
import wazuh_testing.tools as tools
import wazuh_testing.tools.agent_simulator as ag
from wazuh_testing import TCP, UDP
from wazuh_testing.tools import file, monitoring
import wazuh_testing.tools as tools
from wazuh_testing import UDP, TCP
from wazuh_testing.tools.monitoring import FileMonitor
from wazuh_testing.tools.services import control_service

Expand Down
5 changes: 3 additions & 2 deletions deps/wazuh_testing/wazuh_testing/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
PREFIX = os.sep

WAZUH_CONF_RELATIVE = os.path.join('etc', 'ossec.conf')
WAZUH_LOCAL_INTERNAL_OPTIONS = os.path.join(f'{WAZUH_PATH}/etc', 'local_internal_options.conf')
WAZUH_LOCAL_INTERNAL_OPTIONS = os.path.join(WAZUH_PATH, 'etc', 'local_internal_options.conf')
WAZUH_CONF = os.path.join(WAZUH_PATH, WAZUH_CONF_RELATIVE)
WAZUH_API_CONF = os.path.join(WAZUH_PATH, 'api', 'configuration', 'api.yaml')
WAZUH_SECURITY_CONF = os.path.join(WAZUH_PATH, 'api', 'configuration', 'security', 'security.yaml')
Expand All @@ -58,7 +58,7 @@
ANALYSIS_STATISTICS_FILE = os.path.join(WAZUH_PATH, 'var', 'run', 'wazuh-analysisd.state')
UPGRADE_PATH = os.path.join(WAZUH_PATH, 'var', 'upgrade')
AGENT_AUTH_BINARY_PATH = os.path.join(WAZUH_PATH, 'bin', 'agent-auth')

GLOBAL_DB_PATH = os.path.join(WAZUH_PATH, 'queue', 'db', 'global.db')

try:
import grp
Expand Down Expand Up @@ -109,6 +109,7 @@ def get_service():

WAZUH_LOGS_PATH = os.path.join(WAZUH_PATH, 'logs')
ALERT_FILE_PATH = os.path.join(WAZUH_LOGS_PATH, 'alerts', 'alerts.json')
ALERT_LOGS_PATH = os.path.join(WAZUH_LOGS_PATH, 'alerts', 'alerts.log')
CLUSTER_LOGS_PATH = os.path.join(WAZUH_LOGS_PATH, 'cluster.log')
QUEUE_SOCKETS_PATH = os.path.join(WAZUH_PATH, 'queue', 'sockets')
QUEUE_ALERTS_PATH = os.path.join(WAZUH_PATH, 'queue', 'alerts')
Expand Down
15 changes: 15 additions & 0 deletions deps/wazuh_testing/wazuh_testing/tools/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,18 @@ def time_to_seconds(time_):
def get_current_timestamp():
"""Get the current timestamp. For example: 1627028708.303002"""
return datetime.now().timestamp()


def interval_to_time_modifier(interval):
"""Convert a string with format (1s, 1m, 1h, 1d) to SQLite date modifier.
Args:
interval (str): Time interval string.
Returns:
str: SQLite date modifier.
"""
interval_units_dict = {'s': 'seconds', 'm': 'minutes', 'h': 'hours', 'd': 'days'}
time_value = interval[:-1]
time_unit = interval[-1]
return f"{time_value} {interval_units_dict[time_unit]}"
Loading

0 comments on commit dae6d59

Please sign in to comment.