Sunday, March 1, 2015

Extract List of IP Addresses from a File using grep

I have run into multiple occurrences where I only want to see the IP Addresses in a given file.  Today I found with the help of Command Line Fu a quick way to parse a file and only return the unique IP Addresses found:

cat tmp.txt | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | sort | uniq

Sometimes I will use this to quickly parse out IP Addresses in an email.  The regulary expression can be changed to extract domain names out of an email also.


No comments:

Post a Comment

Prepare, Bait, Hook, Execute and Control - Buffer Overflows

This post is the third of four that I am planning to write about social engineering specifically about phishing.  The form of phishing that...