1 package org.sleuthkit.autopsy.datamodel;
 
    3 import com.google.common.collect.Range;
 
    4 import com.google.common.collect.RangeMap;
 
    5 import com.google.common.collect.TreeRangeMap;
 
    6 import java.io.IOException;
 
    7 import java.io.InputStreamReader;
 
    8 import java.util.Optional;
 
    9 import java.util.logging.Level;
 
   10 import java.util.logging.Logger;
 
   11 import javax.annotation.concurrent.GuardedBy;
 
   12 import org.apache.commons.csv.CSVFormat;
 
   13 import org.apache.commons.csv.CSVParser;
 
   14 import org.apache.commons.csv.CSVRecord;
 
   15 import org.apache.commons.lang3.StringUtils;
 
   98     @GuardedBy(
"CreditCards.class")
 
  114                 InputStreamReader in = 
new InputStreamReader(
CreditCards.class.getResourceAsStream(
"ranges.csv")); 
 
  115                 CSVParser rangesParser = CSVFormat.RFC4180.withFirstRecordAsHeader().parse(in);
 
  118                 for (CSVRecord record : rangesParser) {
 
  125                     String start = StringUtils.rightPad(record.get(
"iin_start"), 8, 
"0"); 
 
  128                     String end = StringUtils.defaultIfBlank(record.get(
"iin_end"), start); 
 
  129                     end = StringUtils.rightPad(end, 8, 
"99"); 
 
  131                     final String numberLength = record.get(
"number_length"); 
 
  135                                 Integer.parseInt(end),
 
  136                                 StringUtils.isBlank(numberLength) ? null : Integer.valueOf(numberLength),
 
  137                                 record.get(
"scheme"), 
 
  140                                 record.get(
"country"), 
 
  141                                 record.get(
"bank_name"), 
 
  142                                 record.get(
"bank_url"), 
 
  143                                 record.get(
"bank_phone"), 
 
  144                                 record.get(
"bank_city")); 
 
  148                     } 
catch (NumberFormatException numberFormatException) {
 
  149                         LOGGER.log(Level.WARNING, 
"Failed to parse BIN range: " + record.toString(), numberFormatException); 
 
  153             } 
catch (IOException ex) {
 
  154                 LOGGER.log(Level.WARNING, 
"Failed to load BIN ranges form ranges.csv", ex); 
 
  155                 MessageNotifyUtil.
Notify.
warn(
"Credit Card Number Discovery", 
"There was an error loading Bank Identification Number information.  Accounts will not have their BINs identified.");
 
static boolean binsLoaded
 
synchronized static void loadBINRanges()
 
Optional< String > getScheme()
 
Optional< String > getCardType()
 
static synchronized BankIdentificationNumber getBINInfo(int bin)
 
Optional< String > getCountry()
 
static final Logger LOGGER
 
static final RangeMap< Integer, BINRange > binRanges
 
Optional< String > getBankCity()
 
Optional< String > getBrand()
 
synchronized static Logger getLogger(String name)
 
Optional< String > getBankPhoneNumber()
 
Optional< String > getBankURL()
 
Optional< Integer > getNumberLength()
 
Optional< String > getBankName()
 
static void warn(String title, String message)