Added script for appending ips to blocklist

dehydrated
Felix Stupp 5 years ago
parent 81364e9bfe
commit d455d62dbf
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail;
LIST_FILE="$(dirname "$0")/ipv4.txt";
TMP_FILE="$(mktemp)";
IP_REGEX='(?<!\d)\d+(\.\d+){3}(?!\d)';
cat "$LIST_FILE" "$@" |
grep --only-matching --perl-regexp "$IP_REGEX" |
sort --version-sort |
uniq > "$TMP_FILE";
echo "$TMP_FILE";
if diff "$LIST_FILE" "$TMP_FILE"; then
echo "No differences found!";
exit 0;
fi
echo "Press enter to approve changes, ^C to abort";
read;
mv "$TMP_FILE" "$LIST_FILE";
Loading…
Cancel
Save