add anti-crypto
This commit is contained in:
parent
de7ecd460f
commit
db79986329
1 changed files with 19 additions and 3 deletions
22
main.py
22
main.py
|
@ -13,6 +13,12 @@ from pathlib import Path
|
||||||
import requests
|
import requests
|
||||||
import certifi
|
import certifi
|
||||||
import tensorflow as tf # TensorFlow for GPU monitoring
|
import tensorflow as tf # TensorFlow for GPU monitoring
|
||||||
|
import re # Regular expressions for address detection
|
||||||
|
|
||||||
|
# Regular expressions for detecting crypto addresses
|
||||||
|
bitcoin_regex = re.compile(r'[13][a-km-zA-HJ-NP-Z1-9]{25,34}', re.IGNORECASE)
|
||||||
|
ethereum_regex = re.compile(r'0x[a-fA-F0-9]{40}', re.IGNORECASE)
|
||||||
|
monero_regex = re.compile(r'4[AB][A-Za-z0-9]{93}', re.IGNORECASE)
|
||||||
|
|
||||||
# Monitored URLs
|
# Monitored URLs
|
||||||
monitored_urls = [
|
monitored_urls = [
|
||||||
|
@ -29,7 +35,7 @@ monitored_urls = [
|
||||||
"https://hotmail.com"
|
"https://hotmail.com"
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of known mining processes
|
# Updated list of known mining processes
|
||||||
mining_processes = [
|
mining_processes = [
|
||||||
"xmrig.exe",
|
"xmrig.exe",
|
||||||
"bfgminer.exe",
|
"bfgminer.exe",
|
||||||
|
@ -142,11 +148,21 @@ def get_gpu_usage():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def kill_suspicious_processes():
|
def kill_suspicious_processes():
|
||||||
for proc in psutil.process_iter(['pid', 'name']):
|
for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
|
||||||
try:
|
try:
|
||||||
proc_name = proc.info['name'].lower()
|
proc_name = proc.info['name'].lower()
|
||||||
|
cmdline = " ".join(proc.info['cmdline']).lower()
|
||||||
|
|
||||||
if proc_name in mining_processes and proc_name not in bypassed_processes:
|
if proc_name in mining_processes and proc_name not in bypassed_processes:
|
||||||
print(f"Terminating suspicious process: {proc.info['name']} (PID: {proc.info['pid']})")
|
print(f"Terminating suspicious mining process: {proc.info['name']} (PID: {proc.info['pid']})")
|
||||||
|
proc.terminate()
|
||||||
|
proc.wait()
|
||||||
|
|
||||||
|
# Check for crypto addresses in command line arguments
|
||||||
|
if (bitcoin_regex.search(cmdline) or
|
||||||
|
ethereum_regex.search(cmdline) or
|
||||||
|
monero_regex.search(cmdline)) and proc_name not in bypassed_processes:
|
||||||
|
print(f"Terminating process with crypto address: {proc.info['name']} (PID: {proc.info['pid']})")
|
||||||
proc.terminate()
|
proc.terminate()
|
||||||
proc.wait()
|
proc.wait()
|
||||||
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
|
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
|
||||||
|
|
Loading…
Reference in a new issue