Created
December 16, 2013 13:52
-
-
Save saihtaM/7987189 to your computer and use it in GitHub Desktop.
Kill Chrome if someone install and run it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psutil # http://code.google.com/p/psutil/ | |
import os, time | |
import win32api # http://sourceforge.net/projects/pywin32/ | |
while 1: | |
# Lets check every 15. second | |
time.sleep(15) | |
# Get a list of all running processes | |
list = psutil.get_pid_list() | |
# Go though list and check each processes executeable name for 'chrome.exe' | |
for i in range(0, len(list)): | |
try: | |
p = psutil.Process(list[i]) | |
if p.cmdline[0].find("chrome.exe") != -1: | |
# Chrome found. Kill it | |
p.kill() | |
# Notify the user | |
win32api.MessageBox(0,'Chrome is not allowed - use Firefox.\n\nFor more info, contact the office.','Chrome has been closed',0x00010000) | |
break; | |
except: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psutil # http://code.google.com/p/psutil/ | |
import os, time | |
import win32api # http://sourceforge.net/projects/pywin32/ | |
while 1: | |
# Lets check every 15. second | |
time.sleep(15) | |
# Get a list of all running processes | |
list = psutil.get_pid_list() | |
# Go though list and check each processes executeable name for 'chrome.exe' | |
for i in range(0, len(list)): | |
try: | |
p = psutil.Process(list[i]) | |
if p.cmdline[0].find("chrome.exe") != -1: | |
# Chrome found. Kill it | |
p.kill() | |
# Notify the user | |
win32api.MessageBox(0,'Chrome er ikke tilladt - brug Firefox.\n\nKontakt kontoret for mere info.','Chrome er blevet lukket',0x00010000) | |
break; | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment