print("{} does not exist".format(args.reportdir)) exit(1) explainfile = os.path.join(args.reportdir,"identified_blocks_explained.txt") if not os.path.exists(explainfile) and args.explain: ifname = os.path.join(args.reportdir,"identified_blocks.txt") ofname = os.path.join(args.reportdir,"identified_blocks_explained.txt") cmd = ['hashdb','explain_identified_blocks',args.explain,ifname] print(" ".join(cmd)) call(cmd,stdout=open(ofname,"w")) if not args.image: from bulk_extractor_reader import BulkReport b = BulkReport(args.reportdir) args.image = b.image_filename() dbname = os.path.join(args.reportdir,args.dbname) if not os.path.exists(dbname) and args.run: print("{} does not exist. Will try to run tsk_loaddb".format(dbname)) cmd=['tsk_loaddb','-d',dbname,args.image] print(" ".join(cmd)) call(cmd) # Add the indexes print("Adding indexes to database") import sqlite3 con = sqlite3.connect("file:{}".format(dbname),uri=True) cur = con.cursor() cur.execute("create index if not exists start1 on tsk_file_layout(byte_start)"); cur.execute("create index if not exists start2 on tsk_file_layout(byte_len)"); con.close()
exit(1) explainfile = os.path.join(args.reportdir, "identified_blocks_explained.txt") if not os.path.exists(explainfile) and args.explain: ifname = os.path.join(args.reportdir, "identified_blocks.txt") ofname = os.path.join(args.reportdir, "identified_blocks_explained.txt") cmd = ['hashdb', 'explain_identified_blocks', args.explain, ifname] print(" ".join(cmd)) call(cmd, stdout=open(ofname, "w")) if not args.image: from bulk_extractor_reader import BulkReport b = BulkReport(args.reportdir) args.image = b.image_filename() dbname = os.path.join(args.reportdir, args.dbname) if not os.path.exists(dbname) and args.run: print("{} does not exist. Will try to run tsk_loaddb".format(dbname)) cmd = ['tsk_loaddb', '-d', dbname, args.image] print(" ".join(cmd)) call(cmd) # Add the indexes print("Adding indexes to database") import sqlite3 con = sqlite3.connect("file:{}".format(dbname), uri=True) cur = con.cursor() cur.execute( "create index if not exists start1 on tsk_file_layout(byte_start)") cur.execute(