Skip to content

Instantly share code, notes, and snippets.

@acnrayd
Created November 30, 2020 08:16
Show Gist options
  • Save acnrayd/b6f4ace9494e64aee2c095f6e927abac to your computer and use it in GitHub Desktop.
Save acnrayd/b6f4ace9494e64aee2c095f6e927abac to your computer and use it in GitHub Desktop.
KATA/KEDR Prevention Rule Batch Add
#!/bin/bash
# KATAP/KEDR batch prevention rule ekleme script'i. KATA IP, Port, User ve PASS kısmını degistirmeyi unutmayin.
#set -x
INPUT=$1
KATA_IP="10.67.148.223"
KATA_PORT="8443"
USER="SSO"
PASS="Kaspersky"
while read -r line
do
curl -s --output /dev/null -c ./cookie -k -X POST -H 'Content-Type: application/json' -d "{\"username\":\"$USER\",\"password\":\"$PASS\","local":false}" https://$KATA_IP:$KATA_PORT/apt/api/userLogin
curl -s -b ./cookie -k -X POST -H 'Content-Type: application/json' -H "Referer: https://$KATA_IP:$KATA_PORT/katap/" -d "[{\"file_hash\":\"$line\",\"notify_user\":true,\"name\":\"$line\",\"enable\":true,\"hosts\":[\"all\"]}]" https://$KATA_IP:$KATA_PORT/apt/api/addAgentPreventions
done < "$INPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment