Notes
Notes - notes.io |
import psutil
import ctypes
class DebuggerBlocker:
def __init__(self):
self.debuggers = []
def add_debugger(self, pid, name):
self.debuggers.append((pid, name))
def remove_debugger(self, pid):
self.debuggers = [(p, n) for p, n in self.debuggers if p != pid]
def check_debugger_methods(self):
debugger_detected = False
if hasattr(sys, 'gettrace') or sys.flags.debug:
debugger_detected = True
for process in psutil.process_iter(['pid', 'name']):
for debugger_name in ["gdb", "pdb", "ida", "x64dbg"]:
if debugger_name in process.info['name'].lower():
debugger_detected = True
self.add_debugger(process.info['pid'], process.info['name'])
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
if kernel32.IsDebuggerPresent():
debugger_detected = True
if sys.platform == 'linux' and self.is_ptrace_attached():
debugger_detected = True
if kernel32.CheckRemoteDebuggerPresent(-1, ctypes.byref(ctypes.c_int(0))):
debugger_detected = True
process_list = psutil.pids()
for pid in process_list:
try:
process = psutil.Process(pid)
if process.parent() is None:
self.add_debugger(pid, process.name())
debugger_detected = True
except psutil.NoSuchProcess:
continue
for process in psutil.process_iter(['pid', 'name']):
if process.info['name'].lower().startswith("dbg"):
self.add_debugger(process.info['pid'], process.info['name'])
debugger_detected = True
if self.get_syscall_count() > 1000:
debugger_detected = True
if self.check_process_memory():
debugger_detected = True
if self.check_remote_debugger_present():
debugger_detected = True
def is_ptrace_attached(self):
try:
with open('/proc/self/status', 'r') as status:
return 'TracerPid' in status.read()
except Exception:
return False
def get_syscall_count(self):
try:
return psutil.Process().num_threads()
except Exception:
return 0
def check_process_memory(self):
try:
process = psutil.Process()
memory_info = process.memory_info()
return memory_info.rss > 100000000
except Exception:
return False
def check_remote_debugger_present(self):
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
result = kernel32.CheckRemoteDebuggerPresent(-1, ctypes.byref(ctypes.c_int(0)))
return result == 1
def check_debuggers(self):
if self.check_debugger_methods():
print("Debug algılandı")
for pid, name in self.debuggers:
print(f"Debug tespit edildi: PID {pid}, İsim: {name}")
self.remove_debugger(pid)
def main():
blocker = DebuggerBlocker()
while True:
blocker.check_debuggers()
if __name__ == "__main__":
main()
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team