CreditCard FindPAN(string s, string ProcessName, long offset) { var cc = new CreditCard(); var match = Regex.Match(s, pattern16numeric); if (match.Success && match.Value != "0000000000000000" && LuhnCheck(match.Value)) { cc.Number = match.Value; cc.Expiration = FindExpiration(s, cc.Number); cc.CardholderName = FindName(s); cc.Literal = s; cc.FirstDiscovered = DateTime.Now; cc.LastDiscovered = DateTime.Now; cc.MemoryAddresses.Add(offset + match.Index); cc.ProcessNames.Add(ProcessName); if (Config.Default.ConsoleOutput) { Console.WriteLine(" + Found PAN ({0}) in Process: {1}", cc.Number, ProcessName); } } return cc; }
void Save(CreditCard CC) { if (CC == null) { return; } var CCs = new List<CreditCard>(); if (_config != null && !string.IsNullOrEmpty(_config.FilePath)) { CCs = FileHelper.Load<List<CreditCard>>(_config.FilePath); } CCs.Add(CC); var sorted = Unique(CCs); try { FileHelper.Save<List<CreditCard>>(sorted, _config.FilePath); } catch (Exception) { FileHelper.Save<List<CreditCard>>(CCs, Config.Default.FilePath); } }