def ingest_feature_file(self,f,context_stop_list): """Read the lines in a feature file; returns how many lines were procesed""" drivename = None count = 0 for line in f: if type(line)==bytes: line = line.decode('utf-8') m = bulk_extractor_reader.get_property_line(line) if m: if m[0]=='Filename': drivename = m[1] self.drives.add(drivename) print("Scanning {} for {}".format(drivename,self.name)) if bulk_extractor_reader.is_comment_line(line): continue count += 1 if context_stop_list != None: (offset,feature,context) = line.split("\t") context_stop_list.add((feature,context)) continue feature = line.split("\t")[1] featuredict = self.features[feature] featuredict[drivename] = featuredict.get(drivename,0)+1 print(" processed {} features".format(count)) return count
def ingest_histogram_file(self,f): drivename = None for line in f: if type(line)==bytes: line = line.decode('utf-8') m = bulk_extractor_reader.get_property_line(line) if m: if m[0]=='Filename': drivename = m[1] self.drives.add(drivename) print("Scanning {} for {}".format(drivename,self.name)) continue if bulk_extractor_reader.is_comment_line(line): continue fields = line.split("\t") count = int(fields[0][2:]) feature = fields[1].strip() featuredict = self.features[feature] featuredict[drivename] = featuredict.get(drivename,0)+count