Created
May 12, 2024 14:24
-
-
Save libcrack/c67f0e3bffc5b0a3ff032e199d212600 to your computer and use it in GitHub Desktop.
Script to extract allow and deny lists from pfblockerng in pfSense boxes
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
#!/bin/sh | |
# [email protected] | |
# Mon Sep 9 21:30:51 CEST 2019 | |
denylist=/root/dnsbl.deny | |
allowlist=/root/dnsbl.allow | |
allowtmp=/tmp/dnsbl_tmp.sup | |
logfile=/var/log/pfblockerng/dnsbl.log | |
if [ ! -f "${logfile}" ]; then | |
echo "ERROR: Cannot access ${logfile}" | |
exit 1 | |
fi | |
if [ ! -f "${allowtmp}" ]; then | |
echo "ERROR: Cannot access ${allowtmp}" | |
exit 2 | |
fi | |
/bin/cat "${logfile}" | /usr/bin/cut -f3 -d, | /usr/bin/sort -u > "${denylist}" | |
/bin/cat "${allowtmp}" | /usr/bin/cut -f2 -d\" | /usr/bin/cut -f1 -d' ' | /usr/bin/sort -u > "${allowlist}" | |
/usr/bin/wc -l "${denylist}" | |
/usr/bin/wc -l "${allowlist}" | |
exit ${?} | |
#EOF# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment