Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
simsong committed Aug 26, 2014
1 parent ea6a314 commit 1486dc9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions python/cda2_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ def ingest(report_fn):
print("{} already imported".format(report_fn))
return

br = bulk_extractor_reader.BulkReport(report_fn)
try:
br = bulk_extractor_reader.BulkReport(report_fn)
image_filename = br.image_filename()
except IndexError:
print("No image filename in bulk_extractor report for {}; will not ingest".format(report_fn))
return
except OSError:
print("Cannot open {}; will not ingest".format(report_fn))
return
except KeyError:
print("Cannot open {}; will not ingest".format(report_fn))
return

if args.reimport==False:
driveid = get_driveid(image_filename,create=False)
Expand Down Expand Up @@ -147,9 +150,13 @@ def ingest(report_fn):
# Add hashes for Windows executables
import collections
pe_header_counts = collections.Counter()
for (pos,feature,context) in br.read_features("winpe.txt"):
featureid = get_featureid(feature)
pe_header_counts[featureid] += 1
for r in br.read_features("winpe.txt"):
try:
(pos,feature,context) = r
featureid = get_featureid(feature)
pe_header_counts[featureid] += 1
except ValueError:
print("got {} values".format(len(r)))
for (featureid,count) in pe_header_counts.items():
c.execute("INSERT INTO feature_drive_counts (driveid,feature_type,featureid,count) values (?,?,?,?);",
(driveid,WINPE_TYPE,featureid,count))
Expand Down

0 comments on commit 1486dc9

Please sign in to comment.