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
#!/bin/bash : > /tmp/mail today=$(date +%d/%b/%Y --date="yesterday") grep -i $today /var/log/httpd/xxxxxxxx.henriaanstoot.nl-access.log | cut -f1,7 -d" " | grep /$ | grep -v feed > /tmp/today nslookup friendofmine.nl | grep Address | tail -1 | cut -f2 -d" " > /tmp/ipcheck nslookup myworkgateway | grep Address | tail -1 | cut -f2 -d" " >> /tmp/ipcheck nslookup xxxx.dyndns.org | grep Address | tail -1 | cut -f2 -d" " >> /tmp/ipcheck echo "192.168.1.99" >> /tmp/ipcheck cat /tmp/ipcheck | while read; do grep "$REPLY " /tmp/today >> /tmp/mail done 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
#!/bin/sh echo Content-type: image/jpeg echo cat /var/lib/httpd/htdocs/banners/logo.jpg bwavplay /data/test.wav > /dev/null echo ACCESS | mail email@example.com -s "Archive Site Accessed"