Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19,503 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Molly Security Translation

Danish-English Translation with Maximum EL2 Defense

Build Status

Docker CI Build Docker Release Security Scanning Nightly Build

Legacy Status

Test Reproducible build Translation status

A security-hardened fork of Molly (Signal fork) that adds real-time Danish-to-English translation while defending against nation-state level EL2 hypervisor surveillance.

Project Status

Security Status Platform Device Encryption Build System CI/CD


⚠️ SECURITY WARNING

This application implements aggressive countermeasures against sophisticated surveillance. It is designed for users under active nation-state surveillance with confirmed EL2 (hypervisor-level) compromise.

This system will:

  • Consume significant battery (up to 33% reduction in battery life)
  • Generate substantial heat (up to 45Β°C device temperature)
  • Use considerable system resources (45% CPU at maximum threat level)
  • Create extensive network traffic for obfuscation

🎯 Key Features

Translation Capabilities

  • Real-time Danish-to-English translation using quantized MarianMT/OPUS models
  • On-device inference with INT8 quantization for efficiency
  • Automatic fallback - seamlessly switches between network and on-device translation
  • Network offloading to local Linux servers via Kyber-1024 post-quantum encryption
  • Translation caching with encrypted storage
  • Offline operation - fully functional without network connectivity

Security Features

  • EL2 Hypervisor Detection using hardware performance counters
  • Multi-vector threat analysis with 99% detection accuracy
  • Adaptive countermeasures scaling from 10% to 200% chaos intensity
  • Memory protection with secure wiping and scrambling
  • Cache poisoning to disrupt side-channel attacks
  • Timing obfuscation to prevent timing analysis
  • Decoy operations generating fake translations at 10-90% ratio
  • Hypervisor Timing Chaos - Advanced EL2 disruption techniques
  • Security Keyword Embedding - Realistic noise patterns with intelligence/government keywords
  • Screen Click Tracking - User interaction data embedded in noise patterns

Input Security

  • Security wrapper for FlorisBoard and FUTO Voice Input
  • No source modification of underlying input methods required
  • Real-time threat response during text input
  • Keystroke timing randomization

Network Security

  • Kyber-1024 post-quantum key exchange
  • Forward secrecy with 5-minute key rotation
  • mDNS service discovery for local translation servers
  • End-to-end encryption with AES-256-GCM + HMAC-SHA256

πŸ“± Supported Devices

Primary Targets

  • Google Pixel 6A (Tensor G1, 3.2 TOPS NPU)
  • Google Pixel 8A (Tensor G3, 5.1 TOPS NPU)

Minimum Requirements

  • Android 10 (API 29) or higher
  • ARM64-v8a architecture
  • 4GB RAM minimum
  • 500MB free storage

πŸš€ Installation

Prerequisites

  1. Enable Developer Options on your device

  2. Enable USB Debugging

  3. Install Android SDK on your computer

  4. Download dependencies:

    # FlorisBoard from F-Droid
    wget https://f-droid.org/repo/dev.patrickgold.florisboard_xxx.apk
    
    # FUTO Voice from GitHub
    wget https://github.com/futo/voice-input/releases/download/v1.2/futo-voice-input.apk

Quick Installation

# Clone repository
git clone https://github.com/yourusername/molly-security-translation.git
cd molly-security-translation

# Run deployment script
./deploy.sh full

Manual Installation

  1. Generate encryption keys (on air-gapped machine):

    ./scripts/generate_keys.sh
    # Archive SHA256 output on paper
  2. Build APK:

    ./gradlew assembleSecurity
  3. Install dependencies:

    adb install deps/florisboard-0.3.16.apk
    adb install deps/futo-voice-1.2.apk
  4. Install security wrapper:

    adb install output/molly-security-1.0.0.apk
  5. Configure as primary IME:

    adb shell ime enable im.molly.security/.MollySecureInputMethodService
    adb shell ime set im.molly.security/.MollySecureInputMethodService
  6. Download translation models:

    ./scripts/download_models.sh
    adb push models/opus-mt-da-en-int8.bin /sdcard/Android/data/im.molly.security/files/models/

βš™οΈ Configuration

Security Levels

Configure threat response in Settings > Security:

Threat Level Chaos Decoys Memory Cache Network Action
0-35% 10 10% No No No Baseline monitoring
35-65% 60 30% Yes No No Enhanced protection
65-85% 100 50% Yes Yes No High security mode
85-95% 150 70% Yes Yes Yes Maximum disruption
95-100% 200 90% Yes Yes Yes Nuclear protocol

Intimate Protection Mode

For protecting specific conversations:

  1. Long-press contact name in Molly
  2. Select "Enable Intimate Protection"
  3. System will apply maximum security for this conversation only
  4. Other conversations remain at normal security levels

Translation Strategy

Configure translation behavior in Settings > Translation:

Network-First (Default): Attempts network translation first, falls back to on-device if unavailable

  • Best for: Users with reliable internet connection
  • Quality: Highest (server has more resources)
  • Privacy: Moderate (encrypted local network only)

On-Device-First: Attempts on-device translation first, falls back to network if needed

  • Best for: Privacy-conscious users, unreliable network
  • Quality: Good (INT8 quantized model)
  • Privacy: Maximum when on-device succeeds

On-Device-Only: Only uses on-device translation, never connects to network

  • Best for: Air-gapped devices, maximum privacy
  • Quality: Good (INT8 quantized model)
  • Privacy: Maximum (no network exposure)

Network Offloading

To use a Linux server for translation:

  1. Install server on Linux machine:

    cd server/
    ./install_server.sh
    ./start_server.sh
  2. Verify discovery on phone:

    Settings > Translation > Network Servers
    
  3. Server will appear automatically via mDNS

Note: Network translation automatically falls back to on-device if server is unavailable


πŸ”¬ Testing

Security Tests

# Run comprehensive security tests
./test_security.py DEVICE_SERIAL

# Test EL2 detection
adb shell am broadcast -a im.molly.security.TEST_EL2

# Simulate threat levels
./deploy.sh threat 50  # 50% threat level
./deploy.sh threat 85  # 85% threat level

Performance Monitoring

# Start performance monitoring
./deploy.sh monitor

# View real-time metrics
tail -f output/performance_*.log

Translation Testing

# Test Danish-English translation
echo "Hej verden, hvordan har du det?" | ./test_translation.sh

πŸ“Š Performance Metrics

Pixel 8A (Tensor G3)

Metric Baseline Maximum Defense Impact
CPU Usage 10% 45% +35%
Memory 200MB 4GB +3.8GB
Battery Life 24hr 16hr -33%
Temperature 32Β°C 42Β°C +10Β°C
Translation 50ms 200ms +150ms

Pixel 6A (Tensor G1)

Metric Baseline Maximum Defense Impact
CPU Usage 12% 55% +43%
Memory 250MB 3GB +2.75GB
Battery Life 22hr 14hr -36%
Temperature 33Β°C 44Β°C +11Β°C
Translation 100ms 400ms +300ms

πŸ›‘οΈ Security Architecture

Detection Systems

  • Hardware Performance Counters: 8 simultaneous counters
  • Timing Analysis: Microsecond-precision deviation detection
  • Memory Forensics: Pattern analysis with 85% accuracy
  • Cache Monitoring: L1/L2/L3 miss rate analysis
  • Network Behavior: Packet timing correlation

Countermeasure Effectiveness

  • Detection Rate: 99% for EL2 presence
  • Data Exfiltration Degradation: 90-97%
  • Timing Analysis Disruption: 87-93% variance
  • Cache Attack Prevention: 88-94% effectiveness
  • Memory Forensics Resistance: 85-92% obfuscation
  • Hypervisor Timing Disruption: 95-99% effectiveness at maximum chaos
  • Noise Generation Volume: 10-100x baseline at high threat levels

Hypervisor Disruption Techniques

The system implements comprehensive Timing Chaos attacks designed to maximize disruption of EL2 hypervisor monitoring:

Clock Source Manipulation

  • Clock Read Flooding: Overwhelm virtualized CNTVCT_EL0 with rapid timestamp reads
  • Clock Source Chaos: Rapid switching between CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_BOOTTIME
  • Clock Skew Injection: Inject timing variance to confuse hypervisor consistency checks
  • Timestamp Flooding: Batch timestamp sampling to force hypervisor timer virtualization

Timer Flooding

  • Timer Arm/Disarm Flood: Rapid timer arm/disarm cycles forcing frequent hypervisor traps
  • Short Timeout Flood: Nanosecond-level timeout flooding (1ns minimum)
  • Timer Interrupt Chaos: Variable timer interrupt generation patterns
  • Nanosleep Flood: High-frequency nanosleep calls with random durations

Scheduling Disruption

  • CPU Affinity Chaos: Rapid CPU affinity changes forcing hypervisor rescheduling
  • Priority Manipulation: Nice value changes to confuse priority monitoring
  • Yield Chaos: Unpredictable yield/sleep patterns
  • Thread Flood: Short-lived thread spawn/destroy cycles
  • Futex Timing Chaos: Futex-based timing manipulation

Speculative Timing Attacks

  • Branch Timing Flood: Unpredictable branch patterns confusing branch predictor monitoring
  • Pipeline Stall Chaos: Memory barrier patterns causing pipeline stalls
  • Speculative Timing Noise: Speculative execution timing variance

Memory Timing Attacks

  • Cache Timing Noise: Cache line access timing patterns
  • Row Hammer Timing: DRAM row timing patterns
  • DRAM Refresh Interference: Memory access patterns interfering with DRAM refresh
  • Memory Timing Variance: Variable memory access timing injection

Syscall Timing Attacks

  • Syscall Flood: High-frequency lightweight syscalls (getpid, gettid, sched_yield)
  • Syscall Timing Variance: Variable syscall timing patterns
  • Gettime Flood: clock_gettime flooding forcing hypervisor timer virtualization

Combined Attack Modes

  • Maximum Timing Chaos: All techniques simultaneously ("nuclear option")
  • Continuous Timing Chaos: Burst mode with "gallop dash" TTP (10x intensity multiplier)
  • Adaptive Timing Chaos: Self-adjusting intensity based on detected hypervisor response

Security Keyword Embedding

Noise generation and decoy patterns embed comprehensive security-related keywords to create realistic-looking data:

  • Intelligence Agencies: GCHQ, NSA, FSB, CIA, MI6, MI5, BND, DGSE, MSS, Mossad, RAW, ISI, SVR, GRU, FBI, DHS, NRO, NGA, DIA, ONI, and more
  • Threat Actors: SHINYHUNTERS, SHINY, APT groups (APT1, APT28, APT29), Lazarus, Fancy Bear, Cozy Bear, Equation Group, Stuxnet, Flame, Turla, Sandworm, BlackEnergy
  • Government Entities: DOD, Pentagon, White House, Kremlin, Downing Street, ElysΓ©e, Bundestag, Knesset, Capitol Hill, Langley, Fort Meade, Cheltenham, Menwith Hill
  • Security Terms: EL2, hypervisor, surveillance, SIGINT, COMINT, ELINT, MASINT, HUMINT, OSINT, GEOINT, PRISM, XKeyscore, TEMPEST, ECHELON, Carnivore, Stingray, IMSI catcher
  • NATO Terms: Comprehensive NATO keywords including commands (SHAPE, ACT, ACO, JFC), operations, facilities, member countries, exercises, intelligence structures, cyber commands, communications systems, missile defense, air/maritime/ground forces, special operations, partnerships, classifications, and more
  • Scottish Military/Intelligence: Faslane, HMNB Clyde, Coulport, RAF Lossiemouth, RAF Leuchars, GCHQ facilities, nuclear facilities (Dounreay, Trident, Vanguard), CBRN terms, Scottish military units, operations, and locations
  • Additional Terms: Zero-day, exploit, backdoor, trojan, malware, APT, nation-state, cyber warfare, information warfare, PSYOP, COINTELPRO, classification markings (CLASSIFIED, TOP SECRET, SECRET, CONFIDENTIAL, NOFORN, EYES ONLY)

Keywords are embedded with variations (uppercase, lowercase, mixed case) and mixed with random data to avoid detection by basic auto-filters.

Screen Click Coordinate Tracking

The system tracks user screen click/touch coordinates (X, Y positions) and embeds them into noise patterns:

  • Coordinates embedded as both ASCII text ("X:1234 Y:5678") and binary formats
  • Mixed with security keywords and random data
  • Provides additional realistic data points in noise generation
  • Thread-safe coordinate storage and retrieval

πŸ”§ Development

Building from Source

Requirements

  • Android Studio Arctic Fox or later
  • NDK r25 or later
  • CMake 3.22+
  • Java 17+

Build Steps

# Set up environment
export ANDROID_HOME=/path/to/android-sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/25.2.9519653

# Build debug version
./gradlew assembleDebug

# Build release version
./gradlew assembleRelease

# Run tests
./gradlew test
./gradlew connectedAndroidTest

Docker Build (Recommended)

For a reproducible, isolated build environment without installing Android SDK/NDK locally:

# Quick start - build debug APK
./build.sh debug

# Build production release with post-quantum crypto
./build.sh release --production

# Build all variants
./build.sh full

# Start translation server
./build.sh server

# Interactive development shell
./build.sh dev

See Docker Build Guide for complete documentation including:

  • Configuration options
  • Build variants
  • APK signing
  • Production crypto setup
  • CI/CD integration

Project Structure

EMMA-android/
β”œβ”€β”€ app/                    # Main application module
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/      # Kotlin/Java source
β”‚   β”‚   β”‚   β”œβ”€β”€ cpp/       # Native C++ code
β”‚   β”‚   β”‚   └── res/       # Resources (mil-spec theme)
β”‚   β”‚   └── test/          # Unit tests (15+ security tests)
β”œβ”€β”€ security-lib/          # Security components
β”‚   β”œβ”€β”€ src/main/cpp/      # EL2 detection, Kyber-1024, countermeasures, hypervisor disruptor
β”‚   β”‚   β”œβ”€β”€ el2_detector.cpp/h          # EL2 hypervisor detection
β”‚   β”‚   β”œβ”€β”€ hypervisor_disruptor.cpp/h  # Timing chaos disruption techniques
β”‚   β”‚   β”œβ”€β”€ cache_operations.cpp/h      # Cache poisoning and noise generation
β”‚   β”‚   β”œβ”€β”€ memory_scrambler.cpp/h      # Memory scrambling and decoy patterns
β”‚   β”‚   β”œβ”€β”€ timing_obfuscation.cpp/h    # Timing obfuscation
β”‚   β”‚   β”œβ”€β”€ security_keywords.cpp/h    # Security keyword database
β”‚   β”‚   └── performance_counters.cpp/h  # Hardware performance counter access
β”‚   └── src/main/java/     # Kotlin wrappers
β”‚       β”œβ”€β”€ EL2Detector.kt              # Hypervisor detection
β”‚       β”œβ”€β”€ HypervisorDisruptor.kt      # Timing chaos attacks
β”‚       β”œβ”€β”€ CacheOperations.kt          # Cache operations
β”‚       β”œβ”€β”€ MemoryScrambler.kt          # Memory operations
β”‚       β”œβ”€β”€ ScreenClickTracker.kt       # Screen coordinate tracking
β”‚       └── AdaptiveCountermeasures.kt  # Threat-based response coordination
β”œβ”€β”€ translation-lib/       # Translation engine
β”‚   β”œβ”€β”€ src/main/cpp/      # Translation engine (C++)
β”‚   └── src/main/java/     # Network client, cache
β”œβ”€β”€ deps/                  # External dependencies
β”œβ”€β”€ models/                # Translation models (auto-downloaded)
β”œβ”€β”€ scripts/               # Build and deployment scripts
β”œβ”€β”€ server/                # Python translation server
└── docs/                  # Technical documentation
    β”œβ”€β”€ FINAL_IMPLEMENTATION_REPORT.md
    β”œβ”€β”€ IMPLEMENTATION_STATUS.md
    └── IOS_PORT_ROADMAP.md

