block_tools
Browse files
process_and_domain_blocker_windows_10_11/antiblock.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import time
|
3 |
+
import datetime
|
4 |
+
import psutil
|
5 |
+
|
6 |
+
|
7 |
+
blacklisted_apps = [
|
8 |
+
"Telegram.exe",
|
9 |
+
"Discord.exe",
|
10 |
+
"vlc.exe",
|
11 |
+
"WinStore.App.exe"
|
12 |
+
]
|
13 |
+
|
14 |
+
|
15 |
+
blocked_sites = [
|
16 |
+
"youtube.com",
|
17 |
+
"www.youtube.com",
|
18 |
+
"t.me",
|
19 |
+
"web.telegram.org",
|
20 |
+
"chat.openai.com",
|
21 |
+
"chatgpt.com",
|
22 |
+
"huggingface.co",
|
23 |
+
"github.com",
|
24 |
+
"chat.qwen.ai",
|
25 |
+
"chat.deepseek.com",
|
26 |
+
"civitai.com",
|
27 |
+
"https://chat.deepseek.com/"
|
28 |
+
]
|
29 |
+
|
30 |
+
|
31 |
+
hosts_path = r"C:\Windows\System32\drivers\etc\hosts"
|
32 |
+
redirect_ip = "127.0.0.1"
|
33 |
+
log_file = "blocked_log.txt"
|
34 |
+
|
35 |
+
|
36 |
+
CHECK_INTERVAL = 10
|
37 |
+
|
38 |
+
def log_event(event):
|
39 |
+
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
40 |
+
with open(log_file, "a", encoding="utf-8") as f:
|
41 |
+
f.write(f"[{now}] {event}\n")
|
42 |
+
|
43 |
+
def block_websites():
|
44 |
+
with open(hosts_path, "r+", encoding="utf-8") as file:
|
45 |
+
content = file.read()
|
46 |
+
for site in blocked_sites:
|
47 |
+
entry = f"{redirect_ip} {site}"
|
48 |
+
if entry not in content:
|
49 |
+
file.write(entry + "\n")
|
50 |
+
log_event(f"Blocked site: {site}")
|
51 |
+
print("✅ All websites blocked.")
|
52 |
+
|
53 |
+
def close_apps():
|
54 |
+
for proc in psutil.process_iter(["pid", "name"]):
|
55 |
+
try:
|
56 |
+
if proc.info["name"] in blacklisted_apps:
|
57 |
+
os.system(f"taskkill /F /PID {proc.info['pid']}")
|
58 |
+
print(f"⛔ Closed app: {proc.info['name']}")
|
59 |
+
log_event(f"Closed app: {proc.info['name']}")
|
60 |
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
61 |
+
continue
|
62 |
+
|
63 |
+
|
64 |
+
print("🚀 Anti-Distraction System Active...")
|
65 |
+
block_websites()
|
66 |
+
|
67 |
+
while True:
|
68 |
+
close_apps()
|
69 |
+
time.sleep(CHECK_INTERVAL)
|
process_and_domain_blocker_windows_10_11/blocked_log.txt
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[2025-07-08 12:00:44] Blocked site: youtube.com
|
2 |
+
[2025-07-08 12:00:44] Blocked site: www.youtube.com
|
3 |
+
[2025-07-08 12:00:44] Blocked site: t.me
|
4 |
+
[2025-07-08 12:00:44] Blocked site: web.telegram.org
|
5 |
+
[2025-07-08 12:00:44] Blocked site: chat.openai.com
|
6 |
+
[2025-07-08 12:00:45] Closed app: chrome.exe
|
7 |
+
[2025-07-08 12:00:45] Closed app: chrome.exe
|
8 |
+
[2025-07-08 12:00:45] Closed app: chrome.exe
|
9 |
+
[2025-07-08 12:00:45] Closed app: chrome.exe
|
10 |
+
[2025-07-08 12:00:45] Closed app: chrome.exe
|
11 |
+
[2025-07-08 12:00:46] Closed app: chrome.exe
|
12 |
+
[2025-07-08 12:05:37] Closed app: chrome.exe
|
13 |
+
[2025-07-08 12:05:38] Closed app: chrome.exe
|
14 |
+
[2025-07-08 12:05:38] Closed app: chrome.exe
|
15 |
+
[2025-07-08 12:05:38] Closed app: chrome.exe
|
16 |
+
[2025-07-08 12:05:39] Closed app: chrome.exe
|
17 |
+
[2025-07-08 12:05:39] Closed app: chrome.exe
|
18 |
+
[2025-07-08 12:05:39] Closed app: chrome.exe
|
19 |
+
[2025-07-08 12:05:39] Closed app: chrome.exe
|
20 |
+
[2025-07-08 12:05:40] Closed app: chrome.exe
|
21 |
+
[2025-07-08 12:06:00] Closed app: Telegram.exe
|
22 |
+
[2025-07-08 12:08:52] Blocked site: chatgpt.com
|
23 |
+
[2025-07-08 12:08:53] Closed app: chrome.exe
|
24 |
+
[2025-07-08 12:08:53] Closed app: chrome.exe
|
25 |
+
[2025-07-08 12:08:53] Closed app: chrome.exe
|
26 |
+
[2025-07-08 12:08:54] Closed app: chrome.exe
|
27 |
+
[2025-07-08 12:08:54] Closed app: chrome.exe
|
28 |
+
[2025-07-08 12:08:54] Closed app: chrome.exe
|
29 |
+
[2025-07-08 12:08:55] Closed app: chrome.exe
|
30 |
+
[2025-07-08 12:08:55] Closed app: chrome.exe
|
31 |
+
[2025-07-08 12:08:55] Closed app: chrome.exe
|
32 |
+
[2025-07-08 12:10:49] Blocked site: huggingface.co
|
33 |
+
[2025-07-08 12:10:49] Blocked site: github.com
|
34 |
+
[2025-07-08 12:13:41] Closed app: WinStore.App.exe
|
35 |
+
[2025-07-08 12:19:06] Blocked site: chat.qwen.ai
|
36 |
+
[2025-07-08 12:19:06] Blocked site: chat.deepseek.com
|
37 |
+
[2025-07-08 12:19:06] Blocked site: civitai.com
|
38 |
+
[2025-07-08 12:21:48] Blocked site: https://chat.deepseek.com/
|
process_and_domain_blocker_windows_10_11/run_antiblock.bat
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
:: اجرای اسکریپت با دسترسی Administrator
|
3 |
+
|
4 |
+
:: فایل اسکریپت پایتون (مسیر کامل بده اگه جای دیگهست)
|
5 |
+
set SCRIPT=antiblock.py
|
6 |
+
|
7 |
+
:: اجرای پایتون به صورت Administrator
|
8 |
+
powershell -Command "Start-Process python -ArgumentList '%SCRIPT%' -Verb RunAs"
|