1
0
Fork 0
mirror of synced 2025-07-04 20:36:42 +02:00
This commit is contained in:
Mason Simon 2018-03-30 17:47:17 -07:00
commit 21582cc86a
21 changed files with 677 additions and 0 deletions

View file

@ -0,0 +1,18 @@
error_log logs/error.log;
events {}
http {
log_format main '$ipscrub_hash_debug';
access_log logs/access.log main;
ipscrub_period_seconds 2;
server {
listen 8081;
# listen [::]:8081 ipv6only=off;
server_name localhost;
}
}

View file

@ -0,0 +1,16 @@
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
input="asdf"
curl "http://localhost:8081/$input" > /dev/null 2> /dev/null
output=$(tail -n 1 dest/logs/access.log)
# -n excludes newline
# cut -c-40 takes first 40 chars (shasum outputs 160 bits in hex)
# xxd converts hex to binary
# base64 converts binary to ascii
clihash=$(echo -n "/$input" | shasum | cut -c-40 | xxd -r -p | base64)
[[ $clihash == $output ]] && printf "%s\n" "${grn}PASS${end}" || printf "%s\n" "${red}FAIL${end}"