Skip to content

Instantly share code, notes, and snippets.

@mratsim
Created November 27, 2016 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mratsim/8fc49b4918ac7a59b75e61b03242289d to your computer and use it in GitHub Desktop.
Save mratsim/8fc49b4918ac7a59b75e61b03242289d to your computer and use it in GitHub Desktop.
Get chrome cookies
#!/usr/bin/python
from sqlite3 import dbapi2 as db # python 2.5
cookie_file = '~/.config/chromium/Default/Cookies'
output_file = 'chrome-cookies.txt'
conn = db.connect(cookie_file)
cur = conn.cursor()
cur.execute('SELECT host_key, path, secure, expires_utc, name, value FROM cookies')
f = open(output_file, 'w')
i = 0
for row in cur.fetchall():
f.write("%s\tTRUE\t%s\t%s\t%d\t%s\t%s\n" % (row[0], row[1], str(bool(row[2])).upper(), row[3], str(row[4]), str))
i += 1
print "%d rows written" % i
f.close()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment