Go to the documentation of this file.
19package org.sleuthkit.autopsy.modules.hashdatabase;
21import java.io.BufferedReader;
23import java.io.FileReader;
24import java.io.FileNotFoundException;
25import java.io.IOException;
26import java.util.logging.Level;
27import org.sleuthkit.autopsy.coreutils.Logger;
28import org.sleuthkit.datamodel.TskCoreException;
36 private final String filename;
37 private BufferedReader reader;
38 private final long totalHashes;
39 private boolean doneReading =
false;
41 IdxHashSetParser(String filename)
throws TskCoreException {
42 this.filename = filename;
44 reader =
new BufferedReader(
new FileReader(filename));
45 }
catch (FileNotFoundException ex) {
46 throw new TskCoreException(
"Error opening file " + filename, ex);
50 File importFile =
new File(filename);
51 long fileSize = importFile.length();
52 totalHashes = fileSize / 0x33 + 1;
64 public String
getNextHash() throws TskCoreException {
68 while ((line = reader.readLine()) !=
null) {
71 String[] parts = line.split(
"\\|| ");
73 String hashStr = parts[0].toLowerCase();
74 if (!hashStr.matches(
"^[0-9a-f]{32}$")) {
80 }
catch (IOException ex) {
81 throw new TskCoreException(
"Error reading file " + filename, ex);
114 public void close() {
117 }
catch (IOException ex) {
118 Logger.getLogger(IdxHashSetParser.class.getName()).log(Level.SEVERE,
"Error closing file " + filename, ex);
long getExpectedHashCount()
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.