skip to Main Content
Talk to a Security Expert Now: (800) 721-9177

Finding Social Security Numbers in packet captures with grep and ngrep

I’ve been spending a lot of time lately working with packet captures.  I’ve been stringing together a long list of silly one-liners to make a very rough pcap vulnerability scanner of sorts.  This is one of those one-liners.
One of the main things I first hunt for in network traffic is sensitive data leaving the network.  Depending on the client, this could range anywhere from Social Security Numbers to Player Tracking Numbers on gaming networks.  I usually use grep and ngrep for some initial recon.  Here, we break open our pcap file with ngrep and feed it to grep.  Then, grep looks for the typical SSN regex xxx-xx-xxxx where x= any number 0-9.


$ ngrep -I inet.pcap | grep ‘[0-9]{3}-[0-9]{2}-[0-9]{4}’


As you can see in the example above – there are some (all) false positives.  This particular pcap is hitting on dates and .eml names because they follow the regex we are looking for.  On larger pcaps with alot of Internet traffic, I usually pipe the output to a text file and get to work stripping out all the GET requests and things we just arent interested in for the task at hand.
I’ve also used the Spider tool from Cornell University with much success.
This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top