PySentry is a lightweight, heuristic-based Intrusion Detection System (IDS) written in Python.
Unlike traditional antiviruses that rely on static signatures, PySentry analyzes process behavior in real time to identify potential threats such as keyloggers, reverse shells, and spyware.
FOR EDUCATIONAL AND DEFENSIVE PURPOSES ONLY
- Do not run the simulator on systems you do not own
- The author is not responsible for misuse
- Always test security tools in a controlled environment (VM recommended)
-
🕵️ Heuristic Analysis
Detects threats based on suspicious behavior rather than known signatures. -
🛡️ Smart Whitelisting
Automatically ignores trusted system paths and common applications to reduce false positives. -
📡 Network Monitoring
Watches for activeinet(internet) socket connections from background processes. -
🛑 Integrated Kill Switch
Instantly terminate suspicious processes directly from the dashboard. -
💻 Terminal Dashboard
Clean, color-coded, real-time monitoring interface.
PySentry follows a rule-based detection pipeline:
- Scan – Iterates through all running system processes (PIDs).
- Filter – Excludes safe system paths (
SAFE_PATHS) and ignored PIDs. - Analyze – Checks for script engines (Python, PowerShell, CMD) and active network connections.
- Flag
- 🔴 HIGH RISK: Script engine + active internet connection
- 🟡 MEDIUM RISK: Script engine running silently in background
- Python 3.6+
pip
-
Clone the repository
git clone https://github.com/BGx-11/PySentry.git cd PySentry -
Install dependencies
pip install -r requirements.txt
⚠️ Administrator / root privileges are recommended for full visibility.
Windows
python pysentry.py(Run terminal as Administrator)
Linux / macOS
sudo python3 pysentry.pyA safe simulator is included to validate detection.
-
Open a new terminal window
-
Run:
python simulation_tool.py
-
PySentry should instantly show a 🔴 HIGH RISK alert.
-
Use the PySentry prompt to kill the simulator PID.
PySentry/
│
├── pysentry.py # Main detection engine + dashboard
├── simulation_tool.py # Safe malware behavior simulator
├── requirements.txt # Dependencies (psutil)
└── README.md # Documentation
Edit pysentry.py to fine-tune detection.
SAFE_PATHS = [
r"C:\Windows\System32",
r"C:\Program Files\NVIDIA Corporation",
"TrustedApp.exe"
]Add interpreters like ruby, perl, or java to the SCRIPT_ENGINES list.
FOR EDUCATIONAL AND DEFENSIVE PURPOSES ONLY
- Do not run the simulator on systems you do not own
- The author is not responsible for misuse
- Always test security tools in a controlled environment (VM recommended)
This project is licensed under the MIT License.
Developed by BGx (Devansh Agarwal)
Cybersecurity Enthusiast & Developer