Advertisement
scaredkys

Disable Chrome History

May 17th, 2020
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.12 KB | None | 0 0
  1. # This script will disable Google Chrome from storing history
  2. # Run this script not as Administrator, run it normally
  3. # Created by ScaredKYS | 5/17/2020
  4. # Usage: python script.py
  5. import os
  6. from stat import S_IREAD
  7. from subprocess import DEVNULL, STDOUT, check_call
  8.  
  9. # We are getting the current user to find the file
  10. user = os.environ.get('USERNAME')
  11. if not user:
  12.     user = os.environ.get('USER')
  13. if user in str(os.path):
  14.     print("[#] User: "+user)
  15.  
  16. # Trying to disable the 'chrome.exe' task(s)
  17. try:
  18.     print("[#] Disabling Chrome.exe")
  19.     check_call(['taskkill', '/F', '/im', 'chrome.exe'], stdout=DEVNULL, stderr=STDOUT)
  20. except:
  21.     print("[#] Chrome is disabled")
  22.  
  23. print("[#] Attempting to find the Chrome history file...")
  24. print("[#] Please wait...")
  25. os.system('cd /d C:') # Changing to the main C: drive
  26. os.chdir('C:\\Users') # Changing to the Users folder
  27. direct = os.listdir() # Getting a list of folders in the Users directory
  28. if user in direct:
  29.     try:
  30.         os.chdir(user) # Change the directory to the User's folder
  31.     except PermissionError:
  32.         print("[!] Error | You don't have permission to manage files there")
  33.         exit()
  34.  
  35. else: # Manual input of the User's folder if we cannot detect it
  36.     for i in direct:
  37.         print(i)
  38.         print("Please input which user folder is yours")
  39.         ufolder = input(">>> ")
  40.         try:
  41.             os.chdir(ufolder)
  42.         except:
  43.             for i in direct:
  44.                 print(i)
  45.                 print("Please input which user folder is yours")
  46.                 ufolder = input(">>> ")
  47.                 try:
  48.                     os.chdir(ufolder)
  49.                 except:
  50.                     print("[!] Error")
  51.                     exit()
  52. # Changing the directory to where the 'History' file is stored
  53. os.chdir('AppData\\Local\\Google\\Chrome\\User Data\\Default')
  54. print("[#] Attempting to disable history...")
  55. try:
  56.     # Changing the 'History' file to 'Read Only'
  57.     # Chrome will no longer be able to edit this file
  58.     os.chmod("History", S_IREAD)
  59.     print("Permanently Disabled Chrome's History!!")
  60. except:
  61.     print("[#] Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement