Last active
August 29, 2015 14:04
-
-
Save ugovaretto/bbe80b70064d759dda3a to your computer and use it in GitHub Desktop.
Parse wsftp logs and extract host names with nslookup
This file contains 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
#extract IP address then parse returned line for last host name on the line | |
cat /var/log/vsftpd.log | grep molekel | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | nslookup | egrep -o '= .*' | egrep -o ' .*$' > servers | |
#to print or count unique host names | |
cat servers | sort | uniq | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment