Tracking ip/access websites

Last Updated or created 2022-11-15

I wanted to know when a certain webpage was being accessed.
Also when an archive website was being accessed.

So I used below scripts

This one checks the apache log file, using a bash script which was being run every night at 0:00

: > /tmp/mail
today=$(date +%d/%b/%Y --date="yesterday")
grep -i $today /var/log/httpd/ | cut -f1,7 -d" " | grep /$ | grep -v feed > /tmp/today

nslookup | grep Address | tail -1 | cut -f2 -d" " > /tmp/ipcheck
nslookup myworkgateway | grep Address | tail -1 | cut -f2 -d" " >> /tmp/ipcheck
nslookup | grep Address | tail -1 | cut -f2 -d" " >> /tmp/ipcheck
echo "" >> /tmp/ipcheck

cat /tmp/ipcheck | while read; do
grep "$REPLY " /tmp/today >> /tmp/mail
cat /tmp/mail | mutt -s "ipgrabber" fash@mailserver

The script which tracked a certain webpage realtime was using something like a pixel tracker. But it was a complete logo.

I created a cgi-bin bash script which, when called, just printed a jpg with the correct headers, and because the server was in my room, it played a soundfile over the speakers also.

Just place the following part somewhere in your webpage

echo Content-type: image/jpeg
cat /var/lib/httpd/htdocs/banners/logo.jpg
bwavplay /data/test.wav > /dev/null
echo ACCESS | mail -s "Archive Site Accessed"