Keylogger Detection Tool for Windows – Real-Time Privacy Protection
Identify hidden keyloggers by analyzing process behavior, startup registry keys, potential DLL injections, and outbound data exfiltration. Alerts, logs, and removal recommendations included.
- ✓Behavioral heuristics + anomaly thresholds
- ✓Real-time notifications with detailed evidence
- ✓Tkinter desktop UI for scans & reports
1. Introduction
The Keylogger Detection Tool for Windows is a Python-based cybersecurity project designed to identify and neutralize keylogging software running on Windows systems. Keyloggers secretly record keystrokes to steal sensitive information such as passwords, card numbers, and personal data. This tool scans processes, registry entries, and network activity to detect suspicious keylogging behavior using machine learning and rule-based heuristics. It provides real-time alerts, system reports, and mitigation options—bolstering privacy and security.
2. Existing System vs Proposed System
- AV may miss stealthy/encrypted keyloggers.
- Manual process/registry checks are tedious and risky.
- Weak detection of keyboard API abuse anomalies.
- Automated behavior profiling and monitoring.
- Scans startup entries, active processes, DLL injections.
- psutil + winreg + socket for deep inspection.
- Real-time alerts and detailed logs.
- Lightweight and extendable signatures.
3. Working
- System Scan Initialization: Launch tool on Windows.
- Process Monitoring: Flag apps interacting with keyboard APIs/hooks.
- Registry Inspection: Audit startup (Run/RunOnce/Services/Tasks).
- Network Monitoring: Track suspicious outbound connections.
- Detection & Reporting: Show evidence and confidence scores.
- Optional Mitigation: Terminate/quarantine recommendations.
4. Technology Stack
- Language: Python
- Libraries: psutil, winreg, os, socket, pandas, tkinter
- Algorithm: Rule-based + anomaly thresholds (stats)
- Platform: Windows 7/8/10/11
- Interface: CLI or Tkinter GUI
- Database: CSV/SQLite for logs & reports
5. Modules
Detects processes using keyboard hooks.
- API usage patterns
- Hidden process checks
Scans autorun locations.
- Run/RunOnce/Services
- Scheduled Tasks
Outbound telemetry.
- Suspicious endpoints
- Frequent small POSTs
Behavioral scoring.
- Thresholded risk score
- Signature + anomaly mix
Visual alerts + logs.
- Real-time popups
- CSV/SQLite reports
Tkinter dashboard.
- Start scans
- View evidence
6. Advantages
- Extra protection beyond standard antivirus.
- Detects known & unknown keyloggers via heuristics.
- Lightweight, low resource usage.
- Detailed logs and evidence for investigation.
- Customizable for enterprise policies.
7. Applications
- Personal PC protection against credential theft.
- Enterprise monitoring & SOC enrichment.
- Educational projects in ethical hacking/malware analysis.
- Cyber forensics for malicious activity identification.
Python Integration Sketch (psutil + winreg + sockets)
import psutil, socket, os, time, pandas as pd
from datetime import datetime
try:
import winreg # Windows-only
except ImportError:
winreg = None
SUSPICIOUS_APIS = {"SetWindowsHookEx", "GetAsyncKeyState", "GetForegroundWindow"}
RISK = {}
def score(pid, reason, w=1.0):
RISK[pid] = RISK.get(pid, 0) + w
def scan_processes():
for p in psutil.process_iter(['pid','name','exe','username','connections']):
try:
# 1) Check suspicious names/locations (heuristic)
if p.info['name'] and any(x in p.info['name'].lower() for x in ['keylog','logger','hook']):
score(p.pid, 'name_match', 2.0)
# 2) DLL/module hints (pseudo; use pefile/ctypes in real impl)
# if uses_keyboard_hook(p): score(p.pid, 'kb_hook', 3.0)
# 3) Outbound connections to odd ports/foreign IPs
for c in p.connections(kind='inet'):
if c.raddr and c.status == psutil.CONN_ESTABLISHED:
ip, port = c.raddr.ip, c.raddr.port
if port in (21,23,25,8080) or is_suspicious_ip(ip):
score(p.pid, f'net_exfil:{ip}:{port}', 1.5)
except Exception:
continue
def scan_registry_autoruns():
if not winreg: return
roots = [
(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Run"),
(winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\Windows\CurrentVersion\Run"),
]
for root, path in roots:
try:
with winreg.OpenKey(root, path) as k:
i = 0
while True:
try:
name, val, _ = winreg.EnumValue(k, i)
if any(x in str(val).lower() for x in ['keylog','hidden','appdata\\roaming']):
# map value to process later; increase baseline risk
# (In practice correlate exe path -> pid)
pass
i += 1
except OSError:
break
except OSError:
pass
def is_suspicious_ip(ip):
try:
socket.inet_aton(ip)
# simple placeholder heuristic (replace with reputation/geo lookup)
return ip.startswith(("5.","37.","45.","89.","188."))
except OSError:
return False
def classify():
# convert RISK to decisions with thresholds
df = pd.DataFrame([{'pid':pid,'risk':r} for pid,r in RISK.items()])
df['label'] = df['risk'].apply(lambda r: 'Suspicious' if r>=3.0 else ('Watch' if r>=1.5 else 'Clean'))
return df.sort_values('risk', ascending=False)
if __name__ == "__main__":
while True:
RISK.clear()
scan_processes()
scan_registry_autoruns()
report = classify()
# show alerts for 'Suspicious', write CSV/SQLite, and allow terminate()
time.sleep(30)
What You Get
| Item | Included | Notes |
|---|---|---|
| Python Source Code | ✅ | Process/registry/network analysis |
| Heuristic & Threshold Engine | ✅ | Risk scoring + evidence |
| Tkinter GUI | ✅ | Start scan, review, export |
| Logs & Reports | ✅ | CSV/SQLite + playbooks |
| Demo Video | ✅ | Setup & working walkthrough |
| Report & PPT | ✅ | College-format templates |
| Support | ✅ | Installation + viva Q&A (1 month) |
FAQs — Keylogger Detection Tool (Windows)
Want a privacy-first Windows security project?
Get the Keylogger Detection Tool with code, demo, docs, and support.
WhatsApp Us Now
