Say Goodbye to Campus Network Disconnection: Python Automatic Login to Ruijie Campus Network
Posted on: 2024-01-12
I don't know if it's because I'm used to using a proxy for a long time, but I encounter the campus network dropping out dozens of times almost every day during high-frequency work. Each time, I need to open the browser - open the login page - login - refresh to restore the network, and I don't know when it will drop out again. Tired of the campus network dropping out from time to time, I decided to write a Python program to automatically login. The project is open source on Github: Gloridust/RuijieWIFI-AutoLogin The following content directly quotes the README document of the project's Github:
Automatic login to the Ruijie campus WiFi authentication system of Yibin University to prevent accidental disconnection. In theory, it supports all Ruijie systems.
Start
- Download or clone the code to local
git clone https://github.com/Gloridust/RuijieWIFI-AutoLogin.git
- Rename
example.config.py
toconfig.py
, and you can start filling in the configuration file.
Configuration
- Open the browser and visit the login interface of the school campus network. Press
F12
to open the developer tools. Select theNetwork
tab. - Refresh the page, enter the account password, select the operator, and then login. Note: You must re-enter the password, do not use the remembered password content. In the developer tools, you can try to find some files that may contain the data we need. The following pictures are for your reference, and you may find these configuration information in these locations:
- Open the
config.py
configuration file in the project file, and follow the prompts to fill in the content according to the information in the browser developer tools. If you cannot find the encrypted password or thepassword
value isnull
, simply fill in the plaintext password and change'passwordEncrypt'
to'false'
, and ensure that all other content is filled in completely. The following is my configuration information, for reference only: Correction: The data ofservice
may be wrong. For example, forChina Telecom
, please fill indianxin
.
Run
If everything goes well, you can run it now:
python3./login.py
Try surfing the internet! If you still see the password input interface when opening the login page again, you might as well refresh it.
Advanced Operations
Startup Autostart
Take automation to the extreme, experience the pleasure of a home broadband, and login seamlessly.
macOS
- Give permissions in the main program directory of
login.py
:
chmod +x login.py
- Rename
example.net.innovisle.RuijieWIFI-AutoLogin.plist
under the project directory tonet.innovisle.RuijieWIFI-AutoLogin.plist
- Edit
net.innovisle.RuijieWIFI-AutoLogin.plist
and fill in the absolute path oflogin.py
. Taking mine as an example: - Place the created
net.innovisle.RuijieWIFI-AutoLogin.plist
file in the~/Library/LaunchAgents
directory. - Load the plist file: Try any of the following commands:
launchctl load ~/Library/LaunchAgents/net.innovisle.RuijieWIFI-AutoLogin.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/net.innovisle.RuijieWIFI-AutoLogin.plist
If there is no error, you will receive a notification of the login item and see it in the login item list:
Windows
Put the script or its shortcut into the "Startup" folder of Windows. Press Windows + R to open the "Run" dialog box, enter shell:startup, and then press Enter. This will open the "Startup" folder. Put your Python script or its shortcut into this folder. If it is a shortcut, make sure it points to the correct script path and Python interpreter.
Automatic Login Frequency
You can adjust the login frequency in the last line of login.py
, and the default is to login once every 1-3 seconds. You can adjust it appropriately. For example, if you want to try to login every 5-10 seconds, you can modify it to:
time.sleep(random.randint(5, 10))
LICENSE
MIT