Skip to content

Instantly share code, notes, and snippets.

@ugovaretto
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugovaretto/bbe80b70064d759dda3a to your computer and use it in GitHub Desktop.
Save ugovaretto/bbe80b70064d759dda3a to your computer and use it in GitHub Desktop.
Parse wsftp logs and extract host names with nslookup
#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