import os, sys
import win32crypt
import sqlite3
sys.path.append(os.path.abspath(os.path.dirname(__file__)) + "\\..\\")
import common
def getpath(_browser):
if (_browser == "chrome"):
path = os.getenv('localappdata') + "\\Google\\chrome\\User Data\\Default\\"
if (_browser == "whale"):
path = os.getenv('localappdata') + "\\Naver\\Naver Whale\\User Data\\Default\\"
return path
def decryp(_path):
try:
connection = sqlite3.connect(_path + "Login Data")
with connection:
cursor = connection.cursor()
query = cursor.execute('SELECT action_url, username_value, password_value FROM logins')
value = query.fetchall()
for origin_url, username, password in value:
password = win32crypt.CryptUnprotectData( password, None, None, None, 0)[1]
if (password != b''):
print("\nSite: {}\nUsername: {}\nPassword: {}\n".format(origin_url, username, password))
except sqlite3.OperationalError:
print("sqlite connect error")
def main(_browser):
path = getpath(_browser)
decryp(path)
if __name__ == "__main__":
if (len(sys.argv) != 2):
print("usage python {} <chrome | whale>".format(__file__))
if (len(sys.argv) == 2):
main(sys.argv[1])
> 크롬에 저장된 비밀번호를 가져오는 코드. 실행 시 크롬이 켜져있어서는 안된다.
반응형
'Language > Python' 카테고리의 다른 글
Selenium 간단 정리 (0) | 2019.07.17 |
---|---|
파이썬 multiprocessing 모듈 (map_async, apply_async) (0) | 2019.07.16 |
python logging 예제 (0) | 2019.01.26 |
python pysqlite (0) | 2019.01.05 |
python closure, decorator (0) | 2018.12.18 |