Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions win10_prefetch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libscca-python
14 changes: 7 additions & 7 deletions win10_prefetch/w10pf_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
try:
import pyscca #Import pyscca, necessary from libscca
except ImportError:
print "Please install libscca with Python bindings"
print("Please install libscca with Python bindings")

output = {}

Expand Down Expand Up @@ -57,7 +57,7 @@ def parse_dir(dir,volume_information):

def outputResults(output,output_file=None,output_type=None,volume_information=None):
if output_type:
for k, v in output.iteritems():
for k, v in output.items():
json_output = {
'Executable Name' : k,
'Run Count' : v[0],
Expand Down Expand Up @@ -90,7 +90,7 @@ def outputResults(output,output_file=None,output_type=None,volume_information=No
with open(output_file,'w') as file:
json.dump(json_output,file)
else:
print json.dumps(json_output,indent=4,sort_keys=True)
print(json.dumps(json_output,indent=4,sort_keys=True))

else:
if output_file:
Expand All @@ -109,7 +109,7 @@ def outputResults(output,output_file=None,output_type=None,volume_information=No

# Need to get the max value of the number of volumes, and create our headers accordingly. Note that some files will have less volumes than others, and will have blank cells where appropriate
volume_count = []
for k, v in output.iteritems():
for k, v in output.items():
volume_count.append(v[3])
for i in range(max(volume_count)):
# Adding in volume-specific headers one-by-one, simply to avoid list formatting in the CSV output
Expand All @@ -118,7 +118,7 @@ def outputResults(output,output_file=None,output_type=None,volume_information=No
headers.append(str('Volume {} Serial Number').format(i))

csv_out.writerow(headers)
for k, v in output.iteritems():
for k, v in output.items():
row = [k, v[0], v[1]]
for i in range(8): # Loop through range again to get each sub-value for times
row.append(v[2][i])
Expand Down Expand Up @@ -155,8 +155,8 @@ def main():
output = parse_dir(args.directory,args.volumes)

if not output:
print "No valid prefetch files were found!"
print("No valid prefetch files were found!")
else:
outputResults(output,args.output,args.json,args.volumes)
if __name__ == "__main__":
main()
main()