Skip to content

Latest commit

Β 

History

134 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PrivaseeAI.Security

License Python 3.11+ Code Tests Coverage

Real-Time iOS Threat Detection & Monitoring System

PrivaseeAI.Security is a privacy-preserving iOS threat detection system that provides continuous security monitoring through VPN integrity checks, backup analysis, and behavioral pattern detection. Built in response to a real carrier-level attack, its detection rules were derived from that incident's logs.

Status: v0.3.0-alpha - active development | 8,199 lines of Python | 385 tests passing, 10 skipped | 74% coverage

Not production ready. Alert delivery and the AES helper work, but the web dashboard is an unwired prototype, the persistence layer is not connected to any monitor, and two of the three orchestrator monitor loops do no detection. See ASSESSMENT.md for a verified capability-by-capability breakdown.

🎯 Overview

Unlike traditional periodic scans, PrivaseeAI.Security provides continuous real-time monitoring with instant alerts when threats are detected. All analysis happens locally on your machine, ensuring complete privacy and data sovereignty.

What Makes This Different

  • βœ… Incident-Derived: Rules written against a real carrier-level attack (January 26, 2026) β€” real provenance, but one incident, and false positives are not yet measured
  • ⚠️ Continuous Monitoring: privasee start currently runs carrier checks only; the VPN and API monitor loops are not yet wired to a live input
  • βœ… Privacy-First: analysis is 100% local, no cloud dependencies
  • ⚠️ Alpha: 8,199 lines of code, 385 tests passing, 74% coverage β€” not production ready
  • βœ… Open Source: Apache 2.0 license, full transparency

✨ Current Features (v0.3.0-alpha)

πŸ›‘οΈ Real-Time Threat Detection

VPN Integrity Monitor (386 lines)

  • Detects TCP fallback when UDP is blocked
  • Tracks API rate limiting and cooldown periods
  • Identifies server hopping patterns (4+ servers in <10 min)
  • Validates certificates against known-good fingerprints
  • 14 integration tests covering real attack scenarios

API Abuse Monitor (397 lines)

  • Location tracking detection via API abuse
  • Rate limit identification and analysis
  • Burst pattern detection
  • Background activity monitoring
  • 19 unit tests validating all detection rules

Carrier Compromise Detector (790 lines)

  • Localhost routing detection in VPN profiles
  • eSIM profile monitoring
  • DNS tampering identification
  • Cross-backup persistence tracking
  • 28 comprehensive unit tests

Certificate Validator (295 lines)

  • Known-good fingerprint database (ProtonVPN baseline)
  • Certificate chain validation
  • Expiry date checking
  • Self-signed certificate detection
  • 8 unit tests ensuring accuracy

Telegram Alerting (300 lines)

  • Real-time notifications for CRITICAL/HIGH threats
  • Severity-based filtering
  • Automatic threat deduplication
  • Custom message formatting
  • Alert throttling to prevent spam

πŸš€ System Architecture

Orchestrator (374 lines)

  • Concurrent monitoring using asyncio
  • Multi-monitor coordination
  • Smart threat aggregation
  • Automatic deduplication
  • Graceful shutdown handling

CLI Interface (319 lines)

privasee start      # Start continuous monitoring
privasee scan       # One-time security scan
privasee status     # Check system health
privasee config     # View configuration
privasee alerts     # Show recent threats
privasee dashboard  # Launch web dashboard (NEW in v0.3.0)

Rich console output with tables and color-coded severity indicators

πŸ”§ Infrastructure

  • Configuration System (180 lines) - YAML support, environment variables, validation
  • Device Info Extractor (796 lines) - iOS backup parsing, profile extraction
  • File Watcher (97 lines) - Real-time directory monitoring
  • Logger (97 lines) - JSON/text formatting, structured logging
  • Crypto Module (123 lines) - AES-256 encryption, SHA hashing

πŸ“Š Test Coverage

395 Tests - 385 passing, 10 skipped, 74% line coverage

tests/
β”œβ”€β”€ unit/ (~250 tests)
β”‚   β”œβ”€β”€ VPN integrity, API abuse, carrier detection
β”‚   β”œβ”€β”€ Certificate validation, crypto operations
β”‚   └── Configuration, logging, file watching
β”‚
└── integration/ (~51 tests)
    β”œβ”€β”€ Backup monitoring workflow
    β”œβ”€β”€ Real attack pattern detection
    └── End-to-end monitoring scenarios

Many tests use real attack logs from the January 26, 2026 incident as fixtures. That provenance is a genuine strength β€” the rules were written against traffic that actually happened, not invented scenarios.

It is not the same as validation. The rules were derived from one incident, and the suite still tests that detection fires more thoroughly than that it stays quiet β€” though the gap is narrowing: roughly 12% of tests now exercise benign input, up from 4%, via the tests/negative/ suite specified in ASSESSMENT.md Β§4.

That suite currently covers carrier detection and network state only. For those rules the false-positive behaviour is measured: 15 ordinary configurations that previously raised alerts β€” a corporate MDM profile, an MVNO SIM, a home router's resolver β€” now produce none, while a VPN terminating on the device still reports CRITICAL. For the remaining monitors the false-positive rate is still unmeasured. ASSESSMENT.md Β§3 grades every rule individually.

πŸ”’ Privacy-First Design

  • 100% Local Processing - All analysis on your machine
  • No Cloud Dependencies - Fully self-hosted, no external services
  • Data Sovereignty - You control all security data
  • Encrypted Backups Supported - Works with both encrypted and unencrypted iOS backups
  • Open Source - Full code transparency, audit the security yourself

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              PrivaseeAI Security CLI                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚         Threat Orchestrator (asyncio)             β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”˜  β”‚
β”‚       β”‚             β”‚              β”‚             β”‚      β”‚
β”‚  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β–Όβ”€β”€β”€β”€β” β”‚
β”‚  β”‚    VPN    β”‚ β”‚    API     β”‚ β”‚  Carrier   β”‚ β”‚Backupβ”‚ β”‚
β”‚  β”‚ Integrity β”‚ β”‚   Abuse    β”‚ β”‚Compromise  β”‚ β”‚ Mon  β”‚ β”‚
β”‚  β”‚  Monitor  β”‚ β”‚  Monitor   β”‚ β”‚  Detector  β”‚ β”‚itor  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”¬β”€β”€β”€β”€β”˜ β”‚
β”‚       β”‚             β”‚             β”‚              β”‚      β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                            β”‚                             β”‚
β”‚                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚                   β”‚ Threat Aggregatorβ”‚                   β”‚
β”‚                   β”‚  & Deduplication β”‚                   β”‚
β”‚                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                            β”‚                             β”‚
β”‚                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚                   β”‚     Telegram     β”‚                   β”‚
β”‚                   β”‚     Alerter      β”‚                   β”‚
β”‚                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                                                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Python 3.11+ (required)
  • macOS with iOS device backup capability
  • iPhone with iOS 14+ (tested on iPhone 16 Pro, iOS 18.2)
  • Telegram Bot (optional, for alerts)

Installation

# 1. Clone the repository
git clone https://github.com/aurelianware/PrivaseeAI.Security.git
cd PrivaseeAI.Security

# 2. Create virtual environment (recommended)
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Install package in development mode
pip install -e .

# 5. Verify installation
privasee --help

Basic Usage

# Start continuous monitoring
privasee start

# Run one-time scan
privasee scan

# Check system status
privasee status

# View configuration
privasee config

# View recent alerts
privasee alerts

# Launch web dashboard
privasee dashboard
# Visit http://localhost:8000

Optional: Telegram Alerts

# 1. Create bot with @BotFather on Telegram
# 2. Get your bot token and chat ID
# 3. Configure alerts

export TELEGRAM_BOT_TOKEN="your_token_here"
export TELEGRAM_CHAT_ID="your_chat_id"

# Or add to .env file
echo "TELEGRAM_BOT_TOKEN=your_token" >> .env
echo "TELEGRAM_CHAT_ID=your_chat_id" >> .env

πŸ“– Documentation

Getting Started

Advanced Usage

Development

🎯 Use Cases

Individual Users

  • Monitor your iPhone for sophisticated attacks
  • Detect VPN manipulation in real-time
  • Identify location tracking attempts
  • Verify iOS backup integrity

Security Professionals

  • Forensic analysis of compromised devices
  • Threat research and pattern identification
  • Security auditing for clients
  • Incident response tool

Privacy Advocates

  • Verify carrier-level security
  • Monitor for government surveillance
  • Detect spyware and tracking
  • Maintain digital privacy

πŸ” Real-World Validation

Built from Actual Attack

On January 26, 2026, the developer's iPhone was compromised at the carrier level. This system was built to detect and prevent such attacks:

Attack Patterns Detected:

  • βœ… UDP blocking forcing WireGuard to TCP
  • βœ… API rate limiting (50-minute cooldown) for location tracking
  • βœ… Server hopping (4 servers in 7 minutes)
  • βœ… Certificate manipulation attempts
  • βœ… DNS64 tampering

Every detection rule is validated against these real attack logs.

Test Validation

  • iPhone 16 Pro (iOS 18.2) - Full validation
  • iPhone 12+ (iOS 14+) - Expected to work
  • macOS Ventura/Sonoma - Tested and working

πŸ—ΊοΈ Roadmap

βœ… Phase 0-2: MVP Complete (Weeks 1-6)

  • Core monitoring system
  • CLI interface
  • Real-time alerting
  • Comprehensive testing
  • Status: Shipped v0.3.0-alpha

πŸ”„ Phase 3: Production Deployment (February 2026)

  • Background service (launchd)
  • Auto-start on boot
  • Log rotation
  • Crash recovery
  • Status: In Progress

πŸ“… Phase 4: Persistence Layer (March 2026)

  • PostgreSQL + TimescaleDB
  • Historical analysis
  • Multi-device support (3+ devices)
  • Query API

πŸ“… Phase 5: Web Dashboard (March-April 2026)

  • FastAPI REST API
  • React dashboard
  • Real-time visualization
  • Configuration UI
  • PDF reports

πŸ“… Phase 6+: Advanced Features (Q2-Q4 2026)

  • AI/ML anomaly detection
  • SIEM integrations
  • Enterprise features
  • Mobile apps

See ROADMAP.md for detailed timeline and milestones.

🀝 Contributing

We welcome contributions! This project needs:

High Priority:

  • πŸ”΄ Beta testers with iPhones (iOS 14+)
  • πŸ”΄ Python developers for dashboard
  • 🟠 UI/UX designers
  • 🟠 Technical writers
  • 🟑 Security researchers

Getting Started:

  1. Read CONTRIBUTING.md
  2. Check open issues
  3. Look for good first issue labels
  4. Fork, code, test, submit PR

πŸ“Š Project Stats

Metric Value
Production Code 8,199 lines Python
Test Code 6,689 lines
Tests 395 (385 passing, 10 skipped)
Line Coverage 74% (as published by the repo's own coverage workflow)
Negative-test coverage ~12% (49/395; see ASSESSMENT.md Β§4)
Test Fixtures Real attack logs (Jan 26, 2026 incident)

πŸ›‘οΈ Security

Reporting Vulnerabilities:

Security Features:

  • All analysis happens locally
  • No telemetry or tracking
  • Encrypted backup support
  • Open source for full auditability

πŸ“„ License

Apache License 2.0 - See LICENSE for details.

TL;DR: You can use, modify, and distribute this software commercially or non-commercially, with attribution.

πŸ™ Acknowledgments

Built on the shoulders of giants:

  • iOS Security Community - Threat intelligence and research
  • MVT Project - Mobile Verification Toolkit indicators
  • Amnesty Tech - NSO Pegasus research and STIX feeds
  • ProtonVPN - Certificate fingerprint baseline for validation
  • Real-World Attack - January 26, 2026 incident that motivated this project

πŸ“ž Support & Community

⚠️ Disclaimer

Legal Notice: This tool is designed for monitoring YOUR OWN devices for security threats. Unauthorized monitoring of devices you do not own or have explicit permission to monitor may be illegal in your jurisdiction. Always respect privacy laws and obtain proper authorization.

Use at Your Own Risk: This software is provided "as is" without warranty. While we strive for accuracy, false positives and false negatives may occur. Always verify threats independently.

🌟 Star History

If you find this project useful, please consider:

  • ⭐ Starring the repository on GitHub
  • πŸ› Reporting issues you encounter
  • πŸ’‘ Suggesting features you'd like to see
  • 🀝 Contributing code or documentation
  • πŸ“’ Sharing with others who might benefit

Built with πŸ›‘οΈ by privacy advocates, for privacy advocates.

Status: v0.3.0-alpha | active development | 385 tests passing | see ASSESSMENT.md

Get Started | Documentation | Contribute | Roadmap

About

Security Repo for keeping your devices private

Resources

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages