For future reference:
Running the script via wodle or cronjob works fine.
My main problem was that there were no alerts in the Wazuh Dashboard.
The cause was that my events didn't came from "microsoft_defender" but from "office_defender" so the rules couldn't match.
If you have the same problem just replace every "microsoft" with "office" in the
rules file and your good to go.
Only problem I have now is that the script pulls all alerts from the last hour no matter if they were pulled previously or not.
I've set the wodle interval to 1m to pull new alerts as quickly as possible because I actually use those events for incident response in TheHive.
I've edited the line in the defender_for_endpoint_alerts.py accordingly but I still get multiple alerts per Defender Event.
filterTime = datetime.utcnow() - timedelta(minutes= 1) #If you want to include alerts from longer then an hour, change here (days, weeks)
Is it possible to tell a rule that it should only trigger once per unique value in a field?
Fox example: office_defender.firstEventTime or data.office_defender.incidentId
The rule should only trigger again if the value in one of those fields changes.