Initial commit
This commit is contained in:
commit
c00dc78f30
2 changed files with 19 additions and 0 deletions
2
README.org
Normal file
2
README.org
Normal 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
17
src/update_hacker_density
Executable 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
|
Reference in a new issue