Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This script will disable Google Chrome from storing history
- # Run this script not as Administrator, run it normally
- # Created by ScaredKYS | 5/17/2020
- # Usage: python script.py
- import os
- from stat import S_IREAD
- from subprocess import DEVNULL, STDOUT, check_call
- # We are getting the current user to find the file
- user = os.environ.get('USERNAME')
- if not user:
- user = os.environ.get('USER')
- if user in str(os.path):
- print("[#] User: "+user)
- # Trying to disable the 'chrome.exe' task(s)
- try:
- print("[#] Disabling Chrome.exe")
- check_call(['taskkill', '/F', '/im', 'chrome.exe'], stdout=DEVNULL, stderr=STDOUT)
- except:
- print("[#] Chrome is disabled")
- print("[#] Attempting to find the Chrome history file...")
- print("[#] Please wait...")
- os.system('cd /d C:') # Changing to the main C: drive
- os.chdir('C:\\Users') # Changing to the Users folder
- direct = os.listdir() # Getting a list of folders in the Users directory
- if user in direct:
- try:
- os.chdir(user) # Change the directory to the User's folder
- except PermissionError:
- print("[!] Error | You don't have permission to manage files there")
- exit()
- else: # Manual input of the User's folder if we cannot detect it
- for i in direct:
- print(i)
- print("Please input which user folder is yours")
- ufolder = input(">>> ")
- try:
- os.chdir(ufolder)
- except:
- for i in direct:
- print(i)
- print("Please input which user folder is yours")
- ufolder = input(">>> ")
- try:
- os.chdir(ufolder)
- except:
- print("[!] Error")
- exit()
- # Changing the directory to where the 'History' file is stored
- os.chdir('AppData\\Local\\Google\\Chrome\\User Data\\Default')
- print("[#] Attempting to disable history...")
- try:
- # Changing the 'History' file to 'Read Only'
- # Chrome will no longer be able to edit this file
- os.chmod("History", S_IREAD)
- print("Permanently Disabled Chrome's History!!")
- except:
- print("[#] Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement