// Compares against a series of keywords that may suggest sensitive information is being stored here. // Keywords are defined in an input file and loaded into KeywordSearch public static Match IsKeyword(string candidate, KeywordSearch keywordSearch) { Match match = Match.Negative; var result = keywordSearch.Contains(candidate); if (result.success) { switch (result.riskLevel) { case 0: match = Match.Ambiguous; break; case 1: match = Match.Likely; break; case 2: match = Match.Positive; break; default: break; } } return(match); }
public static void Main(string[] args) { if (args.Length > 0) { var argsList = args.ToList(); _path = argsList.Contains("--path") ? argsList[argsList.IndexOf("--path") + 1] : AppDomain.CurrentDomain.BaseDirectory; _isRecursive = argsList.Contains("--recursive"); _whitelist = argsList.Contains("--whitelist") ? argsList[argsList.IndexOf("--whitelist") + 1] : null; _documentTypes = argsList.Contains("--document-types") ? argsList[argsList.IndexOf("--document-types") + 1].Split(',') : null; _infoTypes = argsList.Contains("--info-types") ? argsList[argsList.IndexOf("--info-types") + 1].Split(',') : new [] { "keyword", "email", "name", "phone", "card" }; _sensitivity = argsList.Contains("--sensitivity") ? int.Parse(argsList[argsList.IndexOf("--sensitivity") + 1]) : 5; } if (_infoTypes.Contains("keyword")) { _keywordSearch = new KeywordSearch("keyword_dict.txt"); } if (_infoTypes.Contains("name")) { _nameSearch = new NameSearch("nam_dict.txt"); } List <FileReport> reports = ScanFilesInDirectory(_path); // okay, what do we do with the reports? }