Architecture Overview
SonarLink implements a secure, offline file transfer system using acoustic transmission as the transport layer.
Core Components
- Encryption Engine: AES-256-CFB with HMAC-SHA256 authentication
- Compression Layer: gzip (level 6) for size optimization
- Audio Transmission: ggwave library with AUDIBLE_FAST protocol
- Protocol Handler: Chunking, sequencing, and error detection
Tool Usage & Workflow
SonarLink provides a simple menu-driven interface with 5 main options:
- Send text messages: Quick text transmission via audio
- Send files: Choose encryption mode (none/AES/RSA) and transmit
- Receive: Listen for incoming transmissions and save files automatically
- Decrypt received file: Separate decryption step using password or RSA private key
- Exit: Close the application
Important: Decryption is a separate manual step, not automatic. The tool can also be used solely for file encryption/decryption without any acoustic transmission.
File Processing Pipeline
1. Original File
Raw file data (X bytes)
→
2. Encryption
+48 bytes overhead
(32-byte HMAC + 16-byte IV)
→
3. Gzip Compression
~60% of encrypted size
(text files)
→
4. Base64 Encoding
~133% of compressed size
→
5. Transmission
120-char chunks via audio
Encryption & Security
Three Encryption Modes
SonarLink offers flexible security options to match your use case:
- No Encryption: Maximum speed for non-sensitive data
- AES-256 Symmetric: Fast encryption with password-based key derivation
- RSA Asymmetric: Public/private key encryption for advanced security scenarios
🔓 No Encryption
- Fastest transmission speed
- No password required
- Best for: Public data, speed tests
- Security: None - data transmitted in clear
🔐 AES-256 Encryption
Symmetric Encryption
- 256-bit key size (military-grade)
- CFB mode for stream cipher capability
- Password-based key derivation (PBKDF2)
- Unique IV per transmission
- HMAC-SHA256 authentication (32 bytes)
- Best for: Most use cases, single recipient
🔑 RSA Encryption
Asymmetric Encryption
- Public/private key pairs
- No shared password needed
- Recipient generates key pair
- Sender encrypts with public key
- Only private key can decrypt
- Best for: Multiple recipients, no pre-shared secrets
🗜️ Compression
gzip level 6
- Balance between speed and ratio
- ~60% compression for text files
- Reduces transmission time
- Applied before Base64 encoding
- Works with all encryption modes
⚠️ Security Best Practices
Choosing Encryption Mode:
- No Encryption: Only for non-sensitive, public data
- AES-256: Best for most scenarios with strong passwords (16+ characters)
- RSA: When you can't share passwords beforehand or need multiple recipients
General Guidelines:
- Controlled Environment: Transmit in physically secure locations
- Critical Data: Use double encryption for extremely sensitive files (encrypt before SonarLink)
- Verification: Always verify transmission integrity (HMAC for AES mode)
- Unique Passwords: Use different passwords for different transmissions (AES mode)
Audio Protocol Specifications
Protocol
AUDIBLE_FAST (ID: 1)
Chunk Size
120 characters
Max Payload
~140 bytes per chunk
Inter-Chunk Delay
1.0 second
Frequency Range
Audible spectrum
Audio Transmission Characteristics
Advantages:
- ✅ Covert transmission - difficult to detect visually
- ✅ Plausible deniability - can be disguised as normal audio
- ✅ Works through barriers (walls, doors)
- ✅ No line-of-sight required
- ✅ Censorship resistant
Considerations:
- ⚠️ Requires quiet environment for reliability
- ⚠️ Distance limited (<3 meters optimal)
- ⚠️ Environmental noise affects success rate
- ⚠️ Slower than QR code transmission
Optimal Audio Conditions
- Environment: Quiet room with minimal background noise
- Distance: Less than 1 meter between devices
- Volume: 60-80% system volume
- Hardware: Quality speakers and microphones
- Battery: Ensure sufficient power for entire transmission
System Requirements
Software Requirements
- Python: 3.8 or higher
- Operating Systems:
- Linux (Ubuntu, Debian, Arch, etc.)
- macOS 10.14+
- Windows 10/11
- Dependencies:
- ggwave (audio transmission)
- cryptography (encryption)
- PyAudio or sounddevice (audio I/O)
Hardware Requirements
- Audio Transmission:
- Working microphone
- Working speakers or audio output
- Recommended: External speakers for better range
- General:
- Minimum 512 MB RAM
- 300 MB disk space (including dependencies)
Quick Installation
# Clone the repository
git clone https://github.com/marianopeluso/sonarlink.git
cd sonarlink
# Install dependencies (requires ~200-300 MB)
pip install -r requirements.txt
# Run SonarLink
python sonarlink.py --help
Note: Dependencies include NumPy (~100 MB), cryptography (~15 MB), ggwave, and PyAudio. Total space required: ~300 MB including all libraries.