Question Locked

find Social Security Numbers in files

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone know of a tool that can find Social Security Numbers(SSN) within files, particularly Excel and Access?

Am trying to clean up some old data and want to assure that SSN's are not stored in publically accessable shares.

6 replies

by glass2dl

I'm interested in the same thing whether it be a pre-packaged program or something like a vbscript.

by bkai

I'm currently working on a vbscript to do just this, however, please realize that execution of this will take a LONG time per machine. Since I'm not a pro at vbscript I don't have it completed but the general idea is to traverse a filesystem and run a search pattern on each file.

The code I have at this point is as follows:

Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

Set objNetwork = CreateObject("WScript.Network")
strFilename = objNetwork.ComputerName + "-" + objNetwork.UserName + ".txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\temp\test.txt", 1)

WScript.Echo strFileName

i = 0

Do Until objFile.AtEndOfStream
i = i + 1
strSearchString = objFile.ReadLine
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
Wscript.Echo "Line " & i & ": " & strSearchString
Next
End If
Loop

objFile.Close

--------------
This will search a "given" file and return the filename you will be dumping the information to and the line number and SSN that was found.

You'll need to finish it by adding code to parse a filesystem recursively and actually write this information to a file but this is the search pattern you need.

Actually you will need 3 different search patterns. This one and one that has no dashes between numbers and one that has spaces between numbers. Those are the 3 commonly used formats for SSNs. Good luck!

by akellogg

I am looking for a preventitive measure. During our preventative maintenence we can use something like this. Our users are trained to save to our secure servers, but accidents happen. I will start testing this tool.

by arvindsvr

Hi can any one help me with a macro to scan shared folders on network to look for US SSN in word,excel files. Required for audit purposes.

This discussion is closed to new replies.