Dark side of macOS

import sqlite3

def query_db(database, query):
db = sqlite3.connect(database)
c = db.cursor()
c.execute(query)
return c.fetchall()

1. Safari (Version 12.1)

history = "History.db"
  • Top 10 most visited urls
query = '''
select url, visit_count
from history_items
order by visit_count desc
limit 10;
'''
query_db(history, query)
  • Top 10 most visited domains
query = '''
select domain_expansion, count(*)
from history_items
group by domain_expansion
order by count(*) desc
limit 10;
'''
query_db(history, query)

2. Notes (Version 4.6)

notes = 'NoteStore.sqlite'
  • Content of your notes
query = '''
select ZDATA
from ZICNOTEDATA;
'''
  • Content of the 1st note
note_0 = query_db(notes, query)[0][0]
import zlib

note_0_readable = zlib.decompress(note_0, 16+zlib.MAX_WBITS)
print (note_0_readable)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store