index.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!DOCTYPE html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <title>schtonn</title>
  5. <script type="text/javascript" src="/js/jquery.min.js"></script>
  6. <link rel="stylesheet" href="/css/bootstrap.min.css">
  7. <script type="text/javascript" src="/js/bootstrap.min.js"></script>
  8. <script type="text/javascript" src="/js/md5.js"></script>
  9. <link rel="preconnect" href="https://fonts.gstatic.com">
  10. <link href="https://fonts.loli.net/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
  11. &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  12. <link rel="stylesheet" href="/css/style.css">
  13. <script>
  14. var status, oid, user, pwd
  15. function getCookie(name) {
  16. let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
  17. if (arr != null) return unescape(arr[2]);
  18. return null;
  19. }
  20. function delCookie(name, path = 'u') {
  21. var exp = new Date();
  22. exp.setTime(exp.getTime() - 1);
  23. var cval = getCookie(name);
  24. if (cval != null)
  25. document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ((path == 'u') ? '' : ';path=' + path)
  26. }
  27. function get(e) {
  28. return e.replace('dd.sdsz.com.cn', '43.143.233.184:81').replace('http:', 'https:').replace('.184/', '.184:81/')
  29. }
  30. function setStatus(e) {
  31. status = e
  32. if (e == 1) {
  33. $('#loginSt').text('登录成功')
  34. $('#login').hide(200)
  35. $('#loginSt').addClass('label-success')
  36. $('#loginSt').removeClass('label-danger')
  37. $('.reqLogin').removeClass('disable')
  38. // $('#login').addClass('disable')
  39. } else if (e == 2) {
  40. $('#loginSt').text('登录失败')
  41. $('#loginSt').removeClass('label-success')
  42. $('#loginSt').addClass('label-danger')
  43. $('.reqLogin').addClass('disable')
  44. } else {
  45. $('#login').show()
  46. $('#loginSt').text('未登录')
  47. $('#loginSt').removeClass('label-success')
  48. $('#loginSt').removeClass('label-danger')
  49. }
  50. }
  51. function delCookies() {
  52. delCookie('CASTGC', '/')
  53. delCookie('JSESSIONID', '/')
  54. delCookie('JSESSIONID', '/sso')
  55. delCookie('JSESSIONID', '/sso/')
  56. delCookie('JSESSIONID', '/bxn-portal')
  57. }
  58. function postLogin() {
  59. if (status != 1) return;
  60. $('#changePwd').val($('#loginPwd').val())
  61. fetch('https://43.143.233.184:81/bxn-portal/portal/api/proxy?username=true&userId=true&needvalidate=true&t=http%3A%2F%2F202.94.10.118%2Fbxn-library%2Fapi%2Flibrary%2FgetLatestBorrowBook%3Fcategory%3D1&resourceId=103519&cache=nocache&systime=0', {
  62. method: 'GET',
  63. credentials: 'include'
  64. }).then(e => e.json()).then(e => {
  65. $('#user').text(e.requestParams[0].ownerName)
  66. oid = e.requestParams[0].ownerId
  67. console.log(oid)
  68. })
  69. }
  70. function login() {
  71. if (status == 1) return;
  72. delCookies()
  73. console.log(document.cookie)
  74. user = $('#loginId').val(), pwd = $('#loginPwd').val()
  75. fetch("https://43.143.233.184:81/sso/login", {
  76. "headers": {
  77. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  78. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
  79. },
  80. "method": "GET",
  81. "mode": "cors",
  82. "credentials": 'include'
  83. }).then(() => {
  84. return fetch('https://43.143.233.184/andlogin', {
  85. method: 'POST',
  86. headers: { 'Content-type': 'application/json' },
  87. body: JSON.stringify({
  88. user: user,
  89. pwd: pwd,
  90. cook: getCookie('JSESSIONID')
  91. }),
  92. credentials: 'include',
  93. })
  94. }).then(e => e.text()).then(e => {
  95. if (e == 'success') setStatus(1)
  96. else setStatus(2)
  97. }).then(postLogin)
  98. }
  99. function next(e) {//异步递归嘿嘿嘿,再多 302 也不怕
  100. if (e.length < 5000) {
  101. console.log(e)
  102. return fetch(get(e), {
  103. method: 'GET',
  104. credentials: 'include'
  105. }).then(e => e.text()).then(next)
  106. }
  107. else return new Promise((resolve, reject) => { })
  108. }
  109. function getCk(name, url) {
  110. if (status != 1) return
  111. fetch('https://43.143.233.184:81/' + url, {
  112. method: 'GET',
  113. credentials: 'include'
  114. }).then(e => e.text()).then(next)
  115. $('#' + name).addClass('btn-success')
  116. }
  117. function change() {
  118. if (status != 1 || $('#loginPwd').val() == $('#changePwd').val()) return
  119. var fd = new URLSearchParams()
  120. fd.append('rating', '4')
  121. fd.append('ratingWord', '极佳')
  122. fd.append('oldPassword', $('#loginPwd').val())
  123. fd.append('newPassword', $('#changePwd').val())
  124. fd.append('reNewPassword', $('#changePwd').val())
  125. fetch('https://43.143.233.184:81/bxn-core-uic/uic-public/personal/management/password/save', {
  126. "headers": {
  127. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  128. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
  129. },
  130. method: 'POST',
  131. body: fd,
  132. credentials: 'include',
  133. }).then(e => e.text()).then(e => {
  134. console.log(e)
  135. })
  136. }
  137. </script>
  138. <style>
  139. .disable {
  140. pointer-events: none;
  141. filter: contrast(90%) blur(2px)
  142. }
  143. .disable>btn {
  144. cursor: not-allowed;
  145. filter: alpha(opacity=65);
  146. -webkit-box-shadow: none;
  147. box-shadow: none;
  148. opacity: .65;
  149. }
  150. </style>
  151. </head>
  152. <body>
  153. <div class="page-header">
  154. <h2>数字校园</h2>
  155. </div>
  156. <div class="page-header">
  157. <h3>账号</h3>
  158. <div id="loginSt" class="label label-default">未登录</div>
  159. <div id="user" class="label label-default">-</div>
  160. <button class="btn btn-default btn-xs reqLogin disable" onclick="$('#change').toggle(200)">修改密码</button>
  161. <button class="btn btn-default btn-xs reqLogin disable" onclick="$('#cookie').toggle(200)">获取 cookie</button>
  162. <div id="cookie" class="btn-group" style="display: none;">
  163. <button id="bxn-portal" class="btn btn-default btn-xs" onclick="getCk('bxn-portal','bxn-portal/portal/osforstudent/index')">bxn-portal</button>
  164. <button id="bxn-core-uic" class="btn btn-default btn-xs" onclick="getCk('bxn-core-uic','bxn-core-uic/uic/index')">bxn-core-uic</button>
  165. <button id="bxn-library" class="btn btn-default btn-xs" onclick="getCk('bxn-library','bxn-library/library/jumpExamreport?jumpUrl=')">bxn-library</button>
  166. </div>
  167. </div>
  168. <div class="col-md-6">
  169. <div id="login">
  170. <div class="input-group">
  171. <span class="input-group-addon">账号</span>
  172. <input id="loginId" type="id" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="20222222" value="20222446">
  173. </div>
  174. <br>
  175. <div class="input-group">
  176. <span class="input-group-addon">密码</span>
  177. <input id="loginPwd" type="password" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="password" value="thisis1APPLE">
  178. <span class="input-group-btn"><button class="btn btn-default" type="button" onclick="login()">登录</button></span>
  179. </div>
  180. </div>
  181. <div id="change" style="display: none;">
  182. <div class="input-group">
  183. <span class="input-group-addon">新密码</span>
  184. <input id="changePwd" type="password" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="password" onmouseenter="this.type='id'" onmouseleave="this.type='password'">
  185. <span class="input-group-btn"><button class="btn btn-default" type="button" onclick="change()">修改</button></span>
  186. </div>
  187. </div>
  188. </div>
  189. <div class="page-header">
  190. <h3>查分</h3>
  191. <a class="btn btn-default btn-xs reqLogin disable" href="">原版</a>
  192. <a class="btn btn-default btn-xs reqLogin disable" href="/score">新版</a>
  193. </div>
  194. </body>