Untitled
unknown
plain_text
2 years ago
1.2 kB
7
Indexable
import platform
import os
def get_chrome_version():
system = platform.system()
version = ""
if system == "Windows":
try:
import winreg
reg_path = r"SOFTWARE\Google\Chrome\BLBeacon"
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, reg_path, 0, winreg.KEY_READ | winreg.KEY_WOW64_32KEY)
version, _ = winreg.QueryValueEx(reg_key, "version")
except Exception as e:
print("Error:", e)
elif system == "Linux":
try:
omnibox_file = os.path.expanduser("~/.config/google-chrome/Default/Local State")
if os.path.exists(omnibox_file):
with open(omnibox_file, "r") as file:
import json
data = json.load(file)
version = data["browser"]["version"]
except Exception as e:
print("Error:", e)
return version
if __name__ == "__main__":
chrome_version = get_chrome_version()
if chrome_version:
print("Google Chrome version:", chrome_version)
else:
print("Google Chrome version not found.")
Editor is loading...