thelonelycoder
Part of the Furniture
Diversion has command switches, one isApologies: I did not mean ‘long winded’ in any negative way.
I was just looking if there was a direct command line way to figure out the latest blocked domains by IP address.
I was looking for some direct way... something like
or something similar.Code:tail -f /opt/var/dnsmasq.log | grep 'searchvalue'
Is there any unique identifier/ keyword in each individual line item of dnsmasq log that indicates that the domain has been blocked?
diversion f
as you might know does follow the log with slightly modified easier readable output.It is the option 1. Unfiltered log in the f menu structure.
There are no further switches built in for the other four options for simplicity.
The full code for 4. Blocked domains, by device IP is this, expecting some variables being set to work:
Code:
tail -F "${LOG_DIR}/dnsmasq.$log" | \
while read line; do
if echo "$line" | /opt/bin/grep -q "list/blockinglist\|list/blacklist\|list/yt_blacklist\| config .* is $blockingIP" && echo "$line" | /opt/bin/grep -q " $(echo $deviceIP | sed -e 's/\./\\./g')/"; then
printf "%-43s%s\\n" "${GRAY} $( echo $line | awk '{print $3, "blocked by " $(NF-3)}' | sed 's|/opt/share/diversion/list/||;s|config|wc-blacklist|')${NC} " "${RED}$( echo $line | awk '{print $(NF-2)}')${NC}"
fi
done