Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import sqlite3, datetime
  2. def fixDate(timestamp):
  3. #Chrome stores timestamps in the number of microseconds since Jan 1 1601.
  4. #To convert, we create a datetime object for Jan 1 1601...
  5. epoch_start = datetime.datetime(1601,1,1)
  6. #create an object for the number of microseconds in the timestamp
  7. delta = datetime.timedelta(microseconds=int(timestamp))
  8. #and return the sum of the two.
  9. return epoch_start + delta
  10.  
  11. selectStatement = 'SELECT target_path, referrer, start_time, end_time, received_bytes FROM downloads;'
  12. historyFile = 'C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History'
  13. c = sqlite3.connect(historyFile)
  14. for row in c.execute(selectStatement):
  15. targetPathString = str(row[0])
  16. referrerString = str(row[1])
  17. startTimeString = str(fixDate(row[2]))
  18. endTimeString = str(fixDate(row[3]))
  19. size = str(row[4])
  20. print targetPathString, "was downloaded from", referrerString, "From:", startTimeString, "To:", endTimeString, "Size:", size
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement