Created
March 28, 2019 11:50
-
-
Save kkappel/284a4564a1df3a78bf9d2de172e8b639 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Filter unknown Mac-Adresses from daemon.log and display Manufacturer | |
| # works with UNIVENTION 4 | |
| # depends on: oui.txt from https://linuxnet.ca/ieee/oui/ | |
| # (c) 2019 by Klaus Kappel | |
| # Use under GPL3 | |
| txt=/var/www/unknown.txt | |
| tmp=$(mktemp) | |
| function vendor { | |
| vm=$(echo $1 | cut -c1-8) | |
| trans=$(echo "$vm" | tr ':' '-') | |
| upper=$(echo "$trans" | tr '[a-z]' '[A-Z]') | |
| vendor=$(cat /usr/local/src/mac/oui.txt | grep $upper | cut -f3) | |
| echo $1 $vendor | |
| } | |
| grep "unknown client" /var/log/daemon.log | cut -c49-66 | sort -u > $tmp | |
| echo "Unbekannte MacAdressen im LAN" > $txt | |
| echo "=============================" >> $txt | |
| for m in $(cat $tmp); do | |
| vendor $m >> $txt | |
| done | |
| date "+%d.%m.%Y %H:%M" >> $txt | |
| rm $tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment