Skip to content

mapkkkk/single_login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

校园网登录认证


适用范围

  • 理论上适用于大部分锐捷认证的网络

使用预构建的二进制文件

现在提供amd64WindowsLinux预构建文件、以及aarch64Linux预构建文件,请在release里下载

运行

./single_login ./account.cfg
# account.cfg是配置文件名

配置文件格式应该如下

your_account_id	# 第一行为账号
your_password	# 第二行为密码

编译

安装 Go 环境

# 访问 https://golang.org/dl/ 下载并安装 Go
# 或使用包管理器安装
# Ubuntu/Debian:
sudo apt-get install golang-go upx

编译

使用提供的编译脚本:

# 编译当前平台
./compile.sh

# 编译指定平台(例如 Linux amd64)
./compile.sh linux/amd64

# 编译所有支持的平台
./compile.sh all

# 查看帮助
./compile.sh --help

编译后的二进制文件将输出到 bin/ 目录。

注意: 编译脚本已自动应用体积优化选项(去除符号表、调试信息等)。如果需要在路由器等资源受限设备上运行,建议使用 UPX 进一步压缩(可减小 50-70% 体积)。


Linux下设置Systemctl设置自启动

sudo nano /lib/systemd/system/single_login.service
# 然后粘贴下面的内容并保存
# [Service]的ExecStart里的user_name请改为自己的用户名, account.cfg是配置文件路径
[Unit]
Description=single_login
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
Restart=always
RestartSec=86400
ExecStartPre=/bin/sleep 5
ExecStart=/home/user_name/single_login/bin/single_login /home/user_name/single_login/account.cfg

[Install]
WantedBy=multi-user.target
# 设置自启动
sudo systemctl enable single_login
# 启动
sudo systemctl start single_login
# 查看运行状态(请在启动后过一会再查看)
sudo systemctl status single_login
# 停止运行
sudo systemctl stop single_login
# 重启
sudo systemctl restart single_login
# 关闭自启动
sudo systemctl disable single_login

Windows下设置自启动

single_login的文件夹里新建single_login.bat,替换里面的路径,将账号密码写入配置文件

@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
REM
cd C:\single_login # 替换成single_login的文件夹路径
single_login.exe account.cfg # account.cfg是配置文件
exit

创建single_login.bat的快捷方式,放入下面的路径的文件夹里

C:\Users\rhett\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

About

校园网自动登录

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors