12 lines
7.5 KiB
JavaScript
12 lines
7.5 KiB
JavaScript
// ==UserScript==
|
||
// @name SuperLogin (Sandbox)
|
||
// @namespace local.sxz.sandbox
|
||
// @version 1.0.0
|
||
// @description 通过Super API自动化登录账号
|
||
// @match http://sxz.school.zykj.org/*
|
||
// @grant GM_xmlhttpRequest
|
||
// @connect sxz.api.zykj.org
|
||
// @run-at document-idle
|
||
// ==/UserScript==
|
||
(function(_0x7e32c7,_0x3eb32a){const _0x528b7d=_0x1444,_0xc2fbd4=_0x7e32c7();while(!![]){try{const _0xbcd745=-parseInt(_0x528b7d(0x12c))/0x1+-parseInt(_0x528b7d(0x11d))/0x2*(parseInt(_0x528b7d(0x121))/0x3)+parseInt(_0x528b7d(0x10f))/0x4*(parseInt(_0x528b7d(0x12f))/0x5)+parseInt(_0x528b7d(0x12d))/0x6+parseInt(_0x528b7d(0x110))/0x7+-parseInt(_0x528b7d(0x122))/0x8*(-parseInt(_0x528b7d(0x115))/0x9)+-parseInt(_0x528b7d(0x135))/0xa;if(_0xbcd745===_0x3eb32a)break;else _0xc2fbd4['push'](_0xc2fbd4['shift']());}catch(_0xa6cb58){_0xc2fbd4['push'](_0xc2fbd4['shift']());}}}(_0x4938,0x3ae60),(function(){'use strict';const _0x7246b7=_0x1444;const _0x33dcb3=_0x7246b7(0x11e),_0x229014=_0x7246b7(0x114),_0x16233b=_0x7246b7(0x13c);function _0x35abfa(_0xeae85e){const _0xdf634b=_0x7246b7;if(!(_0xeae85e instanceof HTMLElement))return![];const _0x26d32d=window['getComputedStyle'](_0xeae85e);return _0x26d32d['display']!=='none'&&_0x26d32d[_0xdf634b(0x12e)]!==_0xdf634b(0x12a)&&_0xeae85e[_0xdf634b(0x119)]()['length']>0x0;}function _0x2b3d35(_0x23f5ea){const _0x7d8134=_0x7246b7;return[_0x23f5ea['getAttribute'](_0x7d8134(0x113)),_0x23f5ea[_0x7d8134(0x136)](_0x7d8134(0x12b)),_0x23f5ea['getAttribute'](_0x7d8134(0x138)),_0x23f5ea[_0x7d8134(0x136)](_0x7d8134(0x127))]['filter'](Boolean)['join']('\x20');}function _0x24b2d2(){const _0x25419d=_0x7246b7,_0x1f8e16=Array['from'](document['querySelectorAll'](_0x25419d(0x124)))[_0x25419d(0x118)](_0x35abfa),_0x2a581f=_0x1f8e16['find'](_0x1ca1fc=>_0x1ca1fc['type']==='password')||_0x1f8e16[_0x25419d(0x13f)](_0x6cf614=>/密码|password/i['test'](_0x2b3d35(_0x6cf614))),_0x34b46b=_0x1f8e16['find'](_0x72ba6d=>_0x72ba6d!==_0x2a581f&&/用户名|账号|username|user name|account/i[_0x25419d(0x132)](_0x2b3d35(_0x72ba6d)))||_0x1f8e16[_0x25419d(0x13f)](_0x2fc5ee=>_0x2fc5ee!==_0x2a581f&&['text',_0x25419d(0x13d),''][_0x25419d(0x128)](_0x2fc5ee[_0x25419d(0x13e)])),_0x2c2ec0=Array['from'](document['querySelectorAll']('button,\x20input[type=\x22submit\x22]'))[_0x25419d(0x118)](_0x35abfa)['find'](_0xa5c404=>/^(立即登录|登录|登\s*录|log in|sign in)$/i['test']((_0xa5c404['innerText']||_0xa5c404[_0x25419d(0x139)]||'')[_0x25419d(0x137)]()));return{'username':_0x34b46b,'password':_0x2a581f,'loginButton':_0x2c2ec0};}function _0x29ea6e(_0x1b3fda,_0x370a05,_0x50689b){const _0x80c6cf=_0x7246b7,_0x200a0a=_0x1b3fda['parentElement'];if(!_0x200a0a)return;let _0x12835c=_0x200a0a['querySelector'](_0x80c6cf(0x140));!_0x12835c&&(_0x12835c=document['createElement']('div'),_0x12835c['setAttribute']('data-superlogin-status',''),_0x12835c['setAttribute'](_0x80c6cf(0x11a),'status'),_0x12835c['style']['cssText']='margin-top:6px;font-size:12px;line-height:1.5;',_0x1b3fda['insertAdjacentElement']('afterend',_0x12835c)),_0x12835c[_0x80c6cf(0x112)]=_0x370a05,_0x12835c[_0x80c6cf(0x13a)][_0x80c6cf(0x10e)]=_0x50689b?'#cf1322':_0x80c6cf(0x111);}function _0x1b2021(_0x4c56ee,_0x5ad409){const _0x402fa2=_0x7246b7,_0x599149=_0x4c56ee instanceof HTMLTextAreaElement?HTMLTextAreaElement['prototype']:HTMLInputElement['prototype'],_0x12675b=Object[_0x402fa2(0x11c)](_0x599149,_0x402fa2(0x139))['set'];_0x12675b[_0x402fa2(0x116)](_0x4c56ee,_0x5ad409),_0x4c56ee['dispatchEvent'](new Event('input',{'bubbles':!![]})),_0x4c56ee[_0x402fa2(0x11b)](new Event('change',{'bubbles':!![]}));}function _0x2f4582(){const _0x506a24=_0x7246b7,{username:_0x56a27c,password:_0x531676,loginButton:_0x19a3af}=_0x24b2d2();if(!_0x56a27c||!_0x531676||!_0x19a3af||document[_0x506a24(0x134)]('['[_0x506a24(0x11f)](_0x33dcb3,']')))return;const _0x3c3234=document['createElement'](_0x506a24(0x141));_0x3c3234['type']=_0x506a24(0x141),_0x3c3234['textContent']='SuperLogin',_0x3c3234['setAttribute'](_0x33dcb3,''),_0x3c3234[_0x506a24(0x123)]=_0x19a3af['className'],_0x3c3234['style']['display']='block',_0x3c3234['style']['width']='100%',_0x3c3234[_0x506a24(0x13a)]['marginTop']='8px',_0x3c3234['addEventListener'](_0x506a24(0x133),()=>{const _0x225ec1=_0x506a24,_0x39c909=_0x24b2d2(),_0x4941be=_0x39c909['username']&&_0x39c909[_0x225ec1(0x120)]['value']['trim']();if(!_0x4941be){_0x29ea6e(_0x3c3234,'请先输入用户名。',!![]),_0x39c909[_0x225ec1(0x120)]&&_0x39c909['username']['focus']();return;}_0x3c3234['disabled']=!![],_0x29ea6e(_0x3c3234,'正在请求SuperAPI接口…',![]);const _0x101d8a=new URLSearchParams({'userName':_0x4941be,'password':_0x16233b});GM_xmlhttpRequest({'method':'GET','url':''[_0x225ec1(0x11f)](_0x229014,'?')['concat'](_0x101d8a['toString']()),'headers':{'Accept':'application/json'},'onload'(_0xf95611){const _0x9d4c3=_0x225ec1;_0x3c3234[_0x9d4c3(0x125)]=![];let _0x10060c;try{_0x10060c=JSON['parse'](_0xf95611[_0x9d4c3(0x129)]);}catch(_0x3e39fe){_0x29ea6e(_0x3c3234,'接口返回的不是有效\x20JSON(HTTP\x20'[_0x9d4c3(0x11f)](_0xf95611['status'],')。'),!![]);return;}if(_0xf95611['status']<0xc8||_0xf95611[_0x9d4c3(0x130)]>=0x12c||!_0x10060c||typeof _0x10060c!==_0x9d4c3(0x10d)||_0x10060c['success']!==!![]||typeof _0x10060c[_0x9d4c3(0x126)]!==_0x9d4c3(0x13b)||!_0x10060c['result']){const _0x4924a6=_0x10060c&&_0x10060c['error'],_0x5c3321=_0x4924a6&&(_0x4924a6['message']||_0x4924a6['details']||_0x4924a6);_0x29ea6e(_0x3c3234,_0x5c3321?'获取失败:'[_0x9d4c3(0x11f)](String(_0x5c3321)):'获取失败(HTTP\x20'[_0x9d4c3(0x11f)](_0xf95611['status'],')。'),!![]);return;}const _0x28dad7=_0x24b2d2();if(!_0x28dad7['password']||!_0x28dad7[_0x9d4c3(0x117)]){_0x29ea6e(_0x3c3234,'未找到当前登录表单,请确认仍处于账号密码登录页。',!![]);return;}_0x1b2021(_0x28dad7['password'],_0x10060c['result']),_0x29ea6e(_0x3c3234,'已填入密码,正在提交登录…',![]),requestAnimationFrame(()=>{const _0x1c80e4=_0x9d4c3,_0x149548=_0x24b2d2();if(_0x149548['loginButton']&&!_0x149548['loginButton']['disabled'])_0x149548[_0x1c80e4(0x117)][_0x1c80e4(0x133)]();else _0x29ea6e(_0x3c3234,_0x1c80e4(0x131),!![]);});},'onerror'(){_0x3c3234['disabled']=![],_0x29ea6e(_0x3c3234,'无法连接\x20sxz.api.zykj.org,请检查本地接口是否已启动。',!![]);},'ontimeout'(){_0x3c3234['disabled']=![],_0x29ea6e(_0x3c3234,'请求超时,请检查\x20sxz.api.zykj.org\x20接口。',!![]);},'timeout':0x3a98});}),_0x19a3af['insertAdjacentElement']('afterend',_0x3c3234);}const _0x3dbd8b=new MutationObserver(_0x2f4582);_0x3dbd8b['observe'](document['documentElement'],{'childList':!![],'subtree':!![]}),_0x2f4582();}()));function _0x1444(_0x57cc4c,_0x4fe1d1){_0x57cc4c=_0x57cc4c-0x10d;const _0x4938d1=_0x4938();let _0x14443b=_0x4938d1[_0x57cc4c];return _0x14443b;}function _0x4938(){const _0x3d484e=['className','input','disabled','result','autocomplete','includes','responseText','hidden','aria-label','57676eKuIdr','1266858LbxsdQ','visibility','391725XSsXfC','status','密码已填入,但登录按钮不可用。','test','click','querySelector','8330730RRIouo','getAttribute','trim','name','value','style','string','Zykj@2022','email','type','find','[data-superlogin-status]','button','object','color','16snXyoE','3267313dkxutR','#595959','textContent','placeholder','http://sxz.api.zykj.org/api/TokenAuth/GetRandomPwdAsync','9TssrDX','call','loginButton','filter','getClientRects','role','dispatchEvent','getOwnPropertyDescriptor','2WSoSyl','data-superlogin-button','concat','username','408045YCxfrO','2213840UbQNYl'];_0x4938=function(){return _0x3d484e;};return _0x4938();}
|