An automated, lightweight Python service designed to maintain continuous internet connectivity through the CCIT / Sophos / Cyberoam captive portal (http://182.43.0.22:347/).
It periodically verifies external internet access, automatically re-authenticates when disconnected, and sends keep-alive pings to prevent idle session logouts—all running silently in the background.
- Silent Operation: Uses pure Python socket checks instead of system pings (
os.system), preventing command prompt windows from flashing every cycle. - Automatic Re-Authentication: Detects offline status and sends
mode=191POST requests directly tologin.xml. - Session Keep-Alive: Sends periodic
mode=192status pings to prevent gateway idle timeouts. - Zero Overhead: Consumes minimal CPU and memory resources.
- Logging: Writes timestamped logs to
log.txtfor easy troubleshooting.
- OS: Windows 10 / 11
- Python: Python 3.8 or higher
- Dependencies:
requestslibrary
Install requests if you haven't already:
python -m pip install requests- Place
auto_login.pyin your target folder (e.g.,C:\AutoLogin\). - Open
auto_login.pyand set your gateway URL, username, and password.
To run the script automatically in the background when you log into Windows without command prompt popups:
Open Command Prompt and run:
where pythonw.exe- Press
Win + R, typetaskschd.msc, and pressEnter. - In the right panel, click Create Task... (do not select Create Basic Task).
General Tab:
- Name: CCIT Auto Login
- Select: Run only when user is logged on
- Check: Run with highest privileges
Triggers Tab:
- Click New... ➜ Begin the task: At log on ➜ Click OK.
Actions Tab:
- Click New... ➜ Action: Start a program
- Program/script: Paste the full path to
pythonw.exe - Add arguments:
auto_login.py - Start in:
C:\AutoLogin\ - Click OK.
- Click OK to save the task.
Start Service: Right-click CCIT Auto Login in Task Scheduler and select Run.
Verify Execution: Open Command Prompt and run:
tasklist | findstr pythonLook for pythonw.exe in the output.
Check Activity: Inspect C:\AutoLogin\log.txt for live connection logs.
Stop Service: Run the following in Command Prompt:
taskkill /F /IM pythonw.exe- Task not running? Verify the
pythonw.exepath is correct andauto_login.pyis in the specified directory. - Check logs: Review
log.txtfor detailed error messages and connection status. - Python not found? Ensure Python is installed and added to your system PATH.
This project is provided as-is for educational and personal use.