(2019-09-18)
Problem
I want systems I deploy here and there to send beacon pings back to head office.
Solution
#!/bin/bash# Beacon ping to 436-front so we can locate the tap.
# Characteristics to help identify it:
# - the ICMP packet size will be 436 bytes (ie: our street address)
# - the payload pattern is the system name in hex
# Invoke from cron regularly; ie every minute or every five minutes.
# Locate:
# $ tcpdump -nni $IF -X icmp and host 139.60.169.2
# $ tcpdump -r $CAPTURE-FILE -nn -X icmp and host 139.60.169.2
# System name in hex, one space, no null-terminator:
NAME=`uname -n`
HEX=`echo "$NAME " | xxd -p | sed -e 's/0a$//'`# Give me a ping Vasili, one ping only please. </RedOctober>
ping -c 1 -w 1 -s 428 -q -p $HEX -n 139.60.16i8.32 > /var/tmp/beacon.last
Commentary
This probably isn't the stupidest computer trick I've ever done, but it's right up there.