- Python 100%
| openvpn | ||
| systemd | ||
| .gitignore | ||
| config.example.env | ||
| README.md | ||
| requirements.txt | ||
| windscribe_port_sync.py | ||
Windscribe Port Forward Sync
A lightweight, standalone Python utility that automates Windscribe ephemeral port forwarding and syncs the assigned listening port to qbittorrent-nox on Debian.
Background & Architecture
Windscribe Pro provides ephemeral port forwarding, but allocations expire every 7 days. Existing community projects wrap heavy Docker containers with full headless Chromium instances just to handle web logins.
This project uses a clean, zero-container approach:
- VPN Connection (OpenVPN): Uses Debian's native
openvpnsystemd service (openvpn-client@windscribe). It creates a dedicatedtun0interface, runs without proprietary daemons, and lets you bind qBittorrent directly totun0for leak protection. - Port Synchronization (Python): Communicates directly with Windscribe's native API endpoints (
api.windscribe.com) using session credentials or account login, requests matching port forwards, and updatesqbittorrent-noxvia its local Web API. - Automation: Runs as a standard cron job or a lightweight systemd timer every 6 days, well ahead of the 7-day expiration.
Requirements
- Python 3.9+
requestspyotp(optional, only required if using 2FA on username/password login)
Install dependencies on Debian:
sudo apt update
sudo apt install python3-requests python3-pyotp
Setup & Configuration
-
Copy
config.example.envto a secure location:sudo mkdir -p /etc/windscribe-portforward sudo cp config.example.env /etc/windscribe-portforward/config.env sudo chmod 600 /etc/windscribe-portforward/config.env -
Edit
/etc/windscribe-portforward/config.envwith your preferred authentication method:- Option A (authHash): If
windscribe-cliis logged in on the system, the script automatically readsauthHashfrom~/.config/Windscribe/Windscribe2.conf. You can also paste it explicitly asWINDSCRIBE_AUTH_HASH=.... - Option B (Credentials): Set
WINDSCRIBE_USERNAMEandWINDSCRIBE_PASSWORD(andWINDSCRIBE_TOTPif 2FA is active). The script will perform the two-step login and cache the session token locally.
- Option A (authHash): If
-
Configure qBittorrent Web UI connection details:
QBIT_HOST=127.0.0.1 QBIT_PORT=8080 QBIT_USERNAME=admin QBIT_PASSWORD=your_password
CLI Usage
Inspect the active ephemeral port on Windscribe:
python3 windscribe_port_sync.py -c /etc/windscribe-portforward/config.env --status
Run in dry-run mode:
python3 windscribe_port_sync.py -c /etc/windscribe-portforward/config.env --dry-run
Sync or renew port and update qBittorrent:
python3 windscribe_port_sync.py -c /etc/windscribe-portforward/config.env --force-renew
Automation
Option 1: Systemd Timer (Recommended)
-
Copy the script to
/usr/local/bin:sudo cp windscribe_port_sync.py /usr/local/bin/windscribe_port_sync.py sudo chmod +x /usr/local/bin/windscribe_port_sync.py -
Copy systemd units:
sudo cp systemd/windscribe-port-sync.service /etc/systemd/system/ sudo cp systemd/windscribe-port-sync.timer /etc/systemd/system/ -
Enable and start the timer:
sudo systemctl daemon-reload sudo systemctl enable --now windscribe-port-sync.timer
Check timer status:
systemctl list-timers | grep windscribe
Option 2: Cron Job
If you prefer standard cron, add an entry to /etc/cron.d/windscribe-portforward or root's crontab (crontab -e):
# Run every 6 days at 04:00 AM
0 4 */6 * * /usr/bin/python3 /usr/local/bin/windscribe_port_sync.py -c /etc/windscribe-portforward/config.env --force-renew >> /var/log/windscribe-port-sync.log 2>&1
Tunnel Setup & Leak Protection
See openvpn/README.md for step-by-step instructions on setting up OpenVPN with systemd on Debian and binding qBittorrent to tun0.