Skip to main content

watch file for changes

I stuck this in the pentesting area but this script is great for watching a file for changes of specific content (in this case the word LAPS) and then sends the context of the file alert.txt to comms channels of your choice using notify.

#!/bin/bash

tail -Fn0 /home/kali/ntlmrelay.log | \
while read line; do
echo "$line" | grep -i "LAPS" &> /dev/null
if [ $? = 0 ]; then
/home/kali/notify -p discord -i /home/kali/alert.txt
fi
done