您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
保护你的编程猫账号。
当前为
// ==UserScript== // @name 编程猫账号保护 // @namespace https://s-lightning.github.io/ // @version 0.0.9 // @description 保护你的编程猫账号。 // @author SLIGHTNING // @match http://*.codemao.cn/* // @match https://*.codemao.cn/* // @icon https://static.codemao.cn/coco/player/unstable/B1F3qc2Hj.image/svg+xml?hash=FlHXde3J3HLj1PtOWGgeN9fhcba3 // @grant none // @license AGPL-3.0 // @run-at document-start // ==/UserScript== /******/ (function() { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ /* 0 */, /* 1 */ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ start: function() { return /* binding */ start; } /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } var rejectURLArray = [/** 敏感信息 */ /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/tokens\/convert/, /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/privacy/, /** 修改用户名 */ /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/username/, /** 修改密码 */ /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/password/, /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/captcha\/password\/update/, /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/password\/phone/, /** 更换手机号 */ /https?:\/\/api\.codemao\.cn\/web\/users\/phone_number\/is_consistent/, /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/captcha\/phone\/change/, /https?:\/\/api\.codemao\.cn\/tiger\/v3\/web\/accounts\/phone\/change/]; function start() { var theWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; var ID = Math.floor(Math.random() * 90000000) + 10000000; var name = "\u7F16\u7A0B\u732B\u8D26\u53F7\u4FDD\u62A4$".concat(ID); var originalConfirm = theWindow.confirm; if (!(originalConfirm.toString() == "function confirm() { [native code] }" && originalConfirm.toString == Function.prototype.toString && Function.prototype.toString == Object.toString && function () {}.toString() == "function () {}")) { originalConfirm = function originalConfirm() { return true; }; } function confirm(message) { var startTime = Date.now(); var result = originalConfirm(message); var endTime = Date.now(); if (endTime - startTime <= 10) { return true; } return result; } theWindow.SLIGHTNING_ACCOUNT_PROTECT = true; theWindow.setInterval(function () { document.cookie = "access-token=0;path=/;domain=.codemao.cn;max-age=" + 30 * 24 * 60 * 60; }, 100); var interceptResponse = { code: 403, msg: "\u8BE5\u64CD\u4F5C\u5DF2\u88AB".concat(name, "\u62E6\u622A"), data: null, domain: [], error_code: 403, error_message: "\u8BE5\u64CD\u4F5C\u5DF2\u88AB".concat(name, "\u62E6\u622A"), log_uuid: "blocked-by-codemao-account-protect-script-$".concat(ID, "-").concat(Math.floor(Math.random() * 90000000) + 10000000) }; function onIntercept(url, go, reject, modify) { var _iterator = _createForOfIteratorHelper(rejectURLArray), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var rejectURL = _step.value; if (rejectURL.test(url)) { if (confirm("".concat(name, " \u68C0\u6D4B\u5230\u654F\u611F\u8BF7\u6C42\uFF1A").concat(url, "\uFF0C\u662F\u5426\u62E6\u622A\uFF1F"))) { reject(); } else if (confirm("".concat(name, " \u786E\u5B9A\u8981\u653E\u884C\u8BF7\u6C42 ").concat(url, " \u5417\uFF1F"))) { go(); } else { reject(); } return; } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } if (/https?:\/\/api\.codemao\.cn\/web\/users\/details/.test(url)) { modify(function (response) { if (response.status == 200) { var data = JSON.parse(response.text); Object.assign(data, { birthday: 0, phone_number: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), qq: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), real_name: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), username: "\u5DF2\u88AB".concat(name, "\u62E6\u622A") }); data = JSON.stringify(data); return { text: data }; } else { return {}; } }); } else if (/https?:\/\/api\.codemao\.cn\/api\/user\/info/.test(url)) { modify(function (response) { var data = JSON.parse(response.text); if (data.code == 200) { Object.assign(data.data, { age: 0, username: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), telephone: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), qq: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), email: "\u5DF2\u88AB".concat(name, "\u62E6\u622A"), real_name: "\u5DF2\u88AB".concat(name, "\u62E6\u622A") }); return { text: JSON.stringify(response) }; } else { return {}; } }); } else { go(); } } ; (function () { var originalFetch = theWindow.fetch; theWindow.fetch = function (url, options) { var _this = this; if (url instanceof Request) { url = url.url; } else if (url instanceof URL) { url = url.href; } return new Promise(function (resolve, reject) { onIntercept(url, function () { originalFetch.call(_this, url, options).then(resolve).catch(reject); }, function () { var _options$method; console.error(new Error("".concat(name, " \u5DF2\u62E6\u622A\u6765\u81EA fetch \u7684\u8BF7\u6C42\uFF1A").concat((_options$method = options === null || options === void 0 ? void 0 : options.method) !== null && _options$method !== void 0 ? _options$method : "GET", " ").concat(url))); resolve(new Response(JSON.stringify(interceptResponse), { status: 403, statusText: "403 Forbidden" })); }, function (callback) { var result = originalFetch.call(_this, url, options); result.then(function (response) { response.text().then(function (originalText) { var _callback = callback({ status: response.status, text: originalText }), status = _callback.status, text = _callback.text; var statusText = response.statusText; if (status == null) { status = response.status; } else { statusText = String(status); } if (text == null) { text = originalText; } resolve(new Response(text, _objectSpread(_objectSpread({}, response), {}, { status: status, statusText: statusText }))); }).catch(reject); }).catch(reject); }); }); }; })(); (function () { var openArgumentsSymbol = Symbol("CodemaoProtect$".concat(ID, ".openArguments")); var originalXMLHttpRequestSymbol = Symbol("CodemaoProtect$".concat(ID, ".originalXMLHttpRequest")); var originalXMLHttpRequest = theWindow.XMLHttpRequest; var originalOpen = theWindow.XMLHttpRequest.prototype.open; var originalSend = theWindow.XMLHttpRequest.prototype.send; // @ts-ignore theWindow.XMLHttpRequest = function XMLHttpRequest() { var _this2 = this; var XHR = new originalXMLHttpRequest(); var _loop = function _loop(key) { if (key == "open" || key == "send") { return 1; // continue } else if (typeof XHR[key] == "function") { // @ts-ignore _this2[key] = XHR[key].bind(XHR); } else { Object.defineProperty(_this2, key, { get: function get() { return XHR[key]; }, set: function set(value) { // @ts-ignore XHR[key] = value; }, configurable: true, enumerable: true }); } }; for (var key in XHR) { if (_loop(key)) continue; } this[originalXMLHttpRequestSymbol] = XHR; }; for (var key in originalXMLHttpRequest) { var _Object$getOwnPropert; Object.defineProperty(theWindow.XMLHttpRequest, key, (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(originalXMLHttpRequest, key)) !== null && _Object$getOwnPropert !== void 0 ? _Object$getOwnPropert : {}); } theWindow.XMLHttpRequest.prototype = originalXMLHttpRequest.prototype; theWindow.XMLHttpRequest.prototype.constructor = theWindow.XMLHttpRequest; theWindow.XMLHttpRequest.prototype.open = function open(method, url, async, username, password) { var _async, _this$originalXMLHttp; if (url instanceof URL) { url = url.href; } (_async = async) !== null && _async !== void 0 ? _async : async = true; this[openArgumentsSymbol] = { method: method, url: url, async: async, username: username, password: password }; originalOpen.call((_this$originalXMLHttp = this[originalXMLHttpRequestSymbol]) !== null && _this$originalXMLHttp !== void 0 ? _this$originalXMLHttp : this, method, url, async, username, password); }; theWindow.XMLHttpRequest.prototype.send = function send(body) { var _this$openArgumentsSy, _this$openArgumentsSy2, _this3 = this; onIntercept((_this$openArgumentsSy = (_this$openArgumentsSy2 = this[openArgumentsSymbol]) === null || _this$openArgumentsSy2 === void 0 ? void 0 : _this$openArgumentsSy2.url) !== null && _this$openArgumentsSy !== void 0 ? _this$openArgumentsSy : "", function () { var _this3$originalXMLHtt; originalSend.call((_this3$originalXMLHtt = _this3[originalXMLHttpRequestSymbol]) !== null && _this3$originalXMLHtt !== void 0 ? _this3$originalXMLHtt : _this3, body); }, function () { reject(_this3); }, function (callback) { modifyResponse(_this3, function (XHR) { var _callback2 = callback({ status: XHR.status, text: XHR.responseText }), status = _callback2.status, text = _callback2.text; var result = {}; if (status != null) { result.states = status; result.statesText = String(status); } if (text != null) { result.response = text; result.responseText = text; } return result; }); }); }; function forgeResponse(XHR, response) { for (var _key in response) { Object.defineProperty(XHR, _key, { value: response[_key] }); } function dispatchEvent(eventType) { XHR.dispatchEvent(new Event(eventType)); } dispatchEvent("loadstart"); Object.defineProperty(XHR, "readyState", { value: XHR.DONE }); dispatchEvent("readystatechange"); if (XHR.status == 200) { dispatchEvent("load"); } else { dispatchEvent("error"); } dispatchEvent("loadend"); } function modifyResponse(XHR, callback) { var originalXHR = new originalXMLHttpRequest(); originalXHR.withCredentials = XHR.withCredentials; var openArguments = XHR[openArgumentsSymbol]; if (openArguments != null) { originalOpen.call(originalXHR, openArguments.method, openArguments.url, openArguments.async, openArguments.username, openArguments.password); } originalXHR.onreadystatechange = function () { if (originalXHR.readyState == 4) { for (var _i = 0, _arr = ["status", "statusText", "responseType", "response", "responseText"]; _i < _arr.length; _i++) { var _key2 = _arr[_i]; Object.defineProperty(XHR, _key2, { value: originalXHR[_key2] }); } forgeResponse(XHR, callback(XHR)); } }; originalSend.call(originalXHR); } function reject(XHR) { var _XHR$openArgumentsSym, _XHR$openArgumentsSym2; console.error(new Error("".concat(name, " \u5DF2\u62E6\u622A\u6765\u81EA XMLHttpRequest \u7684\u8BF7\u6C42\uFF1A").concat((_XHR$openArgumentsSym = XHR[openArgumentsSymbol]) === null || _XHR$openArgumentsSym === void 0 ? void 0 : _XHR$openArgumentsSym.method, " ").concat((_XHR$openArgumentsSym2 = XHR[openArgumentsSymbol]) === null || _XHR$openArgumentsSym2 === void 0 ? void 0 : _XHR$openArgumentsSym2.url))); forgeResponse(XHR, { status: 403, statusText: "403 Forbidden", responseType: "json", response: JSON.stringify(interceptResponse), responseText: JSON.stringify(interceptResponse) }); } })(); } /***/ }), /* 2 */ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* binding */ _defineProperty; } /* harmony export */ }); /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); function _defineProperty(e, r, t) { return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } /***/ }), /* 3 */ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* binding */ toPropertyKey; } /* harmony export */ }); /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5); function toPropertyKey(t) { var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string"); return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + ""; } /***/ }), /* 4 */ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* binding */ _typeof; } /* harmony export */ }); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /***/ }), /* 5 */ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* binding */ toPrimitive; } /* harmony export */ }); /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); function toPrimitive(t, r) { if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /***/ }) /******/ ]); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ !function() { /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ }(); /******/ /************************************************************************/ var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _codemao_account_protect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); (0,_codemao_account_protect__WEBPACK_IMPORTED_MODULE_0__.start)(); /******/ })() ;
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址