-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
187 lines (154 loc) · 5.61 KB
/
bot.py
File metadata and controls
187 lines (154 loc) · 5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import time
import psutil
import os
import re
import requests
import socket
from pynput import mouse
from collections import deque
from colorama import init, Fore, Style
from pynput import keyboard
import base64
from cryptography.fernet import Fernet
init(autoreset=True)
# Configurații
WEBHOOK_URL = "YOUR_WEBHOOK"
CPS_THRESHOLD = 12
CONSTANCY_THRESHOLD = 4
CONSTANCY_DEVIATION_MS = 3
MIN_IMPOSSIBLE_PRECISION = [100.0, 125.0, 133.33, 200.0]
SUSPECT_KEYWORDS = [
"auto", "macro", "clicker", "tiny", "pulover", "op_", "logitech", "glorious", "bloody",
"razer", "xmouse", "recorder", "corsair", "steel", "hotkey", "keyran", "binder",
"clickermann", "ghost", "mouse", "enhanced", "key", "rapid", "autohotkey"
]
click_times = deque(maxlen=20)
click_intervals = deque(maxlen=20)
suspect_logs = []
all_logs = []
last_click = None
special_clicks = []
# Funcții
def remove_ansi_codes(text):
return re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', '', text)
def get_pc_name():
return socket.gethostname()
def get_ip():
try:
return requests.get("https://api.ipify.org").text
except:
return "Unknown"
key_source = "SPARTA.1st".ljust(32)[:32].encode()
KEY = base64.urlsafe_b64encode(key_source)
cipher = Fernet(KEY)
HIDDEN_LOG_PATH = os.path.join(os.getenv("APPDATA"), ".hidden_log.dat")
def log(msg):
clean = remove_ansi_codes(msg)
print(msg)
all_logs.append(clean)
try:
encrypted = cipher.encrypt(clean.encode())
with open(HIDDEN_LOG_PATH, "ab") as f:
f.write(encrypted + b"\n")
except Exception as e:
print(Fore.RED + f"[!] Eroare la scrierea logului criptat: {e}")
def send_webhook_summary():
pc = get_pc_name()
ip = get_ip()
total_clicks = len(all_logs)
total_suspect = len(suspect_logs)
total_ok = total_clicks - total_suspect
total_special = len(special_clicks)
entries = "\n".join([f"• {log}" for log in suspect_logs[-1000:]]) or "*Nimic suspect.*"
specials = "\n".join([f"• {line}" for line in special_clicks[-1000:]]) or "*Nimic.*"
embed = {
"title": "📊 Raport Clickuri Final",
"description": (
f"🖥️ **PC:** {pc}\n"
f"🌐 **IP:** {ip}\n"
f"✅ **Clickuri normale:** {total_ok}\n"
f"❌ **Clickuri suspecte:** {total_suspect}\n"
f"🔍 **Clickuri speciale:** {total_special}\n\n"
f"🔁 **Clickuri speciale (jitter/butterfly):**\n{specials}\n\n"
f"🚨 **Clickuri suspecte:**\n{entries}"
),
"color": 0xffaa00 if special_clicks else (0xff4444 if suspect_logs else 0x00ff88)
}
try:
requests.post(WEBHOOK_URL, json={"embeds": [embed]})
except Exception as e:
print(f"[!] Webhook error: {e}")
def get_suspect_process_name():
for proc in psutil.process_iter(['name']):
try:
name = proc.info['name'].lower()
if any(k in name for k in SUSPECT_KEYWORDS):
return name
except:
continue
return "Unknown software"
def calculate_cps():
if len(click_times) < 2:
return 0
duration = click_times[-1] - click_times[0]
return round((len(click_times) - 1) / duration, 2) if duration > 0 else 0
def is_constant_clicking():
if len(click_intervals) < CONSTANCY_THRESHOLD:
return False
base = round(click_intervals[-1], 2)
for i in range(1, CONSTANCY_THRESHOLD):
if abs(round(click_intervals[-i - 1], 2) - base) > CONSTANCY_DEVIATION_MS:
return False
return True
def detect_click_type(interval):
if interval < 60:
return "jitterclick"
elif 60 <= interval < 90:
return "butterfly"
return None
def on_click(x, y, button, pressed):
global last_click
if pressed:
now = time.time()
click_times.append(now)
if last_click:
interval = (now - last_click) * 1000
click_intervals.append(interval)
cps = calculate_cps()
click_type = detect_click_type(interval)
if click_type:
msg = f"[!] {click_type} click | Interval: {round(interval, 2)}ms | CPS: {cps}"
special_clicks.append(msg)
log(Fore.YELLOW + msg)
is_suspect = False
reason = ""
if round(interval, 2) in MIN_IMPOSSIBLE_PRECISION:
is_suspect = True
reason = "Perfect interval - known macro"
elif cps > CPS_THRESHOLD:
is_suspect = True
reason = f"High CPS: {cps}"
elif is_constant_clicking():
is_suspect = True
reason = "Low CPS but consistent delay"
if is_suspect:
proc = get_suspect_process_name()
msg = f"[SUSPECT] {round(interval,2)}ms | {reason} | Source: {proc}"
suspect_logs.append(msg)
log(Fore.RED + msg)
else:
log(Fore.GREEN + f"[✓] {round(interval,2)} ms | CPS: {cps}")
last_click = now
def on_key_press(key):
if key == keyboard.Key.f8:
send_webhook_summary()
os._exit(0)
keyboard.Listener(on_press=on_key_press).start()
# Start monitor
print(Fore.YELLOW + " Monitorizarea a inceput. Apasă f8 pentru a opri.")
try:
with mouse.Listener(on_click=on_click) as listener:
listener.join()
except KeyboardInterrupt:
print(Fore.CYAN + "\n Monitorizare oprită.")
send_webhook_summary()