Skip to content

Commit

Permalink
fix: corrections applied. #3085
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromalara committed Jul 26, 2022
1 parent 8065c8d commit 97856db
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 32 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
name:
- epel-release
state: present
when: ( ansible_facts['distribution'] == "CentOS" and "epel" not in check_epel_release.stdout)
when: '"epel" not in check_epel_release.stdout'

- name: Check if yara is installed
shell: rpm -qa yara
Expand All @@ -115,7 +115,7 @@
name:
- yara
state: present
when: ( ansible_facts['distribution'] == "CentOS" and "yara" not in check_yara.stdout)
when: '"yara" not in check_yara.stdout'

- name: Create a directory to store malware
file:
Expand All @@ -139,4 +139,4 @@
name:
- jq
state: present
when: ( ansible_facts['distribution'] == "CentOS" and "jq" not in check_jq.stdout)
when: '"jq" not in check_jq.stdout'
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
- name: Truncate alerts file
shell: echo "" > {{ alerts_path }}

- name: Wait until the server is ready
wait_for:
timeout: 5

- name: Download malware
script: "{{ MALWARE_DOWNLOADER_SCRIPT }}"
shell: curl -s -XGET {{ url }} -o "/tmp/yara/malware/mirai"

- name: Wait for alerts to be generated
wait_for:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
configuration_parameters: null
metadata:
extra_vars:
MALWARE_DOWNLOADER_SCRIPT: CUSTOM_MALWARE_SCRIPT_PATH
url: https://wazuh-demo.s3-us-west-1.amazonaws.com/mirai
rule.id: 108001
rule.level: 12
rule.description: 'File \\"/tmp/yara/malware/mirai\\" is a positive match. Yara rule: Mirai_Botnet_Malware_RID2EF6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@

# Custom paths
yara_script = os.path.join(test_data_path, 'configuration', 'yara.sh')
malware_downloader_script = os.path.join(test_data_path, 'configuration', 'malware_downloader.sh')

# Update configuration with custom paths
configuration_metadata = config.update_configuration_template(configuration_metadata, ['CUSTOM_MALWARE_SCRIPT_PATH'],
[malware_downloader_script])
configuration_extra_vars = {'yara_script': yara_script}


Expand All @@ -50,7 +45,7 @@ def test_yara_integration(configure_environment, metadata, get_dashboard_credent

# Check that alert has been raised and save timestamp
raised_alert = evm.check_event(callback=expected_alert_json, file_to_monitor=alerts_json,
error_message='The alert has not occurred').result()
timeout=1, error_message='The alert has not occurred').result()
raised_alert_timestamp = raised_alert.group(1)

query = e2e.make_query([
Expand Down

0 comments on commit 97856db

Please sign in to comment.