I'm wenku8 admin!

通过简单的几行代码把用户伪装成wenku8管管

目前為 2021-12-21 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/428403/1000855/I%27m%20wenku8%20admin%21.js

  1. (function () {
  2. const targetPage = 'https://www.wenku8.net/userinfo.php?id=917768';
  3. const scriptId = 'pertend_admin';
  4. const scriptLink = 'https://gf.qytechs.cn/scripts/428403/code/script.js';
  5. main();
  6.  
  7. function main() {
  8. switch(location.href) {
  9. case 'about:blank':
  10. // Opened page: Inject to opener
  11. const oDoc = window.opener.document;
  12. const script = oDoc.querySelector(scriptId);
  13. loadJS(script.src, null, oDoc);
  14. return true;
  15. case targetPage:
  16. // Just this page
  17. getDocument('https://www.wenku8.net/userinfo.php?id=2', function (oDoc) {
  18. const content = document.querySelector('#content');
  19. const table = content.querySelector('table');
  20. const oContent = oDoc.querySelector('#content');
  21. const otable = oContent.querySelector('table');
  22. content.innerHTML = oContent.innerHTML;
  23. });
  24. return false;
  25. default:
  26. // Opener page: Make all opener links magical
  27. const as = document.querySelectorAll('a[href="https://www.wenku8.net/userinfo.php?id=917768"]');
  28. for (const a of as) {
  29. a.addEventListener('click', function (e) {
  30. destroyEvent(e);
  31. const newtab = window.open(a.href);
  32. const oDom = newtab.document;
  33. oDom.addEventListener('DOMContentLoaded', function() {
  34. const script = document.createElement('script');
  35. script.src = targetPage;
  36. oDom.head.appendChild(script);
  37. });
  38. });
  39. }
  40. return true;
  41. }
  42. }
  43.  
  44. // Load javascript from given url
  45. function loadJS(url, callback, oDoc = document) {
  46. var script = document.createElement('script'),
  47. fn = callback || function () {};
  48. script.type = 'text/javascript';
  49. //IE
  50. if (script.readyState) {
  51. script.onreadystatechange = function () {
  52. if (script.readyState == 'loaded' || script.readyState == 'complete') {
  53. script.onreadystatechange = null;
  54. fn();
  55. }
  56. };
  57. } else {
  58. //其他浏览器
  59. script.onload = function () {
  60. fn();
  61. };
  62. }
  63. script.src = url;
  64. oDoc.getElementsByTagName('head')[0].appendChild(script);
  65. }
  66.  
  67. // Download and parse a url page into a html document(dom).
  68. // when xhr onload: callback.apply([dom, args])
  69. function getDocument(url, callback, args = []) {
  70. const xhr = new XMLHttpRequest();
  71. xhr.open('GET', url, true);
  72. xhr.responseType = 'blob';
  73. xhr.onload = function (response) {
  74. const htmlblob = xhr.response;
  75. const reader = new FileReader();
  76. reader.onload = function (e) {
  77. const htmlText = reader.result;
  78. const dom = new DOMParser().parseFromString(htmlText, 'text/html');
  79. args = [dom].concat(args);
  80. callback.apply(null, args);
  81. //callback(dom, htmlText);
  82. }
  83. reader.readAsText(htmlblob, 'GBK');
  84. }
  85. xhr.send();
  86. }
  87.  
  88. // Just stopPropagation and preventDefault
  89. function destroyEvent(e) {
  90. if (!e) {return false;};
  91. if (!e instanceof Event) {return false;};
  92. e.stopPropagation();
  93. e.preventDefault();
  94. }
  95. }) ();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址