Skip to content

Commit

Permalink
precommit fixes (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorwalton authored Sep 3, 2024
1 parent 86417c9 commit c8eae67
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
19 changes: 7 additions & 12 deletions backend/app/agents/wazuh/services/vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from app.connectors.wazuh_indexer.utils.universal import create_wazuh_indexer_client
from app.connectors.wazuh_manager.utils.universal import send_get_request


# async def collect_agent_vulnerabilities(agent_id: str, vulnerability_severity: str):
# """
# Collect agent vulnerabilities from Wazuh Manager.
Expand Down Expand Up @@ -41,6 +40,7 @@
# message="Vulnerabilities collected successfully",
# )


async def collect_agent_vulnerabilities(agent_id: str, vulnerability_severity: str):
"""
Collect agent vulnerabilities from Wazuh Manager.
Expand Down Expand Up @@ -150,21 +150,16 @@ async def collect_vulnerabilities(es, vulnerabilities_indices, agent_id, vulnera
"bool": {
"must": [
{"match": {"agent.id": agent_id}},
{"terms": {"vulnerability.severity": ["Low", "Medium", "High", "Critical"]}}
]
}
}
{"terms": {"vulnerability.severity": ["Low", "Medium", "High", "Critical"]}},
],
},
},
}
else:
query = {
"query": {
"bool": {
"must": [
{"match": {"agent.id": agent_id}},
{"match": {"vulnerability.severity": vulnerability_severity}}
]
}
}
"bool": {"must": [{"match": {"agent.id": agent_id}}, {"match": {"vulnerability.severity": vulnerability_severity}}]},
},
}

page = es.search(index=index, body=query, scroll="2m")
Expand Down
1 change: 0 additions & 1 deletion backend/app/connectors/velociraptor/services/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ async def run_file_collection(
)



async def run_remote_command(run_command_body: RunCommandBody) -> RunCommandResponse:
"""
Run a remote command on a client.
Expand Down
5 changes: 3 additions & 2 deletions backend/app/schedulers/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from app.schedulers.models.scheduler import JobMetadata
from app.schedulers.services.agent_sync import agent_sync
from app.schedulers.services.invoke_alert_creation import invoke_alert_creation_collect
from app.schedulers.services.invoke_sigma_queries import invoke_sigma_queries_collect
from app.schedulers.services.invoke_carbonblack import (
invoke_carbonblack_integration_collect,
)
Expand Down Expand Up @@ -56,6 +55,7 @@
from app.schedulers.services.invoke_sap_siem import (
invoke_sap_siem_integration_suspicious_logins_analysis,
)
from app.schedulers.services.invoke_sigma_queries import invoke_sigma_queries_collect
from app.schedulers.services.wazuh_index_resize import resize_wazuh_index_fields


Expand Down Expand Up @@ -165,6 +165,7 @@ async def initialize_job_metadata():
job_metadata.enabled = True
await session.commit()


async def disable_job(session, job_id):
"""
Disables a job in the database based on the job ID.
Expand Down Expand Up @@ -193,7 +194,7 @@ async def schedule_enabled_jobs(scheduler):
"invoke_wazuh_monitoring_alert",
"invoke_suricata_monitoring_alert",
"invoke_office365_exchange_online_alert",
"invoke_office365_threat_intel_alert"
"invoke_office365_threat_intel_alert",
]

# Disable each job in the list
Expand Down
2 changes: 1 addition & 1 deletion backend/app/schedulers/services/invoke_sigma_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from loguru import logger
from sqlalchemy.future import select

from app.db.db_session import get_db_session
from app.connectors.wazuh_indexer.routes.sigma import run_active_sigma_queries_endpoint
from app.db.db_session import get_db_session
from app.schedulers.models.scheduler import JobMetadata


Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,4 @@
"engines": {
"node": ">=18.0.0"
}
}
}

0 comments on commit c8eae67

Please sign in to comment.