|
将一下代码 转换成易语言
import os
import json
import base64
import sqlite3
import win32crypt
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
def GetString(LocalState):
with open(LocalState,'r',encoding='utf-8') as f:
s=json.load(f)['os_crypt']['encrypted_key']
return s
def pull_the_key(base64_encrypted_key):
encrypted_key_with_header=base64.b64decode(base64_encrypted_key)
encrypted_key=encrypted_key_with_header[5:]
key=win32crypt.CryptUnprotectData(encrypted_key,None,None,None,0)[1]
return key
def DecryptString(key,data):
nonce,cipherbytes=data[3:15],data[15:]
aesgcm=AESGCM(key)
plainbytes=aesgcm.decrypt(nonce,cipherbytes,None)
plaintext=plainbytes.decode('utf-8')
return plaintext
def EncryptString(key, plaintext):
aesgcm=AESGCM(key)
nonce = os.urandom(12)
cipherbytes = aesgcm.encrypt(nonce, plaintext.encode('utf-8'), None)
data = b'v10' + nonce + cipherbytes
encrypted_data = base64.b64encode(data)
return encrypted_data
def test_cookies():
LocalState = 'C:\\Users\\Administrator\\Desktop\\chrome谷歌浏览器多开(独立环境 独立cookie)\\UserData__Templete\\Local State' #local_state文件
Cookies = 'C:\\Users\\Administrator\\Desktop\\chrome谷歌浏览器多开(独立环境 独立cookie)\\UserData__Templete\\Default\\Network\\Cookies' #local_state文件
con = sqlite3.connect(Cookies)
res = con.execute('select host_key,name,encrypted_value from cookies').fetchall()
con.close()
key = pull_the_key(GetString(LocalState))
for i in res:
print(i[0], i[1], DecryptString(key, i[2]))
if __name__ == '__main__':
test_cookies()
请大神帮忙翻一下,或者留个联系方式,有偿解决也可以的哈!
|
|