🛡️ NetSentry
NetSentry is a lightweight, real-time Linux network bodyguard and threat sentinel. Running silently in the background or interactively via an htop-style terminal dashboard (TUI), NetSentry correlates network sockets with Linux processes, flags suspicious outbound connections (reverse shells, untrusted /tmp binaries, known malicious botnets/C2 nodes), and dispatches desktop notifications or executes firewall countermeasures.
✨ Features
- 🕵️ Process-Network Correlation: Maps every active socket to its PID, executable path, process name, and user.
- 🚨 Real-Time Threat Detection:
- Reverse Shell Detection: Detects shells (
bash,zsh,sh) or net tools (nc,socat) opening remote sockets. - Untrusted Path Execution: Flags binaries running from temporary directories like
/tmp/,/dev/shm/, or/var/tmp/. - Suspicious Port Alerts: Identifies connections on backdoor ports (4444, 1337, 31337, 6667, etc.).
- Threat Intelligence: Built-in and downloadable IP reputation feeds (Tor exits, botnet C2s, scanner IPs).
- Data Exfiltration Detection: Alerts when processes transmit large amounts of outbound data at abnormal rates.
- Reverse Shell Detection: Detects shells (
- 🖥️ Live Interactive Terminal Dashboard (TUI): Beautiful
htop-style dashboard with live hotkeys (↑/↓cursor,bblock IP,kkill process,ideep inspector,?help modal). - 🔔 Multi-Channel Alert Dispatcher: Native Linux desktop notifications, Telegram Bot API, and Discord/Slack webhook rich embeds.
- 🧱 Next-Gen Firewall Engine: Native
nftables,ufw, andiptablesbackends with automatic backend detection, IPv6 support, and temporary quarantine scheduling. - ⚡ Kernel Tracing & eBPF Ready: Socket event monitoring with graceful polling fallback (
netsentry bpf-status). - ⚙️ Systemd Integration: Single-command user service setup (
netsentry install-service).
🏗️ Architecture
┌────────────────────────┐
│ Linux Kernel / Sockets │
└───────────┬────────────┘
│
▼
┌─────────────────────────────────────┐
│ Network Monitor (psutil/proc) │
│ Maps sockets to PID & Binary Path │
└──────────────────┬──────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Threat Detector │
├──────────────────┬──────────────────┤
│ • Threat Intel │ • Port Blacklist │
│ • Shell Sockets │ • Untrusted Path │
└──────────────────┬──────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌────────────┐ ┌─────────────┐ ┌────────────┐
│ Desktop UI │ │ SQLite DB │ │ Firewall │
│ (notify) │ │ (sentry.db)│ │ (iptables) │
└────────────┘ └─────────────┘ └────────────┘
🚀 Quick Start
1. Installation
Via pipx (Recommended on Linux)
pipx install net-sentry
Via pip
pip install net-sentry
From source (for development)
git clone https://github.com/Lukasz-Szymanski/net-sentry.git
cd net-sentry
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
2. Launch Interactive TUI Dashboard
netsentry tui
3. Start Background Monitoring Daemon
# Start background daemon
netsentry start
# Check running status
netsentry status
4. Install GNOME Top Panel Indicator (Optional)
To show the live shield status on the Linux top panel:
netsentry install-extension
Log out and log back in (Wayland) or press Alt + F2 -> r (X11) to activate the shield in your top bar.
📖 CLI Commands
| Command | Description |
|---|---|
netsentry tui |
Open the interactive real-time terminal dashboard |
netsentry start |
Start the background monitoring daemon |
netsentry start -f |
Run the monitoring daemon in foreground |
netsentry stop |
Stop the running daemon |
netsentry status |
Display daemon status, total alerts, and active connections |
netsentry status --json |
Output system metrics and alerts in JSON format |
netsentry scan |
Run an instant socket scan and print security analysis table |
netsentry alerts |
Display recent security events recorded in SQLite |
netsentry block <IP> [-d <min>] |
Add IP to blacklist and apply firewall DROP rule (optional quarantine duration) |
netsentry blocked |
List currently blocked IPs and remaining quarantine time |
netsentry unblock <IP> |
Remove firewall DROP rule for IP |
netsentry traffic |
Display process bandwidth consumption and data exfiltration metrics |
netsentry bpf-status |
Inspect eBPF kernel tracing readiness and diagnostics |
netsentry kill <PID> |
Terminate a suspicious process by PID |
netsentry lookup <IP> |
Look up OSINT, reverse DNS, and GeoIP intelligence for an IP |
netsentry test-notify |
Test desktop, Telegram, and Webhook notification channels |
netsentry update-intel |
Download updated threat intelligence feeds |
netsentry install-service |
Install and enable the background systemd user service |
netsentry uninstall-service |
Stop and remove the systemd user service |
netsentry install-extension |
Install and enable the GNOME Shell top panel extension |
netsentry uninstall-extension |
Remove the GNOME Shell extension |
⚙️ Configuration
Configuration is automatically generated on first run at:
~/.config/netsentry/config.json
{
"scan_interval_seconds": 2.0,
"desktop_notifications": true,
"notification_cooldown_seconds": 30,
"auto_block_threats": false,
"auto_kill_threats": false,
"threat_score_threshold": 60,
"telegram_enabled": false,
"telegram_bot_token": "",
"telegram_chat_id": "",
"webhook_enabled": false,
"webhook_url": "",
"suspicious_ports": [23, 2323, 4444, 5555, 6667, 9001, 9050, 9051, 1337, 31337],
"whitelist_ips": ["127.0.0.1", "::1", "0.0.0.0"],
"whitelist_processes": ["systemd-resolved", "chronyd", "ntpd", "NetworkManager"]
}
🐧 Systemd Service (Autostart)
To enable NetSentry as a systemd user service with a single command:
netsentry install-service
To stop and remove the service:
netsentry uninstall-service
🧪 Testing
pytest -v
📜 License
Released under the MIT License.
Metadata
Release files for net-sentry 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| net_sentry-0.2.0.tar.gz | 46.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| net_sentry-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 93.9 kB
Release files / net_sentry-0.2.0.tar.gz
| Download URL | net_sentry-0.2.0.tar.gz |
|---|---|
| Size | 46.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cea1bf9cde26f670a29df7228d2f7992c879a15976111b5bc0fbb19fc98f2e5e
|
|
BLAKE2b-256 checksum How to use checksums |
960daa0e434ce130f973719f2c7b5c562f8cd6aee32af0bc0584b9335e9797fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / net_sentry-0.2.0-py3-none-any.whl
| Download URL | net_sentry-0.2.0-py3-none-any.whl |
|---|---|
| Size | 47.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d29f3ce5f5ccd555f6b38333458a169fc598af2dae65f8a5c5365c2846fa3cc7
|
|
BLAKE2b-256 checksum How to use checksums |
190c3e8822888d583b11b9cd608dfe3210052ad65454a8507c0599ed2f90a3d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency log