Initial commit

This commit is contained in:
Peter Packult 2011-09-09 20:15:42 +02:00
commit c00dc78f30
2 changed files with 19 additions and 0 deletions

2
README.org Normal file
View file

@ -0,0 +1,2 @@
Send MAC addrs of all current DHCP leases to <TODO>. Transmit only if
the list changed since last transmission.

17
src/update_hacker_density Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
LeaseFile=/tmp/dhcp.leases
TmpFile=/tmp/hackers
StateFile=/tmp/hackers.md5
Hash=md5sum
awk '{ if ($1 > '$(date +%s)') print $2 }' < $LeaseFile > $TmpFile
OldHash=$(cat $StateFile 2>/dev/null)
NewHash=$($Hash $TmpFile | cut -f1 -d" ")
if [ "$OldHash" != "$NewHash" ]; then
# send new state, update local state only if transmission was succesful
( echo Es sind $(wc -l <$TmpFile) Hacker im Space:
cat $TmpFile) \
| nc -c feinsterfug.de 666 \
&& echo "$NewHash" > $StateFile
fi