Skip to content

Rizzy1857/SentryShield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SentryShield

Offline-first security monitoring for ICS/OT and manufacturing environments. No cloud. No agents. No internet required after initial database seeding.

Platform .NET Python Tests Version


What is SentryShield?

SentryShield is a Windows security monitoring tool built specifically for manufacturing plants, industrial control systems (ICS), and OT environments. It runs as a lightweight Windows service, operates fully air-gapped, and gives plant operators a single dashboard to track vulnerabilities, USB threats, driver issues, and supplier file integrity.

Four pillars:

Pillar What it does
πŸ” Vulnerability Scanner Enumerates installed software, matches against live NVD + CERT-In CVE data with exact version range evaluation
πŸ”Œ USB Threat Detection Intercepts USB insertions via WMI, runs YARA (20 rules), Shannon entropy, magic byte, and IOC hash checks
πŸšͺ Supplier File Gateway 7-step validation pipeline for files dropped by external suppliers β€” blocks unknowns, YARA hits, and IOC matches
πŸ›‘ Driver & Hardening Audit Flags unsigned/outdated drivers and checks 6 Windows security controls (Defender, Firewall, RDP, AutoRun, etc.)

Repository Layout

SentryShield/
β”œβ”€β”€ SentryShield.sln
β”‚
β”œβ”€β”€ SentryService/              # .NET 8 Windows Service (modern deployments)
β”‚   β”œβ”€β”€ SentryWorker.cs         # Background polling loop
β”‚   β”œβ”€β”€ IPC/ProcessRunner.cs    # Python subprocess bridge
β”‚   └── Watchers/GatewayFolderWatcher.cs
β”‚
β”œβ”€β”€ SentryLegacyService/        # .NET 4.8 Windows Service (Win7 / WES7 HMIs)
β”‚   β”œβ”€β”€ LegacyServiceHost.cs    # ServiceBase + System.Threading.Timer
β”‚   β”œβ”€β”€ LegacyYaraGuard.cs      # Optional YARA β€” graceful fallback if Python absent
β”‚   β”œβ”€β”€ LegacyConfig.cs         # Typed config model
β”‚   β”œβ”€β”€ Program.cs              # Headless ServiceBase.Run() entry point
β”‚   └── appsettings.json
β”‚
β”œβ”€β”€ SentryCore/                 # Core detection library β€” dual-targets net8 + net48
β”‚   β”œβ”€β”€ Engines/
β”‚   β”‚   β”œβ”€β”€ VulnerabilityMatcher.cs
β”‚   β”‚   β”œβ”€β”€ USBMonitor.cs
β”‚   β”‚   β”œβ”€β”€ SupplierFileValidator.cs
β”‚   β”‚   β”œβ”€β”€ DriverAuditor.cs
β”‚   β”‚   β”œβ”€β”€ HardeningAudit.cs
β”‚   β”‚   └── SoftwareEnumerator.cs
β”‚   β”œβ”€β”€ Interfaces/
β”‚   β”œβ”€β”€ Models/
β”‚   └── Logging/EventLogWriter.cs
β”‚
β”œβ”€β”€ SentryDatabase/             # SQLite DAL β€” dual-targets net8 + net48
β”‚   β”œβ”€β”€ Schema/init.sql
β”‚   β”œβ”€β”€ VulnerabilityDb.cs
β”‚   β”œβ”€β”€ IOCDb.cs
β”‚   └── ScanHistoryDb.cs
β”‚
β”œβ”€β”€ SentryUI/                   # WPF Admin Dashboard (.NET 8)
β”‚   β”œβ”€β”€ MainWindow.xaml
β”‚   β”œβ”€β”€ ViewModels/DashboardViewModel.cs
β”‚   └── Views/
β”‚
β”œβ”€β”€ SentryPython/               # Python utilities
β”‚   β”œβ”€β”€ init_db.py
β”‚   β”œβ”€β”€ cert_parser.py
β”‚   β”œβ”€β”€ cert_in_parser.py
β”‚   β”œβ”€β”€ db_sync.py
β”‚   β”œβ”€β”€ yara_scanner.py
β”‚   └── ioc_populate.py
β”‚
β”œβ”€β”€ rules/
β”‚   └── malware.yar
β”‚
β”œβ”€β”€ Installer/
β”‚   └── SentryShield.wxs
β”‚
β”œβ”€β”€ Plugins/
β”‚   └── IDSPlugin/IDSPlugin.stub.cs
β”‚
β”œβ”€β”€ Tests/
β”‚   β”œβ”€β”€ SentryCore.Tests/
β”‚   └── SentryPython/tests/
β”‚
└── docs/
    β”œβ”€β”€ ARCHITECTURE.md
    β”œβ”€β”€ CHANGELOG.md
    β”œβ”€β”€ CONTRIBUTING.md
    β”œβ”€β”€ PRODUCTION_PATHWAYS.md
    β”œβ”€β”€ ROADMAP.md
    β”œβ”€β”€ SETUP.md
    β”œβ”€β”€ WIN7_COMPAT.md    # Legacy HMI deployment guide
    β”œβ”€β”€ ai_strategy.md
    └── idea.md

Prerequisites

Requirement Version Notes
Windows 10 / 11 / Server 2019+ Admin rights required β€” for modern deployments
.NET SDK 8.0 https://dotnet.microsoft.com/download
Python 3.11 https://www.python.org/downloads
WiX (optional) 4.x Only needed to build the .msi installer

Legacy HMI (Windows 7 / Embedded): Use SentryLegacyService instead of SentryService. See Docs/WIN7_COMPAT.md for the full deployment guide.

Requirement Version Notes
Windows 7 SP1 / WES7 / WE8.1 β€” Admin rights required
.NET Framework 4.8 4.8.x Download β€” must be installed manually on Win7
Python (optional) 3.8–3.11 Only for YARA scanning β€” service works without it

Quick Start (Developer)

git clone https://github.com/Rizzy1857/SentryShield
cd SentryShield

:: Python environment
cd SentryPython
python -m venv venv
venv\Scripts\activate
pip install yara-python requests pytest

:: Build and test
cd ..
dotnet build SentryShield.sln
dotnet test Tests/SentryCore.Tests/ --logger "console;verbosity=normal"
pytest Tests/SentryPython/tests/ -v

Vulnerability Database (Live Data)

SentryShield uses real CVE data β€” no synthetic vulnerabilities. The database is populated from two sources:

Source What Script
NIST NVD Manufacturing-relevant CVEs (SCADA, HMI, PLC, Siemens, Log4j, OpenSSL…) cert_parser.py
CERT-In India CERT advisory feed, CVE cross-referenced with NVD cert_in_parser.py

One-time setup (run on Windows after deploying):

set NVD_API_KEY=your-free-key-here   :: from nvd.nist.gov/developers/request-an-api-key
python SentryPython\init_db.py --db "C:\ProgramData\SentryShield\vulnerability.db" --days-back 365

See Docs/SETUP.md β†’ Section 7–9 for the full deployment guide.


Test Coverage

Suite File Tests
Vulnerability matching VulnerabilityMatcherTests.cs 15
USB threat detection USBMonitorTests.cs 11
Supplier file gateway SupplierFileValidatorTests.cs 14
Network IDS IDSPluginTests.cs 3
NUnit total 43
Python (YARA + NVD parser) test_sentryshield.py 16
Grand total 56
:: Run all NUnit tests
dotnet test Tests/SentryCore.Tests/ --logger "console;verbosity=normal"

:: Run all pytest tests
pytest Tests/SentryPython/tests/ -v

Documentation

Comprehensive guides and strategic documents are located in the docs/ directory:


Architecture

NVD API ──────┐
CERT-In ──────────► init_db.py / db_sync.py ──► vulnerability.db
               β”‚                                       β”‚
               β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚    β”‚  Modern (Windows 10/11)                     β”‚
               β”‚    β”‚  SentryService (.NET 8)                     β”‚
               β”‚    β”‚  └── SentryWorker / GatewayFolderWatcher   β”‚
               β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚    β”‚  Legacy (Windows 7 / WES7)                  β”‚
               β”‚    β”‚  SentryLegacyService (.NET 4.8)             β”‚
               β”‚    β”‚  └── LegacyServiceHost (ServiceBase+Timer)  β”‚
               β”‚    β”‚  └── LegacyYaraGuard (optional YARA)        β”‚
               β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚              β”‚  both use identical
               β”‚    SentryCore (dual-target: net8 + net48)
               β”‚    β”œβ”€β”€ VulnerabilityMatcher
               β”‚    β”œβ”€β”€ USBMonitor
               β”‚    β”œβ”€β”€ SupplierFileValidator
               β”‚    β”œβ”€β”€ DriverAuditor
               β”‚    └── HardeningAudit
               β”‚              β”‚
               └──────► SentryUI (WPF Dashboard β€” modern only)

Full architecture: docs/ARCHITECTURE.md


Installer

Build the MSI:

:: Publish binaries first
dotnet publish SentryService -c Release -r win-x64 -o publish\SentryService
dotnet publish SentryUI      -c Release -r win-x64 -o publish\SentryUI

:: Build MSI (requires WiX 4)
cd Installer
wix build SentryShield.wxs -o SentryShield-v1.0-Setup.msi

Silent GPO install:

msiexec /i SentryShield-v1.0-Setup.msi /qn /l*v install.log

Changelog

See docs/CHANGELOG.md for the full version history.

Version Date Highlights
v2.5-stable 2026-06-09 SentryShield v2.5 lockdown: full plugin architecture and security hardening
v2.0-dev 2026-06-08 "The Great Shift" to SentryPlugin.Abstractions, NVD WAF fixes, dual-target support
v1.1 2026-06-04 Live CERT-In pipeline, init_db.py, WiX installer, 25 new tests
v1.0 2026-06-03 Initial full build β€” all 4 pillars, WPF dashboard, 31 tests

License

MIT β€” see LICENSE if one applies.


About

TKAP Internship project

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors