大学生涯深澜校园网自动登陆脚本
Skyforever因为晚上要断电,所以写了个油猴脚本,自动登录深澜校园网
深澜校园网 - 自动登陆
原理:输入自己的账号、密码后,让浏览器填写自己设置的密码,模拟用户点击登录按钮
油猴脚本插件 - 下载地址
篡改猴 - Chrome 应用商店
篡改猴 - Microsoft Edge Addons
操作步骤


代码复制到此处, ctrl+s 保存即可,打开校园网登录地址,实现自动登录。

粘贴油猴脚本
自动登录脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
(function() { 'use strict'; var usr = "这里填账号"; var pwd = "这里填密码";
if (usr === "这里填账号" || pwd === "这里填密码") { alert("请去用户脚本管理器中,找到【深澜校园网-自动登录】脚本的代码,添加自己的账号与密码"); } else { document.querySelector("#username").value = usr; document.querySelector("#password").value = pwd; document.querySelector("#login-account").click(); } })();
|
自动切换账号登录(不建议这么做,会打破付费平衡)
程序原理:在默认账号无法登录时,自动对账号+1,并重新尝试登录,如果登录成功,就把账号存在本地数据库中,方便下次登录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
(function() { 'use strict';
var defaultUsr = "02702127512"; var pwd = "123456";
var storageKey = "autoLogin_currentAccount"; var currentUsr = localStorage.getItem(storageKey) || defaultUsr;
function updateCurrentUsr(newUsr) { localStorage.setItem(storageKey, newUsr); currentUsr = newUsr; console.log("更新当前账号为:" + newUsr); updateControlPanel(); }
function isVisible(element) { if (!element) return false; var style = window.getComputedStyle(element); return style.display !== "none" && style.visibility !== "hidden" && element.offsetWidth > 0 && element.offsetHeight > 0; }
function checkForConfirmButtonPostLogin() { var confirmBtn = document.querySelector(".btn-confirm"); if (confirmBtn && isVisible(confirmBtn)) { console.log("✅ 登录后检测到确认按钮,准备重新尝试登录..."); confirmBtn.click(); var newAccountNum = parseInt(currentUsr, 10) + 1; updateCurrentUsr(newAccountNum.toString()); setTimeout(function() { location.reload(); }, 1000); return true; } return false; }
function startPostLoginConfirmCheck() { var attempts = 0; var maxAttempts = 10; var intervalId = setInterval(function() { attempts++; if (checkForConfirmButtonPostLogin() || attempts >= maxAttempts) { clearInterval(intervalId); } }, 1000); }
function autoLogin() { var usernameField = document.querySelector("#username"); var passwordField = document.querySelector("#password"); var loginBtn = document.querySelector("#login-account");
if (usernameField && passwordField && loginBtn) { usernameField.value = currentUsr; passwordField.value = pwd; console.log("✅ 使用账号 " + currentUsr + " 已填充账号密码,尝试登录..."); setTimeout(function() { loginBtn.click(); startPostLoginConfirmCheck(); }, 500); } else { console.log("❌ 未找到登录表单,等待加载..."); setTimeout(autoLogin, 1000); } }
function handleInitialConfirmButton() { var confirmBtn = document.querySelector(".btn-confirm"); if (confirmBtn && isVisible(confirmBtn)) { console.log("✅ 检测到初始确认按钮,点击确认..."); confirmBtn.click(); var checkInterval = setInterval(function() { if (!isVisible(confirmBtn)) { clearInterval(checkInterval); console.log("🔄 初始确认按钮已消失,刷新页面..."); setTimeout(function() { location.reload(); }, 1000); } }, 500); } else { console.log("❌ 初始页面未检测到确认按钮,直接尝试登录..."); setTimeout(autoLogin, 1000); } }
function createControlPanel() { var panel = document.createElement("div"); panel.id = "autoLoginControlPanel"; panel.style.position = "fixed"; panel.style.top = "10px"; panel.style.right = "10px"; panel.style.background = "rgba(0, 0, 0, 0.7)"; panel.style.color = "#fff"; panel.style.padding = "8px"; panel.style.fontSize = "14px"; panel.style.zIndex = "9999"; panel.style.borderRadius = "4px";
var accountInfo = document.createElement("span"); accountInfo.id = "currentAccountDisplay"; accountInfo.style.marginRight = "10px"; panel.appendChild(accountInfo);
var resetBtn = document.createElement("button"); resetBtn.textContent = "重置账号"; resetBtn.style.fontSize = "12px"; resetBtn.style.cursor = "pointer"; resetBtn.addEventListener("click", function() { updateCurrentUsr(defaultUsr); alert("账号已重置为:" + defaultUsr); }); panel.appendChild(resetBtn);
document.body.appendChild(panel); updateControlPanel(); }
function updateControlPanel() { var accountInfo = document.getElementById("currentAccountDisplay"); if (accountInfo) { accountInfo.textContent = "当前账号:" + currentUsr; } }
function init() { console.log("🚀 脚本启动... 当前账号:" + currentUsr); createControlPanel(); setTimeout(handleInitialConfirmButton, 2000); }
init();
})();
|
附加内容-绕过代理
将学校网关的代理设置为直连,不走代理,这样系统就可以自动弹出登录界面登录
Windows系统设置在这个位置:

Clash设置在这个位置:

附加内容-修改浏览器标识
修改浏览器标识,可以加大概率碰到能用的账号
因为大部分用户都是用电脑登录的,而一个账号可以用于两个设备(手机和电脑);
所以可以修改浏览器标识,让浏览器 pretend 成手机登录,这样能试到更多账号
浏览器标识修改插件 - 下载地址
User-Agent Switcher and Manager - Chrome 应用商店
User-Agent Switcher and Manage - Edge 应用商店
未应用插件的浏览器标识是,识别为电脑:

按照下面图片的步骤操作即可模拟手机标识骗过:

应用后,识别为手机:
