A feature-rich serial terminal application with built-in logging, encryption, and an interactive port selection system.
- Encrypted Logging - Secure session logging with Fernet encryption
- System Command Execution - Run system commands directly from the terminal
- Session Management - Unique session IDs for each connection
- Auto-reconnection - Automatically attempts to reconnect on disconnection
- Command History - Persistent command history across sessions
- Python 3.6 or higher
- pip (Python package manager)
pip install pyserial colorama cryptographypython WSerial.pypython WSerial.py [OPTIONS]| Option | Description |
|---|---|
-p, --port PORT |
Specify serial port (default: COM3) |
-b, --baud BAUD |
Specify baud rate (default: 115200) |
-o, --output [FILE] |
Save encrypted log. Use 'auto' for auto-generated filename |
-k, --output-key KEYFILE |
Custom key file for encryption |
# Use specific port and baud rate
python WSerial.py -p COM5 -b 9600
# Save encrypted log with auto-generated filename
python WSerial.py -o auto
# Save encrypted log with custom filename
python WSerial.py -o my_session_log
# Use custom encryption key file
python WSerial.py -k my_secret_key
# All options combined
python WSerial.py -p /dev/ttyUSB0 -b 115200 -o session_log -k custom_keyWhile connected to a serial device, you can use these special commands:
| Command | Description |
|---|---|
clear |
Clear the terminal screen |
banner |
Display the banner |
quit |
Exit the program |
session |
Show current session ID |
<system command> |
Execute system commands (e.g., ls, dir, ping) |
| Any other text | Sent to the serial device |
The terminal automatically detects if a command is a system command and executes it locally:
# These will execute on your system
ls -la
dir
ping google.com
python --version
# These will be sent to the serial device
Hello World
12345- All serial communication is logged during the session
- On exit, logs are encrypted using Fernet symmetric encryption
- A unique key file is generated or loaded
- Logs are saved with
.encextension
- Encrypted Log:
serial_log_YYYYMMDD_HHMMSS_SESSIONID.enc - Key File:
serial_log.key(or custom name with-k)
To decrypt a log file:
from cryptography.fernet import Fernet
with open('serial_log.key', 'rb') as f:
key = f.read()
cipher = Fernet(key)
with open('serial_log.enc', 'rb') as f:
encrypted_data = f.read()
decrypted_data = cipher.decrypt(encrypted_data)
print(decrypted_data.decode())- Automatically detects connection loss
- Attempts to reconnect for 15 seconds
- Shows countdown timer
- Press Enter during reconnection to exit
- History saved to
~/.serial_terminal_history - Use arrow keys to navigate previous commands
- Persists across sessions
Port Not Found
[!] Port COM3 hasn't been found.
- Check if the device is connected
- Verify the port name (COM3, /dev/ttyUSB0, etc.)
- Use interactive mode to see available ports
Permission Denied
- On Linux:
sudo usermod -a -G dialout $USER(reboot required) - On Windows: Run as Administrator
- On macOS: Check system permissions
Connection Lost
[^] Serial connection lost.
[?] Reconnection timeout 15 [PRESS ENTER TO EXIT] . . .
- The program will automatically try to reconnect
- Press Enter to exit the reconnection attempt
# Windows
mode
# Linux/macOS
ls /dev/tty*
dmesg | grep ttyFeel free to submit issues and enhancement requests!
Developed by @wrait8
Quick Start:
# Install dependencies
pip install pyserial colorama cryptography
# Run with interactive port selection
python WSerial.py
# Or specify port directly
python serial_terminal.py -p COM5 -b 115200 -o auto