#!/bin/bash echo "Content-Type: text/plain" echo Q=$(echo "$QUERY_STRING" | sed -n 's/^.*q=\([^&]*\).*$/\1/p' | sed "s/%20/ /g; s/%2F/\//g; s/%5C/\\\/g" | sed "s/+/ /g; s/%2B/+/") if [[ $Q ]] then (grep "$Q" bl.txt lists/* || echo "# 0 Not found in blacklist") | head -n 1 else cat < query string # # shoxf bl outputs data in tsv format. a typical responce would look like: # bl.txt:127.0.0.1 # but there is sometimes additional info after a # # if any lines not starting with # are seen, # consider it listed # EOF echo "# total listed ips: "$(wc -l bl.txt lists/* | tail -n 1) fi