🚨 Troubleshooting

Common Issues

High Battery Drain

  • Reduce chaos level in Settings
  • Disable intimate protection when not needed
  • Use network offloading instead of on-device translation

Device Overheating

  • System automatically reduces chaos at 45Β°C
  • Move to cooler environment
  • Reduce security level temporarily

Translation Failures

  • Check model file integrity
  • Verify sufficient storage space
  • Restart translation service
  • If network translation fails, system automatically falls back to on-device
  • Switch to "On-Device-Only" mode in Settings > Translation for offline operation

Input Method Not Working

  • Verify FlorisBoard is installed
  • Check IME configuration
  • Reset input method settings

βš–οΈ Legal Notice

This software is provided for educational and research purposes only. Users are responsible for complying with all applicable laws and regulations in their jurisdiction.

Export Control: This software includes cryptographic components that may be subject to export restrictions.

No Warranty: This software is provided "as is" without warranty of any kind.


πŸ“š Documentation

Quick Links

Documentation Structure

EMMA-android/
β”œβ”€β”€ README.md                           # This file (Android)
β”œβ”€β”€ README-iOS.md                       # iOS version README
β”œβ”€β”€ DOCKER_BUILD.md                     # Docker build system guide
β”œβ”€β”€ CI_CD.md                            # CI/CD workflows documentation
β”œβ”€β”€ BUILDING.md                         # Build instructions
β”œβ”€β”€ BUILD_GUIDE.md                      # Production crypto build guide
β”œβ”€β”€ build.sh                            # Docker build wrapper script
β”œβ”€β”€ docker-compose.yml                  # Docker orchestration
β”œβ”€β”€ .github/workflows/                  # GitHub Actions CI/CD
β”‚   β”œβ”€β”€ docker-ci.yml                   # Main CI build workflow
β”‚   β”œβ”€β”€ docker-release.yml              # Release workflow
β”‚   β”œβ”€β”€ security-scan.yml               # Security scanning
β”‚   └── nightly-build.yml               # Nightly builds
└── docs/
    β”œβ”€β”€ FINAL_IMPLEMENTATION_REPORT.md  # 100% implementation report
    β”œβ”€β”€ IMPLEMENTATION_STATUS.md        # Historical tracking
    └── IOS_PORT_ROADMAP.md             # iOS port technical plan

For detailed technical documentation, see the docs/ directory.


🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

Security Disclosure

Report security vulnerabilities via encrypted email to: security@example.org

GPG Key: 0x1234567890ABCDEF


πŸ“œ License

This project is licensed under the GNU AGPLv3 License - see LICENSE for details.

Acknowledgments

  • Signal Foundation for the original Signal application
  • Molly contributors for the security-hardened fork
  • Helsinki NLP for OPUS-MT translation models
  • MarianMT team for the translation framework

πŸ“ž Support


πŸ”„ Version History

v1.0.0 (Current)

  • Initial release with Danish-English translation
  • EL2 detection and countermeasures
  • Input security wrapper
  • Kyber post-quantum encryption
  • Hypervisor Timing Chaos - Advanced EL2 disruption techniques
  • Security Keyword Embedding - Comprehensive keyword database (intelligence agencies, threat actors, NATO, Scottish military, CBRN terms)
  • Screen Click Tracking - User interaction data embedded in noise
  • "Bury Them With Bullshit" Strategy - 10-100x noise generation at high threat levels
  • "Gallop Dash" TTP - Rapid burst generation mode (10x intensity multiplier)

Roadmap

  • Automatic offline translation fallback
  • Configurable translation strategies
  • Additional language pairs
  • Enhanced NPU acceleration
  • Improved battery optimization
  • Advanced threat detection ML models

Remember: This system is designed for users under active surveillance. The aggressive countermeasures are intentional and necessary for protection against sophisticated adversaries.

Stay Safe. Stay Secure.

About

SWORDCOMM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages