Last active
May 25, 2023 09:46
-
-
Save LaurenceJJones/4314730b47cad57bcc8ff576c87fa3ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmp_d=$(mktemp -d) | |
tmp_f="$tmp_d/crowdsec.csv" | |
curr_dec=$(cscli -ojson decisions list -a | jq '.[].decisions |.[] | select(.duration | contains("-") | not) | .value') | |
echo "duration,scope,value" > $tmp_f | |
while read -r -s i; | |
do | |
echo "$curr_dec" | grep -qw "$i" | |
if [ ! "$?" -eq 0 ]; then | |
echo "24h,ip,$i" >> $tmp_f | |
fi | |
done | |
cscli decisions import -i $tmp_f | |
rm -r $tmp_d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script takes a list of IP's from stdin, checks if they are already imported + have an active decision if not imports them again
wget -qO- https://raw.githubusercontent.com/SecOps-Institute/Tor-IP-Addresses/master/tor-exit-nodes.lst | ./crowdsec_iplist_importer.sh