├── XGP.txt ├── accounts.txt ├── alipayCookies.json ├── .gitattributes ├── skin.png ├── Xbox_icon.ico ├── requirements.txt ├── config.ini ├── README.md ├── .github └── workflows │ └── python-app.yml ├── .gitignore ├── LICENSE ├── AutoXGP.py └── alipayEncrypt.js /XGP.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /alipayCookies.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=python -------------------------------------------------------------------------------- /skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AneryCoft/AutoXGP/HEAD/skin.png -------------------------------------------------------------------------------- /Xbox_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AneryCoft/AutoXGP/HEAD/Xbox_icon.ico -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AneryCoft/AutoXGP/HEAD/requirements.txt -------------------------------------------------------------------------------- /config.ini: -------------------------------------------------------------------------------- 1 | [Account] 2 | splitSymbol=---- 3 | 4 | [Proxy] 5 | enableProxy=false 6 | host=127.0.0.1 7 | port=0 8 | 9 | [Alipay] 10 | payPassword= 11 | saveCookie=true 12 | 13 | [Thread] 14 | thread=1 15 | 16 | [Prefix] 17 | xbox_prefix=AneryCoft 18 | minecraft_prefix=AneryCoft_ 19 | 20 | [Skin] 21 | customSkin=false 22 | skin=skin.png 23 | model=0 24 | ;0:经典 1:纤细 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoXGP 2 | 自动为您的微软账户订阅XGP、设置Minecraft档案、 取消订阅XGP 3 | 4 | 您将获得一个可以通过Minecraft正版验证的账号 5 | 6 | ## 使用 7 | * 在[config.ini](https://github.com/AneryCoft/AutoXGP/blob/main/config.ini)中完成对程序的设置 8 | 9 | 如果订阅次数太多可能会被风控,这时候可能需要设置`Proxy` 10 | 11 | 在设置多线程时请注意支付宝账户余额,每次订阅XGP价格为49港元 12 | 13 | 如果需要自定义Minecraft皮肤,请设置`Skin` 14 | 15 | #### 注意:必须要对`Alipay-payPassword`进行配置 16 | 17 | * 在[account.txt](https://github.com/AneryCoft/AutoXGP/blob/main/account.txt)中写入账户 18 | 19 | 20 | 如果您没有微软账户,请先[注册](https://signup.live.com/signup) 21 | 22 | #### 注意:默认邮箱密码之间的分隔符为`----`,可以在`Account`自定义,两个账户之间要换行 23 | 24 | * 运行[AutoXGP.py](https://github.com/AneryCoft/AutoXGP/blob/main/AutoXGP.py) 25 | 完成后的XGP将会写入[XGP.txt](https://github.com/AneryCoft/AutoXGP/blob/main/XGP.txt) 26 | 27 | #### 注意:请使用[HMCL](https://github.com/HMCL-dev/HMCL)或[PCL](https://github.com/Hex-Dragon/PCL2)等第三方启动器登录完成后的XGP 28 | 29 | ## 反馈 30 | 如果您在运行过程的遇到报错,请将控制台截图到[issues](https://github.com/AneryCoft/AutoXGP/issues) 31 | 32 | QQ群:[225705430](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=HvEcIqMdYh5VScESIiN_vVjv7wO1n6zD&authKey=VikOm9rA7rMpGDNaNfH6%2BVP2SJRwTgLvmOYViAa2l6z%2FlLUE%2F10L%2FO8iXO5XFvMb&noverify=0&group_code=225705430) 33 | -------------------------------------------------------------------------------- /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: Run AutoXGP 5 | 6 | on: 7 | workflow_dispatch 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: windows-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Set up Python 3.11 20 | uses: actions/setup-python@v3 21 | with: 22 | python-version: "3.11" 23 | - name: Install dependencies 24 | run: | 25 | python -m pip install --upgrade pip 26 | pip install flake8 pytest 27 | pip install -r requirements.txt 28 | - name: Lint with flake8 29 | run: | 30 | python AutoXGP.py 31 | # stop the build if there are Python syntax errors or undefined names 32 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 33 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 34 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 35 | - name: Test with pytest 36 | run: | 37 | pytest 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Distribution / packaging 7 | .Python 8 | build/ 9 | develop-eggs/ 10 | dist/ 11 | downloads/ 12 | eggs/ 13 | .eggs/ 14 | lib/ 15 | lib64/ 16 | parts/ 17 | sdist/ 18 | var/ 19 | wheels/ 20 | share/python-wheels/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | MANIFEST 25 | 26 | # PyInstaller 27 | # Usually these files are written by a python script from a template 28 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 29 | *.manifest 30 | *.spec 31 | 32 | # Installer logs 33 | pip-log.txt 34 | pip-delete-this-directory.txt 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .nox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *.cover 46 | *.py,cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | cover/ 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | local_settings.py 58 | db.sqlite3 59 | db.sqlite3-journal 60 | 61 | # Flask stuff: 62 | instance/ 63 | .webassets-cache 64 | 65 | # Scrapy stuff: 66 | .scrapy 67 | 68 | # Sphinx documentation 69 | docs/_build/ 70 | 71 | # PyBuilder 72 | .pybuilder/ 73 | target/ 74 | 75 | # Jupyter Notebook 76 | .ipynb_checkpoints 77 | 78 | # IPython 79 | profile_default/ 80 | ipython_config.py 81 | 82 | # pyenv 83 | # For a library or package, you might want to ignore these files since the code is 84 | # intended to run in multiple environments; otherwise, check them in: 85 | # .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # poetry 95 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 96 | # This is especially recommended for binary packages to ensure reproducibility, and is more 97 | # commonly ignored for libraries. 98 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 99 | #poetry.lock 100 | 101 | # pdm 102 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 103 | #pdm.lock 104 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 105 | # in version control. 106 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control 107 | .pdm.toml 108 | .pdm-python 109 | .pdm-build/ 110 | 111 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 112 | __pypackages__/ 113 | 114 | # Celery stuff 115 | celerybeat-schedule 116 | celerybeat.pid 117 | 118 | # SageMath parsed files 119 | *.sage.py 120 | 121 | # Environments 122 | .env 123 | .venv 124 | env/ 125 | venv/ 126 | ENV/ 127 | env.bak/ 128 | venv.bak/ 129 | 130 | # Spyder project settings 131 | .spyderproject 132 | .spyproject 133 | 134 | # Rope project settings 135 | .ropeproject 136 | 137 | # mkdocs documentation 138 | /site 139 | 140 | # mypy 141 | .mypy_cache/ 142 | .dmypy.json 143 | dmypy.json 144 | 145 | # Pyre type checker 146 | .pyre/ 147 | 148 | # pytype static type analyzer 149 | .pytype/ 150 | 151 | # Cython debug symbols 152 | cython_debug/ 153 | 154 | # IDE settings 155 | .vscode/ 156 | .idea/ 157 | 158 | # This repositories 159 | accounts.txt 160 | alipayCookies.json 161 | config.ini 162 | skin.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /AutoXGP.py: -------------------------------------------------------------------------------- 1 | """ 2 | Develped by AneryCoft 3 | Github:https://github.com/AneryCoft 4 | 2024.1.25 5 | """ 6 | 7 | import time 8 | import random 9 | from selenium import webdriver 10 | from selenium.webdriver.edge.options import Options 11 | from selenium.webdriver.common.by import By 12 | import ctypes 13 | import configparser 14 | import httpx 15 | import urllib3 16 | import re 17 | from urllib import parse 18 | import base64 19 | import hashlib 20 | import uuid 21 | import json 22 | import threading 23 | from typing import List 24 | import traceback 25 | import datetime 26 | import execjs 27 | 28 | 29 | def output(message: str): 30 | "输出时间 线程名 信息" 31 | current_time = datetime.datetime.now().strftime("%H-%M-%S") 32 | current_thread_name = threading.current_thread().name 33 | print(f"[{current_time}] {current_thread_name} {message}") 34 | 35 | def random_str(length: int) -> str: 36 | "生成随机字符串" 37 | characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" 38 | return ''.join(random.choices(characters, k=length)) 39 | 40 | def edge(headless:bool) -> webdriver.Edge: 41 | """ 42 | 使用webdriver创建Edge浏览器 43 | """ 44 | options = Options() 45 | options.binary_location = ( 46 | r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" 47 | ) 48 | if headless: 49 | options.add_argument("--headless") 50 | options.add_argument("--inprivate") 51 | options.add_experimental_option("useAutomationExtension", False) 52 | # 禁用调试信息 53 | options.add_experimental_option("excludeSwitches", ["enable-automation", "enable-logging"]) 54 | return webdriver.Edge(options=options) 55 | 56 | def fix_base64_str(string:str) -> str: 57 | """ 58 | 修复Base64编码的字符串 59 | 避免 binascii.Error: Incorrect padding 60 | """ 61 | length = len(string) 62 | if length % 4: 63 | string += "=" * (4 - length % 4) 64 | return string 65 | 66 | def do_submit(code:str, client:httpx.Client, headers:dict, redirects:bool=False) -> httpx.Response|None: 67 | "发送JavaScript中的请求" 68 | url_match = re.search(r'action="(.+?)"', code) 69 | if url_match: 70 | url = url_match.group(1) 71 | method = re.search(r'method="(.+?)"', code).group(1) 72 | items = re.findall(r'', code) 73 | body = {} 74 | for item in items: 75 | name = re.search(r'name="(.+?)"', item).group(1) 76 | value = re.search(r'value="(.+?)"', item).group(1) 77 | body[name] = value 78 | return client.request(method=method, url=url, data=body, headers=headers ,follow_redirects=redirects) 79 | return None 80 | 81 | def getXGP(account:str): 82 | # 用于计算用时 83 | start_time = time.time() 84 | 85 | parts = account.split(split_symbol) 86 | ms_email = parts[0] 87 | ms_password = parts[1] 88 | 89 | client = httpx.Client(http2=True, proxy=proxy, verify=False, timeout=None) 90 | 91 | for cookie in alipay_cookies: 92 | client.cookies.set(cookie["name"], cookie["value"], domain=cookie["domain"]) 93 | 94 | output(account) 95 | 96 | # OAuth2.0 97 | url = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize" 98 | client_id = "1f907974-e22b-4810-a9de-d9647380c97e" 99 | client_request_id = str(uuid.uuid1()) 100 | code_verifier = random_str(43).encode() 101 | code_challenge = base64.urlsafe_b64encode(hashlib.sha256(code_verifier).digest()).rstrip(b"=").decode() 102 | state_data = ('{"id":"%s","meta":{"interactionType":"redirect"}}' % uuid.uuid1()).encode() 103 | state = base64.b64encode(state_data).decode() + "|https%3A%2F%2Fwww.xbox.com%2Fzh-HK%2Fxbox-game-pass%2Fpc-game-pass" 104 | params = { 105 | "client_id": client_id, 106 | "scope": "xboxlive.signin openid profile offline_access", 107 | "redirect_uri": "https://www.xbox.com/auth/msa?action=loggedIn&locale_hint=zh-HK", 108 | "client-request-id": client_request_id, 109 | "response_mode": "fragment", 110 | "response_type": "code", 111 | "x-client-SKU": "msal.js.browser", 112 | "x-client-VER": "3.7.0", 113 | "client_info": "1", 114 | "code_challenge": code_challenge, 115 | "code_challenge_method": "S256", 116 | "prompt": "select_account", 117 | "nonce": str(uuid.uuid1()), 118 | "state": state 119 | } 120 | headers = { 121 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0", 122 | "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", 123 | "sec-fetch-site": "none", 124 | "sec-fetch-mode": "navigate", 125 | "sec-fetch-user": "?1", 126 | "sec-fetch-dest": "document", 127 | "sec-ch-ua": '"Not A(Brand";v="99", "Microsoft Edge";v="121", "Chromium";v="121"', 128 | "sec-ch-ua-mobile": "?0", 129 | "sec-ch-ua-platform": '"Windows"', 130 | "accept-encoding": "gzip", 131 | "accept-language": "zh-CN,zh;q=0.9" 132 | } 133 | oauth2 = client.get(url=url, params=params, headers=headers, follow_redirects=True) 134 | 135 | # 登录微软 136 | 137 | # 发送账户 138 | url = "https://login.live.com/GetCredentialType.srf" 139 | uaid = oauth2.cookies["uaid"] 140 | flow_token = re.search(r'value="(.+?)"',oauth2.text).group(1) 141 | body = { 142 | "username": ms_email, 143 | "uaid": uaid, 144 | "isOtherIdpSupported": False, 145 | "checkPhones": False, 146 | "isRemoteNGCSupported": True, 147 | "isCookieBannerShown": False, 148 | "isFidoSupported": True, 149 | "forceotclogin": False, 150 | "otclogindisallowed": False, 151 | "isExternalFederationDisallowed": False, 152 | "isRemoteConnectSupported": False, 153 | "federationFlags": 3, 154 | "isSignup": False, 155 | "flowToken": flow_token 156 | } 157 | post_email = client.post(url=url, headers=headers, json=body) 158 | 159 | if post_email.json()["IfExistsResult"] == 1: 160 | output(f"微软账户错误") 161 | return 162 | 163 | # 发送密码 164 | opid = re.search(r"opid=(.+?)&", oauth2.text).group(1) 165 | url = f"https://login.live.com/ppsecure/post.srf?opid={opid}&uaid={uaid}" 166 | body = { 167 | "i13": "0", 168 | "login": ms_email, 169 | "loginfmt": ms_email, 170 | "type": "11", 171 | "LoginOptions": "3", 172 | "lrt": "", 173 | "lrtPartition": "", 174 | "hisRegion": "", 175 | "hisScaleUnit": "", 176 | "passwd": ms_password, 177 | "ps": "2", 178 | "psRNGCDefaultType": "", 179 | "psRNGCEntropy": "", 180 | "psRNGCSLK": "", 181 | "canary": "", 182 | "ctx": "", 183 | "hpgrequestid": "", 184 | "PPFT": flow_token, 185 | "PPSX": "P", 186 | "NewUser": "1", 187 | "FoundMSAs": "", 188 | "fspost": "0", 189 | "i21": "0", 190 | "CookieDisclosure": "0", 191 | "IsFidoSupported": "1", 192 | "isSignupPost": "0", 193 | "isRecoveryAttemptPost": "0", 194 | "i19": "060601" 195 | } 196 | post_password = client.post(url=url, headers=headers, data=body) 197 | 198 | # 隐私声明 199 | """ 200 | url_match = re.search(r'action="(.+?)"',post_password.text) 201 | if url_match: 202 | url = url_match.group(1) 203 | if url.split("?")[0] == "https://privacynotice.account.microsoft.com/notice": 204 | body = { 205 | "correlation_id": re.search(r'id="correlation_id" value="(.+?)">',post_password.text).group(1), 206 | "code": re.search(r'id="code" value="(.+?)">',post_password.text).group(1) 207 | } 208 | privacy_notice = client.post(url=url, data=body, headers=headers) 209 | """ 210 | 211 | # 跳过登录保护 212 | # 这个界面的出现不固定 213 | add_proofs = do_submit(post_password.text,client,headers) 214 | 215 | skip_prove_body = { 216 | "iProofOptions": "Email", 217 | "DisplayPhoneCountryISO": "CN", 218 | "DisplayPhoneNumber": "", 219 | "EmailAddress": "", 220 | "canary": "", 221 | "action": "Skip", 222 | "PhoneNumber": "", 223 | "PhoneCountryISO": "" 224 | } 225 | 226 | if add_proofs: 227 | canary = re.search(r'name="canary" value="(.+?)"',add_proofs.text).group(1) 228 | skip_prove_body["canary"] = canary 229 | skip_add_proof = client.post(url=url, data=skip_prove_body, headers=headers,follow_redirects=True) 230 | 231 | # 取消保持登录状态 232 | url = f"https://login.live.com/ppsecure/post.srf?nopa=2&uaid={uaid}&opid={opid}" 233 | body = { 234 | "LoginOptions": "3", 235 | "type": "28", 236 | "ctx": "", 237 | "hpgrequestid": "", 238 | "PPFT": flow_token, 239 | "canary": "" 240 | } 241 | keep_login = client.post(url=url, data=body, headers=headers) 242 | params_respond = keep_login 243 | 244 | add_proofs = do_submit(keep_login.text,client,headers) 245 | if add_proofs: 246 | canary = re.search(r'name="canary" value="(.+?)"',add_proofs.text).group(1) 247 | skip_prove_body["canary"] = canary 248 | skip_add_proof = client.post(url=url, data=skip_prove_body, headers=headers,follow_redirects=True) 249 | params_respond = skip_add_proof 250 | 251 | # 登录Xbox 252 | 253 | url = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token" 254 | headers["origin"] = "https://www.xbox.com" 255 | code = re.search(r'code=(.+?)&',params_respond.headers["Location"]).group(1) 256 | body = { 257 | "client_id": client_id, 258 | "redirect_uri": "https://www.xbox.com/auth/msa?action=loggedIn&locale_hint=zh-HK", 259 | "scope": "xboxlive.signin openid profile offline_access", 260 | "code": code, 261 | "x-client-SKU": "msal.js.browser", 262 | "x-client-VER": "3.7.0", 263 | "x-ms-lib-capability": "retry-after, h429", 264 | "x-client-current-telemetry": "", 265 | "x-client-last-telemetry": "", 266 | "code_verifier": code_verifier.decode(), 267 | "grant_type": "authorization_code", 268 | "client_info": "1", 269 | "client-request-id": client_request_id, 270 | "X-AnchorMailbox": "" 271 | } 272 | oauth2_token = client.post(url=url, data=body, headers=headers) 273 | 274 | url = "https://sisu.xboxlive.com/connect/XboxLive" 275 | # token_decode = jwt.decode(oauth2_token.json["id_token"],algorithms=["RS256"],verify=False) 276 | tokrn_data = fix_base64_str(str(oauth2_token.json()["id_token"]).split(".")[1]) 277 | tokrn_data_decode = json.loads(base64.b64decode(tokrn_data)) 278 | login_hint = tokrn_data_decode["login_hint"] 279 | msa_id = tokrn_data_decode["oid"] + "." + tokrn_data_decode["tid"] 280 | params = { 281 | "ru": "https://www.xbox.com/auth/msa?action=loggedIn", 282 | "login_hint": login_hint, 283 | "userPrompts": "XboxOptionalDataCollection", 284 | "consent": "required", 285 | "cv": "", 286 | "state": '{"ru":"https://www.xbox.com/zh-HK/xbox-game-pass/pc-game-pass","msaId":%s,"sid":"RETAIL"}' % msa_id 287 | } 288 | logged_in = client.get(url=url, params=params, headers=headers, follow_redirects=True) 289 | 290 | # 创建Xbox档案 291 | 292 | logged_in_redirects = logged_in.history 293 | session_id_match = re.search(r'sid=(.+?)&',logged_in_redirects[2].headers["Location"]) 294 | if len(logged_in_redirects) > 2 and session_id_match: 295 | session_id = session_id_match.group(1) 296 | url = f"https://sisu.xboxlive.com/proxy?sessionid={session_id}" 297 | headers["authorization"] = re.search(r'spt=(.+?)&',logged_in_redirects[2].headers["Location"]).group(1) 298 | reservation_id = 1234567890 299 | body = { 300 | "GamertagReserve": { 301 | "Gamertag": "", 302 | "ReservationId": reservation_id, 303 | "Duration": "1:00:00" 304 | } 305 | } 306 | # 测试代号是否可用 307 | xbox_prefix = config.get("Prefix", "xbox_prefix") 308 | while True: 309 | xbox_gamertag = xbox_prefix + random_str(15 - len(xbox_prefix)) 310 | body["GamertagReserve"]["Gamertag"] = xbox_gamertag 311 | gamertag_test = client.post(url=url, json=body, headers=headers) 312 | if gamertag_test.is_success: 313 | break 314 | 315 | # 设置代号 316 | body = { 317 | "CreateAccountWithGamertag": { 318 | "Gamertag": xbox_gamertag, 319 | "ReservationId": reservation_id 320 | } 321 | } 322 | set_gamertag = client.post(url=url, json=body, headers=headers) 323 | current_gamertag = set_gamertag.json()["gamerTag"] 324 | if current_gamertag == xbox_gamertag: 325 | output(f"已设置Xbox玩家代号为:{xbox_gamertag}") 326 | 327 | # 设置头像 328 | body = { 329 | "SetGamerpic": { 330 | "GamerPic": "https://dlassets-ssl.xboxlive.com/public/content/ppl/gamerpics/00052-00000-md.png?w=320&h=320" 331 | } 332 | } 333 | set_gamerpic = client.post(url=url, json=body, headers=headers) 334 | 335 | # 可选诊断数据 336 | """ 337 | url = "https://sisu.xboxlive.com/client/v32/default/view/consent.html?action=signup&flowType=new_user" 338 | consent = client.get(url=url, json=body, headers=headers) 339 | 340 | body = { 341 | "CheckConsents": {} 342 | } 343 | check_consents = client.post(url=url, json=body, headers=headers) 344 | 345 | body = { 346 | "SetConsents": { 347 | "Consents": [ 348 | { 349 | "id": check_consents.json()["consents"][0]["id"], 350 | "values": [ 351 | { 352 | "categoryName": "XboxDiagnosticsOptionalData", 353 | "value": "false", 354 | "valueDataType": "Boolean" 355 | } 356 | ] 357 | } 358 | ] 359 | } 360 | } 361 | set_consents = client.post(url=url, json=body, headers=headers) 362 | """ 363 | 364 | # Xbox验证 365 | 366 | url = "https://user.auth.xboxlive.com/user/authenticate" 367 | rps_ticket = "d=" + oauth2_token.json()["access_token"] 368 | body = { 369 | "Properties": { 370 | "AuthMethod": "RPS", 371 | "RpsTicket": rps_ticket, 372 | "SiteName": "user.auth.xboxlive.com", 373 | }, 374 | "RelyingParty": "http://auth.xboxlive.com", 375 | "TokenType": "JWT" 376 | } 377 | xbox_auth_1 = client.post(url=url, json=body, headers=headers) 378 | 379 | url = "https://xsts.auth.xboxlive.com/xsts/authorize" 380 | user_token = xbox_auth_1.json()["Token"] 381 | body = { 382 | "Properties": { 383 | "SandboxId": "RETAIL", 384 | "UserTokens": [user_token] 385 | }, 386 | "RelyingParty": "http://mp.microsoft.com/", 387 | "TokenType": "JWT" 388 | } 389 | xbox_auth_2 = client.post(url=url, json=body, headers=headers) 390 | 391 | # 订阅XGP 392 | 393 | url = "https://www.microsoft.com/store/buynow?noCanonical=true&market=HK&locale=zh-HK&clientName=XboxCom" 394 | uhs = xbox_auth_2.json()["DisplayClaims"]["xui"][0]["uhs"] 395 | microsoft_token = xbox_auth_2.json()["Token"] 396 | XToken = f"XBL3.0 x={uhs};{microsoft_token}" 397 | body = { 398 | "data": '{"usePurchaseSdk":true}', 399 | "market": "HK", 400 | "cV": "", 401 | "locale": "zh-HK", 402 | "xToken": XToken, 403 | "pageFormat": "full", 404 | "products": '[{"productId":"CFQ7TTC0KGQ8","skuId":"0002","availabilityId":"CFQ7TTC0L6B2"}]', 405 | "campaignId": "xboxcomct", 406 | "callerApplicationId": "XboxCom", 407 | "expId": "EX:sc_xboxspinner,EX:sc_xboxclosebutton,EX:sc_xboxgamepad,EX:sc_xboxuiexp,EX:sc_disabledefaultstyles,EX:sc_gamertaggifting", 408 | "flights[0]": "sc_xboxspinner", 409 | "flights[1]": "sc_xboxclosebutton", 410 | "flights[2]": "sc_xboxgamepad", 411 | "flights[3]": "sc_xboxuiexp", 412 | "flights[4]": "sc_disabledefaultstyles", 413 | "flights[5]": "sc_gamertaggifting", 414 | "urlRef": "https://www.xbox.com/zh-HK/auth/msa?action=loggedIn&locale_hint=zh-HK", 415 | "clientType": "XboxCom", 416 | "layout": "Modal", 417 | "cssOverride": "XboxCom2NewUI", 418 | "theme": "light", 419 | "timeToInvokeIframe": "83329.29999999981", 420 | "sdkVersion": "VERSION_PLACEHOLDER" 421 | } 422 | buy_xgp = client.post(url=url, data=body, headers=headers) 423 | 424 | # 选择支付方式 425 | cart_id = re.search(r'"cartId":"(.*?)"', buy_xgp.text).group(1) 426 | if cart_id == "": 427 | output("出现异常 请使用网络代理") 428 | return 429 | 430 | params = { 431 | "type": "alipay_billing_agreement", 432 | "partner": "webblends", 433 | "orderId": cart_id, 434 | "operation": "Add", 435 | "country": "HK", 436 | "language": "zh-HK", 437 | "family": "ewallet", 438 | "completePrerequisites": "true" 439 | } 440 | url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/paymentMethodDescriptions" 441 | headers["origin"] = "https://www.microsoft.com" 442 | headers["referer"] = "https://www.microsoft.com/" 443 | headers["authorization"] = XToken 444 | payment_method_descriptions = client.get(url=url, params=params, headers=headers) 445 | 446 | # 确认支付 447 | url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/paymentInstrumentsEx?country=hk&language=zh-CHT&partner=webblends&completePrerequisites=True" 448 | risk_id = re.search(r'"riskId":"(.+?)"', buy_xgp.text).group(1) 449 | session_id = str(uuid.uuid1()) 450 | body = { 451 | "paymentMethodCountry": "hk", 452 | "paymentMethodFamily": "ewallet", 453 | "paymentMethodOperation": "add", 454 | "paymentMethodResource_id": "ewallet.alipayQrCode", 455 | "paymentMethodType": "alipay_billing_agreement", 456 | "riskData": { 457 | "dataCountry": "hk", 458 | "dataOperation": "add", 459 | "dataType": "payment_method_riskData", 460 | "greenId": risk_id, 461 | }, 462 | "sessionId": session_id 463 | } 464 | payment_instruments_ex = client.post(url=url, json=body, headers=headers) 465 | 466 | # 支付宝签约页面 467 | url = payment_instruments_ex.json()["clientAction"]["context"][0]["displayDescription"][0]["members"][3]["members"][0]["pidlAction"]["context"]["baseUrl"] 468 | payment_instrument_id = payment_instruments_ex.json()["id"] 469 | params = { 470 | "ru": f"https://www.microsoft.com/zh-HK/store/rds/v2/GeneralAddPISuccess?picvRequired=False&pendingOn=Notification&type=alipay_billing_agreement&family=ewallet&id={payment_instrument_id}", 471 | "rx": "https://www.microsoft.com/zh-HK/store/rds/v2/GeneralAddPIFailure" 472 | } 473 | headers.pop("origin") 474 | headers.pop("authorization") 475 | alipay_deduct = client.get(url=url, params=params, headers=headers, follow_redirects=True) 476 | 477 | # 发送支付宝支付密码签约 478 | url = "https://securitycore.alipay.com/securityAjaxValidate.json" 479 | aliedit_uid = re.search(r'name="alieditUid" value="(.+?)"',alipay_deduct.text).group(1) 480 | security_id = re.search(r'name="securityId" value="(.+?)"',alipay_deduct.text).group(1) 481 | 482 | PK = re.search(r'PK: "(.+?)"',alipay_deduct.text).group(1) 483 | TS = re.search(r'TS: "(.+?)"',alipay_deduct.text).group(1) 484 | ksk = re.search(r"ksk: '(.+?)'",alipay_deduct.text).group(1) 485 | pay_password:str = alipay_encrypt_js.call("securityPassword",alipay_pay_password,PK,TS) 486 | key_seq:str = alipay_encrypt_js.call("getKeySeq",ksk) 487 | 488 | params = { 489 | "sendCount": "3", 490 | "dataId": int(time.time() * 1000), 491 | "dataSize": "1", 492 | "dataIndex": "0", 493 | "dataContent": '{"payment_password":{"J_aliedit_key_hidn":"payPassword","J_aliedit_uid_hidn":"alieditUid","J_aliedit_using":true,"payPassword":"%s","alieditUid":"%s","ks":"%s","security_activeX_enabled":false}}' 494 | % (pay_password, aliedit_uid, key_seq), 495 | "_callback": "light.packetRequest._packetCallbacks.callback0", 496 | "securityId": security_id, 497 | "orderId": "null" 498 | } 499 | headers["referer"] = "https://mdeduct.alipay.com/" 500 | post_pay_password = client.get(url=url, params=params, headers=headers) 501 | 502 | url = "https://mdeduct.alipay.com/customer/customerAgreementSignConfirm.htm" 503 | headers["origin"] = "https://mdeduct.alipay.com" 504 | headers["referer"] = str(alipay_deduct.url) 505 | _form_token = re.search(r'name="_form_token" value="(.+?)"',alipay_deduct.text).group(1) 506 | cache_context_id = re.search(r'name="cacheContextId" value="(.+?)"',alipay_deduct.text).group(1) 507 | e_i_i_d = re.search(r'name="e_i_i_d" value="(.+?)"',alipay_deduct.text).group(1) 508 | user_logon_id = re.search(r'name="userLogonId" value="(.+?)"',alipay_deduct.text).group(1) 509 | body = { 510 | "_form_token" : _form_token, 511 | "signFlag" : "signConfirmFromPC", 512 | "cacheContextId" : cache_context_id, 513 | "notNeedMobileCodeCheck" : "false", 514 | "e_i_i_d":e_i_i_d, 515 | "i_c_i_d":"", 516 | "userLogonId" : user_logon_id, 517 | "securityId" : security_id, 518 | "payPassword_input": "", 519 | "payPassword_rsainput":"", 520 | "J_aliedit_using": "true", 521 | "payPassword": "", 522 | "J_aliedit_key_hidn": "payPassword", 523 | "J_aliedit_uid_hidn": "alieditUid", 524 | "alieditUid": aliedit_uid, 525 | "REMOTE_PCID_NAME": "_seaside_gogo_pcid", 526 | "_seaside_gogo_pcid": "", 527 | "_seaside_gogo_": "", 528 | "_seaside_gogo_p": "", 529 | "J_aliedit_prod_type": "payment_password", 530 | "security_activeX_enabled": "false", 531 | "J_aliedit_net_info": "" 532 | } 533 | sign_confirm = client.post(url=url, data=body, headers=headers) 534 | 535 | headers["origin"] = "https://www.microsoft.com" 536 | headers["referer"] = "https://www.microsoft.com/" 537 | headers["authorization"] = XToken 538 | 539 | # 确认使用支付宝订阅 540 | url = f"https://paymentinstruments.mp.microsoft.com/v6.0/users/me/paymentInstrumentsEx/{payment_instrument_id}?language=zh-CHT&partner=webblends&country=hk&completePrerequisites=True" 541 | while True: 542 | add_alipay = client.get(url=url, headers=headers) 543 | status = add_alipay.json()["status"] 544 | if status != "Pending": # Active 545 | break 546 | 547 | # 设置姓名 548 | url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/profiles" 549 | body = { 550 | "profileType": "consumerprerequisites", 551 | "profileCountry": "hk", 552 | "profileOperation": "add", 553 | "type": "consumer", 554 | "first_name": "Coft", 555 | "last_name": "Anery", 556 | "email_address": ms_email, 557 | "culture": "EN" 558 | } 559 | set_name = client.post(url=url, json=body, headers=headers) 560 | 561 | # 添加地址信息 562 | # url = "https://jcmsfd.account.microsoft.com/JarvisCM/me/addresses" 563 | url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/addresses" 564 | body = { 565 | "addressCountry": "hk", 566 | "addressType": "billing", 567 | "address_line1": "b", 568 | "address_line2": "", 569 | "city": "a", 570 | "country": "hk" 571 | } 572 | addresses = client.post(url=url, json=body, headers=headers) 573 | 574 | # 订阅 575 | url = "https://cart.production.store-web.dynamics.com/v1.0/Cart/PrepareCheckout?appId=BuyNow&context=UpdateBillingInformation" 576 | headers["ms-cv"] = re.search(r'"cvServerStart":"(.+?)"',buy_xgp.text).group(1) 577 | headers["x-authorization-muid"] = re.search(r'"alternativeMuid":"(.+?)"',buy_xgp.text).group(1) 578 | headers["x-ms-client-type"] = "XboxCom" 579 | headers["x-ms-market"] = "HK" 580 | headers["x-ms-vector-id"] = re.search(r'"vectorId":"(.+?)"',buy_xgp.text).group(1) 581 | risk_id = re.search(r'"riskId":"(.+?)"',buy_xgp.text).group(1) 582 | # flights = re.search(r'"flights":\[(.+?)\]', buy_xgp.text).group(1) 583 | # flights = flights.replace('"',"").split(",") 584 | body = { 585 | "callerApplicationId": "_CONVERGED_XboxCom", 586 | "cartId": cart_id, 587 | "catalogClientType": "", 588 | "clientContext": { 589 | "client": "XboxCom", 590 | "deviceFamily": "Web" 591 | }, 592 | "flights": [], 593 | "friendlyName": None, 594 | "isBuyNow": True, 595 | "isGift": False, 596 | "locale": "zh-HK", 597 | "market": "HK", 598 | "primaryPaymentInstrumentId": payment_instrument_id, 599 | "refreshPrimaryPaymentOption": False, 600 | "riskSessionId": risk_id, 601 | "testScenarios": "None" 602 | } 603 | prepare_checkout = client.post(url=url, json=body, headers=headers) 604 | 605 | url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/PaymentSessionDescriptions" 606 | piid = payment_instrument_id 607 | pi_cid = add_alipay.json()["accountId"] 608 | purchase_order_id = cart_id 609 | params = { 610 | "paymentSessionData" : '{"piid":"%s","language":"zh-HK","partner":"webblends","piCid":"%s","amount":29,"currency":"HKD","country":"HK","hasPreOrder":"false","challengeScenario":"RecurringTransaction","challengeWindowSize":"03","purchaseOrderId":"%s"}' % (piid,pi_cid,purchase_order_id), 611 | "operation": "Add" 612 | } 613 | payment_session_descriptions = client.get(url=url, params=params, headers=headers) 614 | 615 | url = f"https://cart.production.store-web.dynamics.com/v1.0/Cart/purchase?appId=BuyNow" 616 | match_addr_id = re.search(r'(.+?)',addresses.text) 617 | address_id:str 618 | if match_addr_id: 619 | address_id = match_addr_id.group(1) 620 | else: 621 | address_id = addresses.json()["id"] 622 | # address_id = re.search(r'"soldToAddressId":"(.+?)"',buy_xgp.text).group(1) 623 | 624 | body = { 625 | "cartId": cart_id, 626 | "market": "HK", 627 | "locale": "zh-HK", 628 | "catalogClientType": "", 629 | "callerApplicationId": "_CONVERGED_XboxCom", 630 | "clientContext": { 631 | "client": "XboxCom", 632 | "deviceFamily": "Web" 633 | }, 634 | "paymentSessionId": session_id, 635 | "riskChallengeData": None, 636 | "rdsAsyncPaymentStatusCheck": False, 637 | "paymentInstrumentId": payment_instrument_id, 638 | "paymentInstrumentType": "alipay_billing_agreement", 639 | "email": ms_email, 640 | "csvTopOffPaymentInstrumentId": None, 641 | "billingAddressId": { 642 | "accountId": pi_cid, 643 | "id": address_id 644 | }, 645 | "currentOrderState": "CheckingOut", 646 | "flights": [], 647 | "itemsToAdd": {} 648 | } 649 | buy_now = client.post(url=url, json=body, headers=headers) 650 | 651 | output("已订阅Xbox Game Pass") 652 | 653 | # 设置Minecraft档案 654 | 655 | # 登录微软账户 656 | """ 657 | url = "https://www.minecraft.net/msaprofilejs/6eff6391c7c99228bb68_03012024_0244/11.chunk.c68d8eb533ea60bdfbc5.js" 658 | get_login_params = session.get(url=url, headers=headers, allow_redirects=False) 659 | """ 660 | # cobrandId = re.search(r'sisuCobrandId:"(.+?)"', get_login_params.text).group(1) 661 | # tid = re.search(r'titleId:"(.+?)"', get_login_params.text).group(1) 662 | ru = "https%3A%2F%2Fwww.minecraft.net%2Fzh-hans%2Flogin%3Freturn_url%3Dhttps%253A%252F%252Fwww.minecraft.net%252Fzh-hans%252Fmsaprofile%252Fmygames%252Feditprofile" 663 | # aid = re.search(r'sisuAppId:"(.+?)"', get_login_params.text).group(1) 664 | url = f"https://sisu.xboxlive.com/connect/XboxLive/?state=login&ru={ru}" 665 | headers.pop("authorization") 666 | headers.pop("ms-cv") 667 | headers.pop("x-authorization-muid") 668 | headers.pop("x-ms-client-type") 669 | headers.pop("x-ms-market") 670 | headers.pop("x-ms-vector-id") 671 | headers["referer"] = "https://www.minecraft.net/" 672 | headers["origin"] = "https://www.minecraft.net" 673 | login_minecraft = client.get(url=url, headers=headers, follow_redirects=True) 674 | 675 | url = "https://api.minecraftservices.com/authentication/login_with_xbox" 676 | access_token_base64 = login_minecraft.history[2].headers["location"].split("#")[1].strip("state=login&accessToken=") 677 | access_token = json.loads(base64.b64decode(fix_base64_str(access_token_base64))) 678 | uhs,token = "","" 679 | for item in access_token: 680 | if item["Item1"] == "rp://api.minecraftservices.com/": 681 | uhs = item["Item2"]["DisplayClaims"]["xui"][0]["uhs"] 682 | token = item["Item2"]["Token"] 683 | identity_token = "XBL3.0 x=" + uhs + ";" + token 684 | body = { 685 | "ensureLegacyEnabled": True, 686 | "identityToken": identity_token 687 | } 688 | login_with_xbox = client.post(url=url, json=body, headers=headers) 689 | 690 | request_id = str(uuid.uuid1()) 691 | url = f"https://api.minecraftservices.com/entitlements/license?requestId={request_id}" 692 | authorization = "Bearer " + login_with_xbox.json()["access_token"] 693 | headers["authorization"] = authorization 694 | redeem = client.get(url=url, headers=headers) 695 | 696 | minecraft_prefix = config.get("Prefix", "minecraft_prefix") 697 | 698 | # 测试ID是否可用 699 | while True: 700 | profile_name = minecraft_prefix + random_str(16 - len(minecraft_prefix)) 701 | url = f"https://api.minecraftservices.com/minecraft/profile/name/{profile_name}/available" 702 | name_available = client.get(url=url, headers=headers) 703 | status = name_available.json()["status"] 704 | if status == "AVAILABLE": 705 | break 706 | 707 | # 设置MinecraftID 708 | url = "https://api.minecraftservices.com/minecraft/profile" 709 | body = {"profileName": profile_name} 710 | set_profile_name = client.post(url=url, json=body, headers=headers) 711 | if set_profile_name.is_success: 712 | output(f"已设置MinecraftID为:{profile_name}") 713 | elif set_profile_name.json()["details"]["status"] == "NOT_ENTITLED": 714 | output(f"无法修改MinecraftID!") 715 | 716 | # 设置Minecraft皮肤 717 | if config.getboolean("Skin","customSkin"): 718 | url = "https://api.minecraftservices.com/minecraft/profile/skins" 719 | model = config.getint("Skin","model") 720 | model_list = ["classic","slim"] 721 | body = {"variant": model_list[model]} 722 | skin_path = config["Skin"]["skin"] 723 | skin_file = open(skin_path,"rb") 724 | skin = {"file":skin_file} 725 | custom_skin = client.post(url=url, headers=headers, data=body, files=skin) 726 | if custom_skin.is_success: 727 | output("已设置Minecraft皮肤") 728 | 729 | # 取消订阅 730 | 731 | # 登录微软账户 732 | url = "https://account.microsoft.com/services/pcgamepass/cancel?fref=billing-cancel" 733 | headers.pop("authorization") 734 | headers["referer"] = "https://account.microsoft.com/" 735 | headers["origin"] = "https://account.microsoft.com" 736 | login = client.get(url=url, headers=headers,follow_redirects=True) 737 | 738 | login_ms = do_submit(login.text,client,headers,True) 739 | 740 | url = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize" 741 | client_id = "81feaced-5ddd-41e7-8bef-3e20a2689bb7" 742 | client_request_id = str(uuid.uuid1()) 743 | code_verifier = random_str(43).encode() 744 | code_challenge = base64.urlsafe_b64encode(hashlib.sha256(code_verifier).digest()).rstrip(b"=").decode() 745 | state_data = ('{"id":"%s","meta":{"interactionType":"silent"}}' % uuid.uuid1()).encode() 746 | state = base64.b64encode(state_data).decode() 747 | params = { 748 | "client_id": client_id, 749 | "scope": "openid profile offline_access", 750 | "redirect_uri": "https://account.microsoft.com/auth/complete-client-signin-oauth", 751 | "client-request-id": client_request_id, 752 | "response_mode": "fragment", 753 | "response_type": "code", 754 | "x-client-SKU": "msal.js.browser", 755 | "x-client-VER": "2.37.0", 756 | "client_info": "1", 757 | "code_challenge": code_challenge, 758 | "code_challenge_method": "S256", 759 | "prompt": "none", 760 | "login_hint": ms_email, 761 | "X-AnchorMailbox": "UPN:" + ms_email, 762 | "nonce": str(uuid.uuid1()), 763 | "state": state 764 | } 765 | oauth2 = client.get(url=url, params=params, headers=headers, follow_redirects=True) 766 | 767 | url = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token" 768 | url_and_params = oauth2.history[1].headers["Location"] 769 | code = re.search(r"code=(.+?)&", url_and_params).group(1) 770 | body = { 771 | "client_id": client_id, 772 | "redirect_uri": "https://account.microsoft.com/auth/complete-client-signin-oauth", 773 | "scope": "openid profile offline_access", 774 | "code": code, 775 | "x-client-SKU": "msal.js.browser", 776 | "x-client-VER": "2.37.0", 777 | "x-ms-lib-capability": "retry-after, h429", 778 | "x-client-current-telemetry": "", 779 | "x-client-last-telemetry": "", 780 | "code_verifier": code_verifier.decode(), 781 | "grant_type": "authorization_code", 782 | "client_info": "1", 783 | "client-request-id": client_request_id, 784 | "X-AnchorMailbox": "" 785 | } 786 | oauth2_token = client.post(url=url, data=body, headers=headers) 787 | 788 | # 取消订阅 789 | url = "https://account.microsoft.com/services/pcgamepass/cancel?fref=billing-cancel&refd=account.microsoft.com" 790 | cancel_service_page = client.get(url=url, headers=headers) 791 | 792 | url = "https://account.microsoft.com/services/api/cancelservice" 793 | verification_token = re.search(r'name="__RequestVerificationToken" type="hidden" value="(.+?)"',cancel_service_page.text).group(1) 794 | headers["__requestverificationtoken"] = verification_token 795 | headers["ms-cv"] = client.cookies["AMC-MS-CV"] 796 | headers["referer"] = "https://account.microsoft.com/services/pcgamepass/cancel?fref=billing-cancel&refd=account.microsoft.com" 797 | headers["x-requested-with"]= "XMLHttpRequest" 798 | headers["x-tzoffset"]= "480" 799 | match_service_id = re.search(r'"active":\[{"id":"(.+?)"',cancel_service_page.text) 800 | if match_service_id: 801 | service_id = match_service_id.group(1) 802 | else: 803 | url = "https://account.microsoft.com/services/api/subscriptions-and-alerts?excludeWindowsStoreInstallOptions=false&excludeLegacySubscriptions=false" 804 | subscriptions_and_alerts = client.get(url=url, headers=headers) 805 | service_id = subscriptions_and_alerts.json()["active"][0]["id"] 806 | body = { 807 | "serviceId":service_id, 808 | "serviceType":"recurrence", 809 | "refundAmount":29, 810 | "riskToken":"", 811 | "isDunning":False, 812 | "locale":"zh-CN", 813 | "market":"HK" 814 | } 815 | cancel_service = client.put(url=url, json=body, headers=headers) 816 | 817 | output("已取消订阅并退款") 818 | 819 | # 删除付款工具 820 | url = "https://account.microsoft.com/auth/acquire-onbehalf-of-token?scopes=pidl" 821 | acquire_token = client.get(url=url, headers=headers) 822 | 823 | url = f"https://paymentinstruments.mp.microsoft.com/v6.0/users/me/paymentInstrumentsEx/{payment_instrument_id}?partner=northstarweb&language=zh-CN" 824 | headers.pop("__requestverificationtoken") 825 | headers["authorization"] = "MSADELEGATE1.0=" + acquire_token.json()[0]["token"] 826 | delete_payment_instruments = client.delete(url=url, headers=headers) 827 | 828 | output("已删除付款工具") 829 | 830 | lock.acquire() 831 | global XGP_file 832 | XGP_file.write(account + "\n") 833 | lock.release() 834 | 835 | output("用时:%.2f秒" % (time.time() - start_time)) 836 | 837 | def assign_account(accounts:List[str]): 838 | while True: 839 | lock.acquire() 840 | if not accounts: 841 | lock.release() 842 | break 843 | account = accounts.pop() 844 | lock.release() 845 | account = account.strip("\n") 846 | try: 847 | getXGP(account) 848 | except Exception as e: 849 | traceback.print_exception(e) 850 | 851 | def set_title(): 852 | "设置控制台标题" 853 | while True: 854 | time_now = datetime.datetime.now().replace(microsecond=0) 855 | elapsed = time_now - start_time 856 | ctypes.windll.kernel32.SetConsoleTitleW(f"AutoXGP V{VERSION} | 用时:{elapsed}") 857 | time.sleep(1.0) 858 | 859 | if __name__ == "__main__": 860 | VERSION = "1.0" 861 | start_time = datetime.datetime.now().replace(microsecond=0) 862 | set_title_thread = threading.Thread(target=set_title,daemon=True) 863 | set_title_thread.start() 864 | 865 | config = configparser.ConfigParser() 866 | config.read("config.ini") 867 | 868 | # 获取支付宝登录Cookie 869 | 870 | cookie_file = open("alipayCookies.json", "r+") 871 | alipay_cookies = cookie_file.read() 872 | if alipay_cookies == "": 873 | driver = edge(False) 874 | driver.get("https://auth.alipay.com/login/index.htm?goto=https%3A%2F%2Fwww.alipay.com%2F") 875 | output("扫码以登录支付宝") 876 | # 判断是否已扫码 877 | while True: 878 | if driver.current_url.startswith("https://www.alipay.com/"): 879 | break 880 | else: 881 | time.sleep(0.2) 882 | 883 | alipay_cookies = driver.get_cookies() 884 | save_cookie = config.getboolean("Alipay", "saveCookie") 885 | if save_cookie: 886 | cookie_file.write(json.dumps(alipay_cookies)) 887 | cookie_file.close() 888 | output("已保存支付宝Cookies") 889 | driver.quit() 890 | else: 891 | alipay_cookies = json.loads(alipay_cookies) 892 | 893 | # 编译JavaScript 894 | js_file = open("alipayEncrypt.js","r") 895 | alipay_encrypt_js = execjs.compile(js_file.read()) 896 | js_file.close() 897 | 898 | # 获取支付宝支付密码 899 | alipay_pay_password:str = config.get("Alipay", "payPassword") 900 | if alipay_pay_password == "": 901 | alipay_pay_password = input("输入你的支付宝支付密码:") 902 | config.set("Alipay", "payPassword", alipay_pay_password) 903 | config_file = open("config.ini", "w") 904 | config.write(config_file) 905 | config_file.close() 906 | output("已在配置中保存支付宝支付密码") 907 | 908 | account_file = open("accounts.txt","r+") 909 | accounts = account_file.readlines() 910 | account_file.close() 911 | 912 | split_symbol = config.get("Account","splitSymbol") 913 | 914 | XGP_file = open("XGP.txt","a") 915 | 916 | enable_proxy = config.getboolean("Proxy","enableProxy") 917 | if enable_proxy: 918 | host = config["Proxy"]["host"] 919 | port = config["Proxy"]["port"] 920 | proxy = "http://" + host + ":" + port 921 | else: 922 | proxy = None 923 | 924 | thread_num = config.getint("Thread","thread") 925 | threads:List[threading.Thread] = [] 926 | lock = threading.Lock() 927 | for _ in range(thread_num): 928 | thread = threading.Thread(target=assign_account,args=(accounts,)) 929 | threads.append(thread) 930 | thread.start() 931 | for thread in threads: 932 | thread.join() 933 | 934 | XGP_file.close() 935 | -------------------------------------------------------------------------------- /alipayEncrypt.js: -------------------------------------------------------------------------------- 1 | window = globalThis; 2 | document = {"userAgent":"node.js"}; 3 | navigator = {"userAgent":"node.js"}; 4 | 5 | 6 | var arale_events_120_events, 7 | security_crypto_200_lib_base64, 8 | security_crypto_200_lib_rsa, 9 | security_client_utils_202_lib_keysequence, 10 | security_password_222_lib_six_digit_password, 11 | security_crypto_200_index; 12 | 13 | security_crypto_200_lib_base64 = function(t) { 14 | var e, i = {}, 15 | n = i.Base64, 16 | r = "2.1.2", 17 | s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 18 | o = function(t) { 19 | for (var e = {}, i = 0, n = t.length; n > i; i++) e[t.charAt(i)] = i; 20 | return e 21 | }(s), 22 | a = String.fromCharCode, 23 | u = function(t) { 24 | if (t.length < 2) { 25 | var e = t.charCodeAt(0); 26 | return 128 > e ? t : 2048 > e ? a(192 | e >>> 6) + a(128 | 63 & e) : a(224 | e >>> 12 & 15) + a(128 | e >>> 6 & 63) + a(128 | 63 & e) 27 | } 28 | var e = 65536 + 1024 * (t.charCodeAt(0) - 55296) + (t.charCodeAt(1) - 56320); 29 | return a(240 | e >>> 18 & 7) + a(128 | e >>> 12 & 63) + a(128 | e >>> 6 & 63) + a(128 | 63 & e) 30 | }, 31 | c = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, 32 | h = function(t) { 33 | return t.replace(c, u) 34 | }, 35 | l = function(t) { 36 | var e = [0, 2, 1][t.length % 3], 37 | i = t.charCodeAt(0) << 16 | (t.length > 1 ? t.charCodeAt(1) : 0) << 8 | (t.length > 2 ? t.charCodeAt(2) : 0), 38 | n = [s.charAt(i >>> 18), s.charAt(i >>> 12 & 63), e >= 2 ? "=" : s.charAt(i >>> 6 & 63), e >= 1 ? "=" : s.charAt(63 & i)]; 39 | return n.join("") 40 | }, 41 | f = i.btoa ? function(t) { 42 | return i.btoa(t) 43 | } : function(t) { 44 | return t.replace(/[\s\S]{1,3}/g, l) 45 | }, 46 | d = e ? function(t) { 47 | return new e(t) 48 | .toString("base64") 49 | } : function(t) { 50 | return f(h(t)) 51 | }, 52 | p = function(t, e) { 53 | return e ? d(t) 54 | .replace(/[+\/]/g, function(t) { 55 | return "+" == t ? "-" : "_" 56 | }) 57 | .replace(/=/g, "") : d(t) 58 | }, 59 | g = function(t) { 60 | return p(t, !0) 61 | }, 62 | y = new RegExp(["[\xc0-\xdf][\x80-\xbf]", "[\xe0-\xef][\x80-\xbf]{2}", "[\xf0-\xf7][\x80-\xbf]{3}"].join("|"), "g"), 63 | m = function(t) { 64 | switch (t.length) { 65 | case 4: 66 | var e = (7 & t.charCodeAt(0)) << 18 | (63 & t.charCodeAt(1)) << 12 | (63 & t.charCodeAt(2)) << 6 | 63 & t.charCodeAt(3), 67 | i = e - 65536; 68 | return a((i >>> 10) + 55296) + a((1023 & i) + 56320); 69 | case 3: 70 | return a((15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2)); 71 | default: 72 | return a((31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1)) 73 | } 74 | }, 75 | v = function(t) { 76 | return t.replace(y, m) 77 | }, 78 | b = function(t) { 79 | var e = t.length, 80 | i = e % 4, 81 | n = (e > 0 ? o[t.charAt(0)] << 18 : 0) | (e > 1 ? o[t.charAt(1)] << 12 : 0) | (e > 2 ? o[t.charAt(2)] << 6 : 0) | (e > 3 ? o[t.charAt(3)] : 0), 82 | r = [a(n >>> 16), a(n >>> 8 & 255), a(255 & n)]; 83 | return r.length -= [0, 0, 2, 1][i], r.join("") 84 | }, 85 | _ = i.atob ? function(t) { 86 | return i.atob(t) 87 | } : function(t) { 88 | return t.replace(/[\s\S]{1,4}/g, b) 89 | }, 90 | w = e ? function(t) { 91 | return new e(t, "base64") 92 | .toString() 93 | } : function(t) { 94 | return v(_(t)) 95 | }, 96 | x = function(t) { 97 | return w(t.replace(/[-_]/g, function(t) { 98 | return "-" == t ? "+" : "/" 99 | }) 100 | .replace(/[^A-Za-z0-9\+\/]/g, "")) 101 | }, 102 | S = function() { 103 | var t = i.Base64; 104 | return i.Base64 = n, t 105 | }; 106 | if (i.Base64 = { 107 | VERSION: r, 108 | atob: _, 109 | btoa: f, 110 | fromBase64: x, 111 | toBase64: p, 112 | utob: h, 113 | encode: p, 114 | encodeURI: g, 115 | btou: v, 116 | decode: x, 117 | noConflict: S 118 | }, "function" == typeof Object.defineProperty) { 119 | var T = function(t) { 120 | return { 121 | value: t, 122 | enumerable: !1, 123 | writable: !0, 124 | configurable: !0 125 | } 126 | }; 127 | i.Base64.extendString = function() { 128 | Object.defineProperty(String.prototype, "fromBase64", T(function() { 129 | return x(this) 130 | })), Object.defineProperty(String.prototype, "toBase64", T(function(t) { 131 | return p(this, t) 132 | })), Object.defineProperty(String.prototype, "toBase64URI", T(function() { 133 | return p(this, !0) 134 | })) 135 | } 136 | } 137 | return t = i.Base64 138 | }(), security_crypto_200_lib_rsa = function(t) { 139 | function e(t, e, i) { 140 | null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e)) 141 | } 142 | 143 | function i() { 144 | return new e(null) 145 | } 146 | 147 | function n(t, e, i, n, r, s) { 148 | for (; --s >= 0;) { 149 | var o = e * this[t++] + i[n] + r; 150 | r = Math.floor(o / 67108864), i[n++] = 67108863 & o 151 | } 152 | return r 153 | } 154 | 155 | function r(t, e, i, n, r, s) { 156 | for (var o = 32767 & e, a = e >> 15; --s >= 0;) { 157 | var u = 32767 & this[t], 158 | c = this[t++] >> 15, 159 | h = a * u + c * o; 160 | u = o * u + ((32767 & h) << 15) + i[n] + (1073741823 & r), r = (u >>> 30) + (h >>> 15) + a * c + (r >>> 30), i[n++] = 1073741823 & u 161 | } 162 | return r 163 | } 164 | 165 | function s(t, e, i, n, r, s) { 166 | for (var o = 16383 & e, a = e >> 14; --s >= 0;) { 167 | var u = 16383 & this[t], 168 | c = this[t++] >> 14, 169 | h = a * u + c * o; 170 | u = o * u + ((16383 & h) << 14) + i[n] + r, r = (u >> 28) + (h >> 14) + a * c, i[n++] = 268435455 & u 171 | } 172 | return r 173 | } 174 | 175 | function o(t) { 176 | return Di.charAt(t) 177 | } 178 | 179 | function a(t, e) { 180 | var i = ki[t.charCodeAt(e)]; 181 | return null == i ? -1 : i 182 | } 183 | 184 | function u(t) { 185 | for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; 186 | t.t = this.t, t.s = this.s 187 | } 188 | 189 | function c(t) { 190 | this.t = 1, this.s = 0 > t ? -1 : 0, t > 0 ? this[0] = t : -1 > t ? this[0] = t + DV : this.t = 0 191 | } 192 | 193 | function h(t) { 194 | var e = i(); 195 | return e.fromInt(t), e 196 | } 197 | 198 | function l(t, i) { 199 | var n; 200 | if (16 == i) n = 4; 201 | else if (8 == i) n = 3; 202 | else if (256 == i) n = 8; 203 | else if (2 == i) n = 1; 204 | else if (32 == i) n = 5; 205 | else { 206 | if (4 != i) return void this.fromRadix(t, i); 207 | n = 2 208 | } 209 | this.t = 0, this.s = 0; 210 | for (var r = t.length, s = !1, o = 0; --r >= 0;) { 211 | var u = 8 == n ? 255 & t[r] : a(t, r); 212 | 0 > u ? "-" == t.charAt(r) && (s = !0) : (s = !1, 0 == o ? this[this.t++] = u : o + n > this.DB ? (this[this.t - 1] |= (u & (1 << this.DB - o) - 1) << o, this[this.t++] = u >> this.DB - o) : this[this.t - 1] |= u << o, o += n, o >= this.DB && (o -= this.DB)) 213 | } 214 | 8 == n && 0 != (128 & t[0]) && (this.s = -1, o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)), this.clamp(), s && e.ZERO.subTo(this, this) 215 | } 216 | 217 | function f() { 218 | for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t;) --this.t 219 | } 220 | 221 | function d(t) { 222 | if (this.s < 0) return "-" + this.negate() 223 | .toString(t); 224 | var e; 225 | if (16 == t) e = 4; 226 | else if (8 == t) e = 3; 227 | else if (2 == t) e = 1; 228 | else if (32 == t) e = 5; 229 | else { 230 | if (4 != t) return this.toRadix(t); 231 | e = 2 232 | } 233 | var i, n = (1 << e) - 1, 234 | r = !1, 235 | s = "", 236 | a = this.t, 237 | u = this.DB - a * this.DB % e; 238 | if (a-- > 0) 239 | for (u < this.DB && (i = this[a] >> u) > 0 && (r = !0, s = o(i)); a >= 0;) e > u ? (i = (this[a] & (1 << u) - 1) << e - u, i |= this[--a] >> (u += this.DB - e)) : (i = this[a] >> (u -= e) & n, 0 >= u && (u += this.DB, --a)), i > 0 && (r = !0), r && (s += o(i)); 240 | return r ? s : "0" 241 | } 242 | 243 | function p() { 244 | var t = i(); 245 | return e.ZERO.subTo(this, t), t 246 | } 247 | 248 | function g() { 249 | return this.s < 0 ? this.negate() : this 250 | } 251 | 252 | function y(t) { 253 | var e = this.s - t.s; 254 | if (0 != e) return e; 255 | var i = this.t; 256 | if (e = i - t.t, 0 != e) return this.s < 0 ? -e : e; 257 | for (; --i >= 0;) 258 | if (0 != (e = this[i] - t[i])) return e; 259 | return 0 260 | } 261 | 262 | function m(t) { 263 | var e, i = 1; 264 | return 0 != (e = t >>> 16) && (t = e, i += 16), 0 != (e = t >> 8) && (t = e, i += 8), 0 != (e = t >> 4) && (t = e, i += 4), 0 != (e = t >> 2) && (t = e, i += 2), 0 != (e = t >> 1) && (t = e, i += 1), i 265 | } 266 | 267 | function b() { 268 | return this.t <= 0 ? 0 : this.DB * (this.t - 1) + m(this[this.t - 1] ^ this.s & this.DM) 269 | } 270 | 271 | function _(t, e) { 272 | var i; 273 | for (i = this.t - 1; i >= 0; --i) e[i + t] = this[i]; 274 | for (i = t - 1; i >= 0; --i) e[i] = 0; 275 | e.t = this.t + t, e.s = this.s 276 | } 277 | 278 | function w(t, e) { 279 | for (var i = t; i < this.t; ++i) e[i - t] = this[i]; 280 | e.t = Math.max(this.t - t, 0), e.s = this.s 281 | } 282 | 283 | function x(t, e) { 284 | var i, n = t % this.DB, 285 | r = this.DB - n, 286 | s = (1 << r) - 1, 287 | o = Math.floor(t / this.DB), 288 | a = this.s << n & this.DM; 289 | for (i = this.t - 1; i >= 0; --i) e[i + o + 1] = this[i] >> r | a, a = (this[i] & s) << n; 290 | for (i = o - 1; i >= 0; --i) e[i] = 0; 291 | e[o] = a, e.t = this.t + o + 1, e.s = this.s, e.clamp() 292 | } 293 | 294 | function S(t, e) { 295 | e.s = this.s; 296 | var i = Math.floor(t / this.DB); 297 | if (i >= this.t) return void(e.t = 0); 298 | var n = t % this.DB, 299 | r = this.DB - n, 300 | s = (1 << n) - 1; 301 | e[0] = this[i] >> n; 302 | for (var o = i + 1; o < this.t; ++o) e[o - i - 1] |= (this[o] & s) << r, e[o - i] = this[o] >> n; 303 | n > 0 && (e[this.t - i - 1] |= (this.s & s) << r), e.t = this.t - i, e.clamp() 304 | } 305 | 306 | function T(t, e) { 307 | for (var i = 0, n = 0, r = Math.min(t.t, this.t); r > i;) n += this[i] - t[i], e[i++] = n & this.DM, n >>= this.DB; 308 | if (t.t < this.t) { 309 | for (n -= t.s; i < this.t;) n += this[i], e[i++] = n & this.DM, n >>= this.DB; 310 | n += this.s 311 | } else { 312 | for (n += this.s; i < t.t;) n -= t[i], e[i++] = n & this.DM, n >>= this.DB; 313 | n -= t.s 314 | } 315 | e.s = 0 > n ? -1 : 0, -1 > n ? e[i++] = this.DV + n : n > 0 && (e[i++] = n), e.t = i, e.clamp() 316 | } 317 | 318 | function E(t, i) { 319 | var n = this.abs(), 320 | r = t.abs(), 321 | s = n.t; 322 | for (i.t = s + r.t; --s >= 0;) i[s] = 0; 323 | for (s = 0; s < r.t; ++s) i[s + n.t] = n.am(0, r[s], i, s, 0, n.t); 324 | i.s = 0, i.clamp(), this.s != t.s && e.ZERO.subTo(i, i) 325 | } 326 | 327 | function R(t) { 328 | for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0;) t[i] = 0; 329 | for (i = 0; i < e.t - 1; ++i) { 330 | var n = e.am(i, e[i], t, 2 * i, 0, 1); 331 | (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, n, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1) 332 | } 333 | t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp() 334 | } 335 | 336 | function C(t, n, r) { 337 | var s = t.abs(); 338 | if (!(s.t <= 0)) { 339 | var o = this.abs(); 340 | if (o.t < s.t) return null != n && n.fromInt(0), void(null != r && this.copyTo(r)); 341 | null == r && (r = i()); 342 | var a = i(), 343 | u = this.s, 344 | c = t.s, 345 | h = this.DB - m(s[s.t - 1]); 346 | h > 0 ? (s.lShiftTo(h, a), o.lShiftTo(h, r)) : (s.copyTo(a), o.copyTo(r)); 347 | var l = a.t, 348 | f = a[l - 1]; 349 | if (0 != f) { 350 | var d = f * (1 << this.F1) + (l > 1 ? a[l - 2] >> this.F2 : 0), 351 | p = this.FV / d, 352 | g = (1 << this.F1) / d, 353 | y = 1 << this.F2, 354 | v = r.t, 355 | b = v - l, 356 | _ = null == n ? i() : n; 357 | for (a.dlShiftTo(b, _), r.compareTo(_) >= 0 && (r[r.t++] = 1, r.subTo(_, r)), e.ONE.dlShiftTo(l, _), _.subTo(a, a); a.t < l;) a[a.t++] = 0; 358 | for (; --b >= 0;) { 359 | var w = r[--v] == f ? this.DM : Math.floor(r[v] * p + (r[v - 1] + y) * g); 360 | if ((r[v] += a.am(0, w, r, b, 0, l)) < w) 361 | for (a.dlShiftTo(b, _), r.subTo(_, r); r[v] < --w;) r.subTo(_, r) 362 | } 363 | null != n && (r.drShiftTo(l, n), u != c && e.ZERO.subTo(n, n)), r.t = l, r.clamp(), h > 0 && r.rShiftTo(h, r), 0 > u && e.ZERO.subTo(r, r) 364 | } 365 | } 366 | } 367 | 368 | function A(t) { 369 | var n = i(); 370 | return this.abs() 371 | .divRemTo(t, null, n), this.s < 0 && n.compareTo(e.ZERO) > 0 && t.subTo(n, n), n 372 | } 373 | 374 | function D(t) { 375 | this.m = t 376 | } 377 | 378 | function k(t) { 379 | return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t 380 | } 381 | 382 | function I(t) { 383 | return t 384 | } 385 | 386 | function O(t) { 387 | t.divRemTo(this.m, null, t) 388 | } 389 | 390 | function B(t, e, i) { 391 | t.multiplyTo(e, i), this.reduce(i) 392 | } 393 | 394 | function U(t, e) { 395 | t.squareTo(e), this.reduce(e) 396 | } 397 | 398 | function P() { 399 | if (this.t < 1) return 0; 400 | var t = this[0]; 401 | if (0 == (1 & t)) return 0; 402 | var e = 3 & t; 403 | return e = e * (2 - (15 & t) * e) & 15, e = e * (2 - (255 & t) * e) & 255, e = e * (2 - ((65535 & t) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e 404 | } 405 | 406 | function N(t) { 407 | this.m = t, this.mp = t.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t 408 | } 409 | 410 | function K(t) { 411 | var n = i(); 412 | return t.abs() 413 | .dlShiftTo(this.m.t, n), n.divRemTo(this.m, null, n), t.s < 0 && n.compareTo(e.ZERO) > 0 && this.m.subTo(n, n), n 414 | } 415 | 416 | function M(t) { 417 | var e = i(); 418 | return t.copyTo(e), this.reduce(e), e 419 | } 420 | 421 | function V(t) { 422 | for (; t.t <= this.mt2;) t[t.t++] = 0; 423 | for (var e = 0; e < this.m.t; ++e) { 424 | var i = 32767 & t[e], 425 | n = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; 426 | for (i = e + this.m.t, t[i] += this.m.am(0, n, t, e, 0, this.m.t); t[i] >= t.DV;) t[i] -= t.DV, t[++i]++ 427 | } 428 | t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t) 429 | } 430 | 431 | function j(t, e) { 432 | t.squareTo(e), this.reduce(e) 433 | } 434 | 435 | function J(t, e, i) { 436 | t.multiplyTo(e, i), this.reduce(i) 437 | } 438 | 439 | function L() { 440 | return 0 == (this.t > 0 ? 1 & this[0] : this.s) 441 | } 442 | 443 | function q(t, n) { 444 | if (t > 4294967295 || 1 > t) return e.ONE; 445 | var r = i(), 446 | s = i(), 447 | o = n.convert(this), 448 | a = m(t) - 1; 449 | for (o.copyTo(r); --a >= 0;) 450 | if (n.sqrTo(r, s), (t & 1 << a) > 0) n.mulTo(s, o, r); 451 | else { 452 | var u = r; 453 | r = s, s = u 454 | } return n.revert(r) 455 | } 456 | 457 | function H(t, e) { 458 | var i; 459 | return i = 256 > t || e.isEven() ? new D(e) : new N(e), this.exp(t, i) 460 | } 461 | 462 | function F() { 463 | var t = i(); 464 | return this.copyTo(t), t 465 | } 466 | 467 | function z() { 468 | if (this.s < 0) { 469 | if (1 == this.t) return this[0] - this.DV; 470 | if (0 == this.t) return -1 471 | } else { 472 | if (1 == this.t) return this[0]; 473 | if (0 == this.t) return 0 474 | } 475 | return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] 476 | } 477 | 478 | function G() { 479 | return 0 == this.t ? this.s : this[0] << 24 >> 24 480 | } 481 | 482 | function W() { 483 | return 0 == this.t ? this.s : this[0] << 16 >> 16 484 | } 485 | 486 | function Z(t) { 487 | return Math.floor(Math.LN2 * this.DB / Math.log(t)) 488 | } 489 | 490 | function Q() { 491 | return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1 492 | } 493 | 494 | function $(t) { 495 | if (null == t && (t = 10), 0 == this.signum() || 2 > t || t > 36) return "0"; 496 | var e = this.chunkSize(t), 497 | n = Math.pow(t, e), 498 | r = h(n), 499 | s = i(), 500 | o = i(), 501 | a = ""; 502 | for (this.divRemTo(r, s, o); s.signum() > 0;) a = (n + o.intValue()) 503 | .toString(t) 504 | .substr(1) + a, s.divRemTo(r, s, o); 505 | return o.intValue() 506 | .toString(t) + a 507 | } 508 | 509 | function X(t, i) { 510 | this.fromInt(0), null == i && (i = 10); 511 | for (var n = this.chunkSize(i), r = Math.pow(i, n), s = !1, o = 0, u = 0, c = 0; c < t.length; ++c) { 512 | var h = a(t, c); 513 | 0 > h ? "-" == t.charAt(c) && 0 == this.signum() && (s = !0) : (u = i * u + h, ++o >= n && (this.dMultiply(r), this.dAddOffset(u, 0), o = 0, u = 0)) 514 | } 515 | o > 0 && (this.dMultiply(Math.pow(i, o)), this.dAddOffset(u, 0)), s && e.ZERO.subTo(this, this) 516 | } 517 | 518 | function Y(t, i, n) { 519 | if ("number" == typeof i) 520 | if (2 > t) this.fromInt(1); 521 | else 522 | for (this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), ae, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(i);) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(e.ONE.shiftLeft(t - 1), this); 523 | else { 524 | var r = new Array, 525 | s = 7 & t; 526 | r.length = (t >> 3) + 1, i.nextBytes(r), s > 0 ? r[0] &= (1 << s) - 1 : r[0] = 0, this.fromString(r, 256) 527 | } 528 | } 529 | 530 | function te() { 531 | var t = this.t, 532 | e = new Array; 533 | e[0] = this.s; 534 | var i, n = this.DB - t * this.DB % 8, 535 | r = 0; 536 | if (t-- > 0) 537 | for (n < this.DB && (i = this[t] >> n) != (this.s & this.DM) >> n && (e[r++] = i | this.s << this.DB - n); t >= 0;) 8 > n ? (i = (this[t] & (1 << n) - 1) << 8 - n, i |= this[--t] >> (n += this.DB - 8)) : (i = this[t] >> (n -= 8) & 255, 0 >= n && (n += this.DB, --t)), 0 != (128 & i) && (i |= -256), 0 == r && (128 & this.s) != (128 & i) && ++r, (r > 0 || i != this.s) && (e[r++] = i); 538 | return e 539 | } 540 | 541 | function ee(t) { 542 | return 0 == this.compareTo(t) 543 | } 544 | 545 | function ie(t) { 546 | return this.compareTo(t) < 0 ? this : t 547 | } 548 | 549 | function ne(t) { 550 | return this.compareTo(t) > 0 ? this : t 551 | } 552 | 553 | function re(t, e, i) { 554 | var n, r, s = Math.min(t.t, this.t); 555 | for (n = 0; s > n; ++n) i[n] = e(this[n], t[n]); 556 | if (t.t < this.t) { 557 | for (r = t.s & this.DM, n = s; n < this.t; ++n) i[n] = e(this[n], r); 558 | i.t = this.t 559 | } else { 560 | for (r = this.s & this.DM, n = s; n < t.t; ++n) i[n] = e(r, t[n]); 561 | i.t = t.t 562 | } 563 | i.s = e(this.s, t.s), i.clamp() 564 | } 565 | 566 | function se(t, e) { 567 | return t & e 568 | } 569 | 570 | function oe(t) { 571 | var e = i(); 572 | return this.bitwiseTo(t, se, e), e 573 | } 574 | 575 | function ae(t, e) { 576 | return t | e 577 | } 578 | 579 | function ue(t) { 580 | var e = i(); 581 | return this.bitwiseTo(t, ae, e), e 582 | } 583 | 584 | function ce(t, e) { 585 | return t ^ e 586 | } 587 | 588 | function he(t) { 589 | var e = i(); 590 | return this.bitwiseTo(t, ce, e), e 591 | } 592 | 593 | function le(t, e) { 594 | return t & ~e 595 | } 596 | 597 | function fe(t) { 598 | var e = i(); 599 | return this.bitwiseTo(t, le, e), e 600 | } 601 | 602 | function de() { 603 | for (var t = i(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e]; 604 | return t.t = this.t, t.s = ~this.s, t 605 | } 606 | 607 | function pe(t) { 608 | var e = i(); 609 | return 0 > t ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e 610 | } 611 | 612 | function ge(t) { 613 | var e = i(); 614 | return 0 > t ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e 615 | } 616 | 617 | function ye(t) { 618 | if (0 == t) return -1; 619 | var e = 0; 620 | return 0 == (65535 & t) && (t >>= 16, e += 16), 0 == (255 & t) && (t >>= 8, e += 8), 0 == (15 & t) && (t >>= 4, e += 4), 0 == (3 & t) && (t >>= 2, e += 2), 0 == (1 & t) && ++e, e 621 | } 622 | 623 | function me() { 624 | for (var t = 0; t < this.t; ++t) 625 | if (0 != this[t]) return t * this.DB + ye(this[t]); 626 | return this.s < 0 ? this.t * this.DB : -1 627 | } 628 | 629 | function ve(t) { 630 | for (var e = 0; 0 != t;) t &= t - 1, ++e; 631 | return e 632 | } 633 | 634 | function be() { 635 | for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) t += ve(this[i] ^ e); 636 | return t 637 | } 638 | 639 | function _e(t) { 640 | var e = Math.floor(t / this.DB); 641 | return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB) 642 | } 643 | 644 | function we(t, i) { 645 | var n = e.ONE.shiftLeft(t); 646 | return this.bitwiseTo(n, i, n), n 647 | } 648 | 649 | function xe(t) { 650 | return this.changeBit(t, ae) 651 | } 652 | 653 | function Se(t) { 654 | return this.changeBit(t, le) 655 | } 656 | 657 | function Te(t) { 658 | return this.changeBit(t, ce) 659 | } 660 | 661 | function Ee(t, e) { 662 | for (var i = 0, n = 0, r = Math.min(t.t, this.t); r > i;) n += this[i] + t[i], e[i++] = n & this.DM, n >>= this.DB; 663 | if (t.t < this.t) { 664 | for (n += t.s; i < this.t;) n += this[i], e[i++] = n & this.DM, n >>= this.DB; 665 | n += this.s 666 | } else { 667 | for (n += this.s; i < t.t;) n += t[i], e[i++] = n & this.DM, n >>= this.DB; 668 | n += t.s 669 | } 670 | e.s = 0 > n ? -1 : 0, n > 0 ? e[i++] = n : -1 > n && (e[i++] = this.DV + n), e.t = i, e.clamp() 671 | } 672 | 673 | function Re(t) { 674 | var e = i(); 675 | return this.addTo(t, e), e 676 | } 677 | 678 | function Ce(t) { 679 | var e = i(); 680 | return this.subTo(t, e), e 681 | } 682 | 683 | function Ae(t) { 684 | var e = i(); 685 | return this.multiplyTo(t, e), e 686 | } 687 | 688 | function De() { 689 | var t = i(); 690 | return this.squareTo(t), t 691 | } 692 | 693 | function ke(t) { 694 | var e = i(); 695 | return this.divRemTo(t, e, null), e 696 | } 697 | 698 | function Ie(t) { 699 | var e = i(); 700 | return this.divRemTo(t, null, e), e 701 | } 702 | 703 | function Oe(t) { 704 | var e = i(), 705 | n = i(); 706 | return this.divRemTo(t, e, n), new Array(e, n) 707 | } 708 | 709 | function Be(t) { 710 | this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp() 711 | } 712 | 713 | function Ue(t, e) { 714 | if (0 != t) { 715 | for (; this.t <= e;) this[this.t++] = 0; 716 | for (this[e] += t; this[e] >= this.DV;) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e] 717 | } 718 | } 719 | 720 | function Pe() {} 721 | 722 | function Ne(t) { 723 | return t 724 | } 725 | 726 | function Ke(t, e, i) { 727 | t.multiplyTo(e, i) 728 | } 729 | 730 | function Me(t, e) { 731 | t.squareTo(e) 732 | } 733 | 734 | function Ve(t) { 735 | return this.exp(t, new Pe) 736 | } 737 | 738 | function je(t, e, i) { 739 | var n = Math.min(this.t + t.t, e); 740 | for (i.s = 0, i.t = n; n > 0;) i[--n] = 0; 741 | var r; 742 | for (r = i.t - this.t; r > n; ++n) i[n + this.t] = this.am(0, t[n], i, n, 0, this.t); 743 | for (r = Math.min(t.t, e); r > n; ++n) this.am(0, t[n], i, n, 0, e - n); 744 | i.clamp() 745 | } 746 | 747 | function Je(t, e, i) { 748 | --e; 749 | var n = i.t = this.t + t.t - e; 750 | for (i.s = 0; --n >= 0;) i[n] = 0; 751 | for (n = Math.max(e - this.t, 0); n < t.t; ++n) i[this.t + n - e] = this.am(e - n, t[n], i, 0, 0, this.t + n - e); 752 | i.clamp(), i.drShiftTo(1, i) 753 | } 754 | 755 | function Le(t) { 756 | this.r2 = i(), this.q3 = i(), e.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t 757 | } 758 | 759 | function qe(t) { 760 | if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m); 761 | if (t.compareTo(this.m) < 0) return t; 762 | var e = i(); 763 | return t.copyTo(e), this.reduce(e), e 764 | } 765 | 766 | function He(t) { 767 | return t 768 | } 769 | 770 | function Fe(t) { 771 | for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0;) t.dAddOffset(1, this.m.t + 1); 772 | for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0;) t.subTo(this.m, t) 773 | } 774 | 775 | function ze(t, e) { 776 | t.squareTo(e), this.reduce(e) 777 | } 778 | 779 | function Ge(t, e, i) { 780 | t.multiplyTo(e, i), this.reduce(i) 781 | } 782 | 783 | function We(t, e) { 784 | var n, r, s = t.bitLength(), 785 | o = h(1); 786 | if (0 >= s) return o; 787 | n = 18 > s ? 1 : 48 > s ? 3 : 144 > s ? 4 : 768 > s ? 5 : 6, r = 8 > s ? new D(e) : e.isEven() ? new Le(e) : new N(e); 788 | var a = new Array, 789 | u = 3, 790 | c = n - 1, 791 | l = (1 << n) - 1; 792 | if (a[1] = r.convert(this), n > 1) { 793 | var f = i(); 794 | for (r.sqrTo(a[1], f); l >= u;) a[u] = i(), r.mulTo(f, a[u - 2], a[u]), u += 2 795 | } 796 | var d, p, g = t.t - 1, 797 | y = !0, 798 | v = i(); 799 | for (s = m(t[g]) - 1; g >= 0;) { 800 | for (s >= c ? d = t[g] >> s - c & l : (d = (t[g] & (1 << s + 1) - 1) << c - s, g > 0 && (d |= t[g - 1] >> this.DB + s - c)), u = n; 0 == (1 & d);) d >>= 1, --u; 801 | if ((s -= u) < 0 && (s += this.DB, --g), y) a[d].copyTo(o), y = !1; 802 | else { 803 | for (; u > 1;) r.sqrTo(o, v), r.sqrTo(v, o), u -= 2; 804 | u > 0 ? r.sqrTo(o, v) : (p = o, o = v, v = p), r.mulTo(v, a[d], o) 805 | } 806 | for (; g >= 0 && 0 == (t[g] & 1 << s);) r.sqrTo(o, v), p = o, o = v, v = p, --s < 0 && (s = this.DB - 1, --g) 807 | } 808 | return r.revert(o) 809 | } 810 | 811 | function Ze(t) { 812 | var e = this.s < 0 ? this.negate() : this.clone(), 813 | i = t.s < 0 ? t.negate() : t.clone(); 814 | if (e.compareTo(i) < 0) { 815 | var n = e; 816 | e = i, i = n 817 | } 818 | var r = e.getLowestSetBit(), 819 | s = i.getLowestSetBit(); 820 | if (0 > s) return e; 821 | for (s > r && (s = r), s > 0 && (e.rShiftTo(s, e), i.rShiftTo(s, i)); e.signum() > 0;)(r = e.getLowestSetBit()) > 0 && e.rShiftTo(r, e), (r = i.getLowestSetBit()) > 0 && i.rShiftTo(r, i), e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i)); 822 | return s > 0 && i.lShiftTo(s, i), i 823 | } 824 | 825 | function Qe(t) { 826 | if (0 >= t) return 0; 827 | var e = this.DV % t, 828 | i = this.s < 0 ? t - 1 : 0; 829 | if (this.t > 0) 830 | if (0 == e) i = this[0] % t; 831 | else 832 | for (var n = this.t - 1; n >= 0; --n) i = (e * i + this[n]) % t; 833 | return i 834 | } 835 | 836 | function $e(t) { 837 | var i = t.isEven(); 838 | if (this.isEven() && i || 0 == t.signum()) return e.ZERO; 839 | for (var n = t.clone(), r = this.clone(), s = h(1), o = h(0), a = h(0), u = h(1); 0 != n.signum();) { 840 | for (; n.isEven();) n.rShiftTo(1, n), i ? (s.isEven() && o.isEven() || (s.addTo(this, s), o.subTo(t, o)), s.rShiftTo(1, s)) : o.isEven() || o.subTo(t, o), o.rShiftTo(1, o); 841 | for (; r.isEven();) r.rShiftTo(1, r), i ? (a.isEven() && u.isEven() || (a.addTo(this, a), u.subTo(t, u)), a.rShiftTo(1, a)) : u.isEven() || u.subTo(t, u), u.rShiftTo(1, u); 842 | n.compareTo(r) >= 0 ? (n.subTo(r, n), i && s.subTo(a, s), o.subTo(u, o)) : (r.subTo(n, r), i && a.subTo(s, a), u.subTo(o, u)) 843 | } 844 | return 0 != r.compareTo(e.ONE) ? e.ZERO : u.compareTo(t) >= 0 ? u.subtract(t) : u.signum() < 0 ? (u.addTo(t, u), u.signum() < 0 ? u.add(t) : u) : u 845 | } 846 | 847 | function Xe(t) { 848 | var e, i = this.abs(); 849 | if (1 == i.t && i[0] <= Ii[Ii.length - 1]) { 850 | for (e = 0; e < Ii.length; ++e) 851 | if (i[0] == Ii[e]) return !0; 852 | return !1 853 | } 854 | if (i.isEven()) return !1; 855 | for (e = 1; e < Ii.length;) { 856 | for (var n = Ii[e], r = e + 1; r < Ii.length && Oi > n;) n *= Ii[r++]; 857 | for (n = i.modInt(n); r > e;) 858 | if (n % Ii[e++] == 0) return !1 859 | } 860 | return i.millerRabin(t) 861 | } 862 | 863 | function Ye(t) { 864 | var n = this.subtract(e.ONE), 865 | r = n.getLowestSetBit(); 866 | if (0 >= r) return !1; 867 | var s = n.shiftRight(r); 868 | t = t + 1 >> 1, t > Ii.length && (t = Ii.length); 869 | for (var o = i(), a = 0; t > a; ++a) { 870 | o.fromInt(Ii[Math.floor(Math.random() * Ii.length)]); 871 | var u = o.modPow(s, this); 872 | if (0 != u.compareTo(e.ONE) && 0 != u.compareTo(n)) { 873 | for (var c = 1; c++ < r && 0 != u.compareTo(n);) 874 | if (u = u.modPowInt(2, this), 0 == u.compareTo(e.ONE)) return !1; 875 | if (0 != u.compareTo(n)) return !1 876 | } 877 | } 878 | return !0 879 | } 880 | 881 | function ti() { 882 | this.i = 0, this.j = 0, this.S = new Array 883 | } 884 | 885 | function ei(t) { 886 | var e, i, n; 887 | for (e = 0; 256 > e; ++e) this.S[e] = e; 888 | for (i = 0, e = 0; 256 > e; ++e) i = i + this.S[e] + t[e % t.length] & 255, n = this.S[e], this.S[e] = this.S[i], this.S[i] = n; 889 | this.i = 0, this.j = 0 890 | } 891 | 892 | function ii() { 893 | var t; 894 | return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255] 895 | } 896 | 897 | function ni() { 898 | return new ti 899 | } 900 | 901 | function ri() { 902 | if (null == Bi) { 903 | for (Bi = ni(); Ni > Pi;) { 904 | var t = Math.floor(65536 * Math.random()); 905 | Ui[Pi++] = 255 & t 906 | } 907 | for (Bi.init(Ui), Pi = 0; Pi < Ui.length; ++Pi) Ui[Pi] = 0; 908 | Pi = 0 909 | } 910 | return Bi.next() 911 | } 912 | 913 | function si(t) { 914 | var e; 915 | for (e = 0; e < t.length; ++e) t[e] = ri() 916 | } 917 | 918 | function oi() {} 919 | 920 | function ai(t, i) { 921 | return new e(t, i) 922 | } 923 | 924 | function ui(t, i) { 925 | if (i < t.length + 11) return console.error("Message too long for RSA"), null; 926 | for (var n = new Array, r = t.length - 1; r >= 0 && i > 0;) { 927 | var s = t.charCodeAt(r--); 928 | 128 > s ? n[--i] = s : s > 127 && 2048 > s ? (n[--i] = 63 & s | 128, n[--i] = s >> 6 | 192) : (n[--i] = 63 & s | 128, n[--i] = s >> 6 & 63 | 128, n[--i] = s >> 12 | 224) 929 | } 930 | n[--i] = 0; 931 | for (var o = new oi, a = new Array; i > 2;) { 932 | for (a[0] = 0; 0 == a[0];) o.nextBytes(a); 933 | n[--i] = a[0] 934 | } 935 | return n[--i] = 2, n[--i] = 0, new e(n) 936 | } 937 | 938 | function ci() { 939 | this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null 940 | } 941 | 942 | function hi(t, e) { 943 | null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ai(t, 16), this.e = parseInt(e, 16)) : console.error("Invalid RSA public key") 944 | } 945 | 946 | function li(t) { 947 | return t.modPowInt(this.e, this.n) 948 | } 949 | 950 | function fi(t) { 951 | var e = ui(t, this.n.bitLength() + 7 >> 3); 952 | if (null == e) return null; 953 | var i = this.doPublic(e); 954 | if (null == i) return null; 955 | var n = i.toString(16); 956 | return 0 == (1 & n.length) ? n : "0" + n 957 | } 958 | 959 | function di(t, i, n) { 960 | for (var r = [Number(t)], s = pi(i, 32), o = pi("", 12), a = pi(n, 200), u = this.n.bitLength() + 7 >> 3, c = [], h = r.concat(s) 961 | .concat(o) 962 | .concat(a), l = h.length - 1; l >= 0 && u > 0;) c[--u] = h[l--]; 963 | c[--u] = 0; 964 | for (var f = new oi, d = new Array; u > 2;) { 965 | for (d[0] = 0; 0 == d[0];) f.nextBytes(d); 966 | c[--u] = d[0] 967 | } 968 | c[--u] = 2, c[--u] = 0; 969 | var p = new e(c); 970 | if (null == p) return null; 971 | var g = this.doPublic(p); 972 | if (null == g) return null; 973 | var y = g.toString(16); 974 | return 0 == (1 & y.length) ? y : "0" + y 975 | } 976 | 977 | function pi(t, e) { 978 | for (var i = [], n = 0, r = t.length; r > n; n++) { 979 | var s = t.charCodeAt(n); 980 | 128 > s ? i.push(s) : s > 127 && 2048 > s ? (i.push(63 & s | 128), i.push(s >> 6 | 192)) : (i.push(63 & s | 128), i.push(s >> 6 & 63 | 128), i.push(s >> 12 | 224)) 981 | } 982 | var r = e - t.length; 983 | if (r > 0) 984 | for (var n = 0; r > n; n++) i.push(0); 985 | return i 986 | } 987 | 988 | function gi(t, e) { 989 | for (var i = t.toByteArray(), n = 0; n < i.length && 0 == i[n];) ++n; 990 | if (i.length - n != e - 1 || 2 != i[n]) return null; 991 | for (++n; 0 != i[n];) 992 | if (++n >= i.length) return null; 993 | for (var r = ""; ++n < i.length;) { 994 | var s = 255 & i[n]; 995 | 128 > s ? r += String.fromCharCode(s) : s > 191 && 224 > s ? (r += String.fromCharCode((31 & s) << 6 | 63 & i[n + 1]), ++n) : (r += String.fromCharCode((15 & s) << 12 | (63 & i[n + 1]) << 6 | 63 & i[n + 2]), n += 2) 996 | } 997 | return r 998 | } 999 | 1000 | function yi(t, e, i) { 1001 | null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ai(t, 16), this.e = parseInt(e, 16), this.d = ai(i, 16)) : console.error("Invalid RSA private key") 1002 | } 1003 | 1004 | function mi(t, e, i, n, r, s, o, a) { 1005 | null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ai(t, 16), this.e = parseInt(e, 16), this.d = ai(i, 16), this.p = ai(n, 16), this.q = ai(r, 16), this.dmp1 = ai(s, 16), this.dmq1 = ai(o, 16), this.coeff = ai(a, 16)) : console.error("Invalid RSA private key") 1006 | } 1007 | 1008 | function vi(t, i) { 1009 | var n = new oi, 1010 | r = t >> 1; 1011 | this.e = parseInt(i, 16); 1012 | for (var s = new e(i, 16);;) { 1013 | for (; this.p = new e(t - r, 1, n), 0 != this.p.subtract(e.ONE) 1014 | .gcd(s) 1015 | .compareTo(e.ONE) || !this.p.isProbablePrime(10);); 1016 | for (; this.q = new e(r, 1, n), 0 != this.q.subtract(e.ONE) 1017 | .gcd(s) 1018 | .compareTo(e.ONE) || !this.q.isProbablePrime(10);); 1019 | if (this.p.compareTo(this.q) <= 0) { 1020 | var o = this.p; 1021 | this.p = this.q, this.q = o 1022 | } 1023 | var a = this.p.subtract(e.ONE), 1024 | u = this.q.subtract(e.ONE), 1025 | c = a.multiply(u); 1026 | if (0 == c.gcd(s) 1027 | .compareTo(e.ONE)) { 1028 | this.n = this.p.multiply(this.q), this.d = s.modInverse(c), this.dmp1 = this.d.mod(a), this.dmq1 = this.d.mod(u), this.coeff = this.q.modInverse(this.p); 1029 | break 1030 | } 1031 | } 1032 | } 1033 | 1034 | function bi(t) { 1035 | if (null == this.p || null == this.q) return t.modPow(this.d, this.n); 1036 | for (var e = t.mod(this.p) 1037 | .modPow(this.dmp1, this.p), i = t.mod(this.q) 1038 | .modPow(this.dmq1, this.q); e.compareTo(i) < 0;) e = e.add(this.p); 1039 | return e.subtract(i) 1040 | .multiply(this.coeff) 1041 | .mod(this.p) 1042 | .multiply(this.q) 1043 | .add(i) 1044 | } 1045 | 1046 | function _i(t) { 1047 | var e = ai(t, 16), 1048 | i = this.doPrivate(e); 1049 | return null == i ? null : gi(i, this.n.bitLength() + 7 >> 3) 1050 | } 1051 | 1052 | function wi(t) { 1053 | var e, i, n = ""; 1054 | for (e = 0; e + 3 <= t.length; e += 3) i = parseInt(t.substring(e, e + 3), 16), n += ji.charAt(i >> 6) + ji.charAt(63 & i); 1055 | for (e + 1 == t.length ? (i = parseInt(t.substring(e, e + 1), 16), n += ji.charAt(i << 2)) : e + 2 == t.length && (i = parseInt(t.substring(e, e + 2), 16), n += ji.charAt(i >> 2) + ji.charAt((3 & i) << 4)); 1056 | (3 & n.length) > 0;) n += Ji; 1057 | return n 1058 | } 1059 | 1060 | function xi(t) { 1061 | var e, i, n = "", 1062 | r = 0; 1063 | for (e = 0; e < t.length && t.charAt(e) != Ji; ++e) v = ji.indexOf(t.charAt(e)), 0 > v || (0 == r ? (n += o(v >> 2), i = 3 & v, r = 1) : 1 == r ? (n += o(i << 2 | v >> 4), i = 15 & v, r = 2) : 2 == r ? (n += o(i), n += o(v >> 2), i = 3 & v, r = 3) : (n += o(i << 2 | v >> 4), n += o(15 & v), r = 0)); 1064 | return 1 == r && (n += o(i << 2)), n 1065 | } 1066 | var Si, Ti = 0xdeadbeefcafe, 1067 | Ei = 15715070 == (16777215 & Ti); 1068 | Ei && "Microsoft Internet Explorer" == navigator.appName ? (e.prototype.am = r, Si = 30) : Ei && "Netscape" != navigator.appName ? (e.prototype.am = n, Si = 26) : (e.prototype.am = s, Si = 28), e.prototype.DB = Si, e.prototype.DM = (1 << Si) - 1, e.prototype.DV = 1 << Si; 1069 | var Ri = 52; 1070 | e.prototype.FV = Math.pow(2, Ri), e.prototype.F1 = Ri - Si, e.prototype.F2 = 2 * Si - Ri; 1071 | var Ci, Ai, Di = "0123456789abcdefghijklmnopqrstuvwxyz", 1072 | ki = new Array; 1073 | for (Ci = "0".charCodeAt(0), Ai = 0; 9 >= Ai; ++Ai) ki[Ci++] = Ai; 1074 | for (Ci = "a".charCodeAt(0), Ai = 10; 36 > Ai; ++Ai) ki[Ci++] = Ai; 1075 | for (Ci = "A".charCodeAt(0), Ai = 10; 36 > Ai; ++Ai) ki[Ci++] = Ai; 1076 | D.prototype.convert = k, D.prototype.revert = I, D.prototype.reduce = O, D.prototype.mulTo = B, D.prototype.sqrTo = U, N.prototype.convert = K, N.prototype.revert = M, N.prototype.reduce = V, N.prototype.mulTo = J, N.prototype.sqrTo = j, e.prototype.copyTo = u, e.prototype.fromInt = c, e.prototype.fromString = l, e.prototype.clamp = f, e.prototype.dlShiftTo = _, e.prototype.drShiftTo = w, e.prototype.lShiftTo = x, e.prototype.rShiftTo = S, e.prototype.subTo = T, e.prototype.multiplyTo = E, e.prototype.squareTo = R, e.prototype.divRemTo = C, e.prototype.invDigit = P, e.prototype.isEven = L, e.prototype.exp = q, e.prototype.toString = d, e.prototype.negate = p, e.prototype.abs = g, e.prototype.compareTo = y, e.prototype.bitLength = b, e.prototype.mod = A, e.prototype.modPowInt = H, e.ZERO = h(0), e.ONE = h(1), Pe.prototype.convert = Ne, Pe.prototype.revert = Ne, Pe.prototype.mulTo = Ke, Pe.prototype.sqrTo = Me, Le.prototype.convert = qe, Le.prototype.revert = He, Le.prototype.reduce = Fe, Le.prototype.mulTo = Ge, Le.prototype.sqrTo = ze; 1077 | var Ii = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], 1078 | Oi = (1 << 26) / Ii[Ii.length - 1]; 1079 | e.prototype.chunkSize = Z, e.prototype.toRadix = $, e.prototype.fromRadix = X, e.prototype.fromNumber = Y, e.prototype.bitwiseTo = re, e.prototype.changeBit = we, e.prototype.addTo = Ee, e.prototype.dMultiply = Be, e.prototype.dAddOffset = Ue, e.prototype.multiplyLowerTo = je, e.prototype.multiplyUpperTo = Je, e.prototype.modInt = Qe, e.prototype.millerRabin = Ye, e.prototype.clone = F, e.prototype.intValue = z, e.prototype.byteValue = G, e.prototype.shortValue = W, e.prototype.signum = Q, e.prototype.toByteArray = te, e.prototype.equals = ee, e.prototype.min = ie, e.prototype.max = ne, e.prototype.and = oe, e.prototype.or = ue, e.prototype.xor = he, e.prototype.andNot = fe, e.prototype.not = de, e.prototype.shiftLeft = pe, e.prototype.shiftRight = ge, e.prototype.getLowestSetBit = me, e.prototype.bitCount = be, e.prototype.testBit = _e, e.prototype.setBit = xe, e.prototype.clearBit = Se, e.prototype.flipBit = Te, e.prototype.add = Re, e.prototype.subtract = Ce, e.prototype.multiply = Ae, e.prototype.divide = ke, e.prototype.remainder = Ie, e.prototype.divideAndRemainder = Oe, e.prototype.modPow = We, e.prototype.modInverse = $e, e.prototype.pow = Ve, e.prototype.gcd = Ze, e.prototype.isProbablePrime = Xe, e.prototype.square = De, ti.prototype.init = ei, ti.prototype.next = ii; 1080 | var Bi, Ui, Pi, Ni = 256; 1081 | if (null == Ui) { 1082 | Ui = new Array, Pi = 0; 1083 | var Ki; 1084 | if (window.crypto && window.crypto.getRandomValues) { 1085 | var Mi = new Uint32Array(256); 1086 | for (window.crypto.getRandomValues(Mi), Ki = 0; Ki < Mi.length; ++Ki) Ui[Pi++] = 255 & Mi[Ki] 1087 | } 1088 | var Vi = function(t) { 1089 | if (this.count = this.count || 0, this.count >= 256 || Pi >= Ni) return void(window.removeEventListener ? window.removeEventListener("mousemove", Vi) : window.detachEvent && window.detachEvent("onmousemove", Vi)); 1090 | this.count += 1; 1091 | var e = t.x + t.y; 1092 | Ui[Pi++] = 255 & e 1093 | }; 1094 | window.addEventListener ? window.addEventListener("mousemove", Vi) : window.attachEvent && window.attachEvent("onmousemove", Vi) 1095 | } 1096 | oi.prototype.nextBytes = si, ci.prototype.doPublic = li, ci.prototype.setPublic = hi, ci.prototype.encrypt = fi, ci.prototype.alipayEncrypt = di, ci.prototype.doPrivate = bi, ci.prototype.setPrivate = yi, ci.prototype.setPrivateEx = mi, ci.prototype.generate = vi, ci.prototype.decrypt = _i, 1097 | function() { 1098 | var t = function(t, n, r) { 1099 | var s = new oi, 1100 | o = t >> 1; 1101 | this.e = parseInt(n, 16); 1102 | var a = new e(n, 16), 1103 | u = this, 1104 | c = function() { 1105 | var n = function() { 1106 | if (u.p.compareTo(u.q) <= 0) { 1107 | var t = u.p; 1108 | u.p = u.q, u.q = t 1109 | } 1110 | var i = u.p.subtract(e.ONE), 1111 | n = u.q.subtract(e.ONE), 1112 | s = i.multiply(n); 1113 | 0 == s.gcd(a) 1114 | .compareTo(e.ONE) ? (u.n = u.p.multiply(u.q), u.d = a.modInverse(s), u.dmp1 = u.d.mod(i), u.dmq1 = u.d.mod(n), u.coeff = u.q.modInverse(u.p), setTimeout(function() { 1115 | r() 1116 | }, 0)) : setTimeout(c, 0) 1117 | }, 1118 | h = function() { 1119 | u.q = i(), u.q.fromNumberAsync(o, 1, s, function() { 1120 | u.q.subtract(e.ONE) 1121 | .gcda(a, function(t) { 1122 | 0 == t.compareTo(e.ONE) && u.q.isProbablePrime(10) ? setTimeout(n, 0) : setTimeout(h, 0) 1123 | }) 1124 | }) 1125 | }, 1126 | l = function() { 1127 | u.p = i(), u.p.fromNumberAsync(t - o, 1, s, function() { 1128 | u.p.subtract(e.ONE) 1129 | .gcda(a, function(t) { 1130 | 0 == t.compareTo(e.ONE) && u.p.isProbablePrime(10) ? setTimeout(h, 0) : setTimeout(l, 0) 1131 | }) 1132 | }) 1133 | }; 1134 | setTimeout(l, 0) 1135 | }; 1136 | setTimeout(c, 0) 1137 | }; 1138 | ci.prototype.generateAsync = t; 1139 | var n = function(t, e) { 1140 | var i = this.s < 0 ? this.negate() : this.clone(), 1141 | n = t.s < 0 ? t.negate() : t.clone(); 1142 | if (i.compareTo(n) < 0) { 1143 | var r = i; 1144 | i = n, n = r 1145 | } 1146 | var s = i.getLowestSetBit(), 1147 | o = n.getLowestSetBit(); 1148 | if (0 > o) return void e(i); 1149 | o > s && (o = s), o > 0 && (i.rShiftTo(o, i), n.rShiftTo(o, n)); 1150 | var a = function() { 1151 | (s = i.getLowestSetBit()) > 0 && i.rShiftTo(s, i), (s = n.getLowestSetBit()) > 0 && n.rShiftTo(s, n), i.compareTo(n) >= 0 ? (i.subTo(n, i), i.rShiftTo(1, i)) : (n.subTo(i, n), n.rShiftTo(1, n)), i.signum() > 0 ? setTimeout(a, 0) : (o > 0 && n.lShiftTo(o, n), setTimeout(function() { 1152 | e(n) 1153 | }, 0)) 1154 | }; 1155 | setTimeout(a, 10) 1156 | }; 1157 | e.prototype.gcda = n; 1158 | var r = function(t, i, n, r) { 1159 | if ("number" == typeof i) 1160 | if (2 > t) this.fromInt(1); 1161 | else { 1162 | this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), ae, this), this.isEven() && this.dAddOffset(1, 0); 1163 | var s = this, 1164 | o = function() { 1165 | s.dAddOffset(2, 0), s.bitLength() > t && s.subTo(e.ONE.shiftLeft(t - 1), s), s.isProbablePrime(i) ? setTimeout(function() { 1166 | r() 1167 | }, 0) : setTimeout(o, 0) 1168 | }; 1169 | setTimeout(o, 0) 1170 | } 1171 | else { 1172 | var a = new Array, 1173 | u = 7 & t; 1174 | a.length = (t >> 3) + 1, i.nextBytes(a), u > 0 ? a[0] &= (1 << u) - 1 : a[0] = 0, this.fromString(a, 256) 1175 | } 1176 | }; 1177 | e.prototype.fromNumberAsync = r 1178 | }(); 1179 | var ji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 1180 | Ji = "=", 1181 | Li = Li || {}; 1182 | Li.env = Li.env || {}; 1183 | var qi = Li, 1184 | Hi = Object.prototype, 1185 | Fi = "[object Function]", 1186 | zi = ["toString", "valueOf"]; 1187 | Li.env.parseUA = function(t) { 1188 | var e, i = function(t) { 1189 | var e = 0; 1190 | return parseFloat(t.replace(/\./g, function() { 1191 | return 1 == e++ ? "" : "." 1192 | })) 1193 | }, 1194 | n = navigator, 1195 | r = { 1196 | ie: 0, 1197 | opera: 0, 1198 | gecko: 0, 1199 | webkit: 0, 1200 | chrome: 0, 1201 | mobile: null, 1202 | air: 0, 1203 | ipad: 0, 1204 | iphone: 0, 1205 | ipod: 0, 1206 | ios: null, 1207 | android: 0, 1208 | webos: 0, 1209 | caja: n && n.cajaVersion, 1210 | secure: !1, 1211 | os: null 1212 | }, 1213 | s = t || navigator && navigator.userAgent, 1214 | o = window && window.location, 1215 | a = o && o.href; 1216 | return r.secure = a && 0 === a.toLowerCase() 1217 | .indexOf("https"), s && (/windows|win32/i.test(s) ? r.os = "windows" : /macintosh/i.test(s) ? r.os = "macintosh" : /rhino/i.test(s) && (r.os = "rhino"), /KHTML/.test(s) && (r.webkit = 1), e = s.match(/AppleWebKit\/([^\s]*)/), e && e[1] && (r.webkit = i(e[1]), / Mobile\//.test(s) ? (r.mobile = "Apple", e = s.match(/OS ([^\s]*)/), e && e[1] && (e = i(e[1].replace("_", "."))), r.ios = e, r.ipad = r.ipod = r.iphone = 0, e = s.match(/iPad|iPod|iPhone/), e && e[0] && (r[e[0].toLowerCase()] = r.ios)) : (e = s.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/), e && (r.mobile = e[0]), /webOS/.test(s) && (r.mobile = "WebOS", e = s.match(/webOS\/([^\s]*);/), e && e[1] && (r.webos = i(e[1]))), / Android/.test(s) && (r.mobile = "Android", e = s.match(/Android ([^\s]*);/), e && e[1] && (r.android = i(e[1])))), e = s.match(/Chrome\/([^\s]*)/), e && e[1] ? r.chrome = i(e[1]) : (e = s.match(/AdobeAIR\/([^\s]*)/), e && (r.air = e[0]))), r.webkit || (e = s.match(/Opera[\s\/]([^\s]*)/), e && e[1] ? (r.opera = i(e[1]), e = s.match(/Version\/([^\s]*)/), e && e[1] && (r.opera = i(e[1])), e = s.match(/Opera Mini[^;]*/), e && (r.mobile = e[0])) : (e = s.match(/MSIE\s([^;]*)/), e && e[1] ? r.ie = i(e[1]) : (e = s.match(/Gecko\/([^\s]*)/), e && (r.gecko = 1, e = s.match(/rv:([^\s\)]*)/), e && e[1] && (r.gecko = i(e[1]))))))), r 1218 | }, Li.env.ua = Li.env.parseUA(), Li.isFunction = function(t) { 1219 | return "function" == typeof t || Hi.toString.apply(t) === Fi 1220 | }, Li._IEEnumFix = Li.env.ua.ie ? function(t, e) { 1221 | var i, n, r; 1222 | for (i = 0; i < zi.length; i += 1) n = zi[i], r = e[n], qi.isFunction(r) && r != Hi[n] && (t[n] = r) 1223 | } : function() {}, Li.extend = function(t, e, i) { 1224 | if (!e || !t) throw new Error("extend failed, please check that all dependencies are included."); 1225 | var n, r = function() {}; 1226 | if (r.prototype = e.prototype, t.prototype = new r, t.prototype.constructor = t, t.superclass = e.prototype, e.prototype.constructor == Hi.constructor && (e.prototype.constructor = e), i) { 1227 | for (n in i) qi.hasOwnProperty(i, n) && (t.prototype[n] = i[n]); 1228 | qi._IEEnumFix(t.prototype, i) 1229 | } 1230 | }, "undefined" != typeof KJUR && KJUR || (KJUR = {}), "undefined" != typeof KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {}), KJUR.asn1.ASN1Util = new function() { 1231 | this.integerToByteHex = function(t) { 1232 | var e = t.toString(16); 1233 | return e.length % 2 == 1 && (e = "0" + e), e 1234 | }, this.bigIntToMinTwosComplementsHex = function(t) { 1235 | var i = t.toString(16); 1236 | if ("-" != i.substr(0, 1)) i.length % 2 == 1 ? i = "0" + i : i.match(/^[0-7]/) || (i = "00" + i); 1237 | else { 1238 | var n = i.substr(1), 1239 | r = n.length; 1240 | r % 2 == 1 ? r += 1 : i.match(/^[0-7]/) || (r += 2); 1241 | for (var s = "", o = 0; r > o; o++) s += "f"; 1242 | var a = new e(s, 16), 1243 | u = a.xor(t) 1244 | .add(e.ONE); 1245 | i = u.toString(16) 1246 | .replace(/^-/, "") 1247 | } 1248 | return i 1249 | }, this.getPEMStringFromHex = function(t, e) { 1250 | var i = CryptoJS.enc.Hex.parse(t), 1251 | n = CryptoJS.enc.Base64.stringify(i), 1252 | r = n.replace(/(.{64})/g, "$1\r\n"); 1253 | return r = r.replace(/\r\n$/, ""), "-----BEGIN " + e + "-----\r\n" + r + "\r\n-----END " + e + "-----\r\n" 1254 | } 1255 | }, KJUR.asn1.ASN1Object = function() { 1256 | var t = ""; 1257 | this.getLengthHexFromValue = function() { 1258 | if ("undefined" == typeof this.hV || null == this.hV) throw "this.hV is null or undefined."; 1259 | if (this.hV.length % 2 == 1) throw "value hex must be even length: n=" + t.length + ",v=" + this.hV; 1260 | var e = this.hV.length / 2, 1261 | i = e.toString(16); 1262 | if (i.length % 2 == 1 && (i = "0" + i), 128 > e) return i; 1263 | var n = i.length / 2; 1264 | if (n > 15) throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16); 1265 | var r = 128 + n; 1266 | return r.toString(16) + i 1267 | }, this.getEncodedHex = function() { 1268 | return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV 1269 | }, this.getValueHex = function() { 1270 | return this.getEncodedHex(), this.hV 1271 | }, this.getFreshValueHex = function() { 1272 | return "" 1273 | } 1274 | }, KJUR.asn1.DERAbstractString = function(t) { 1275 | KJUR.asn1.DERAbstractString.superclass.constructor.call(this); 1276 | this.getString = function() { 1277 | return this.s 1278 | }, this.setString = function(t) { 1279 | this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(this.s) 1280 | }, this.setStringHex = function(t) { 1281 | this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t 1282 | }, this.getFreshValueHex = function() { 1283 | return this.hV 1284 | }, "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex && this.setStringHex(t.hex)) 1285 | }, Li.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractTime = function() { 1286 | KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); 1287 | this.localDateToUTC = function(t) { 1288 | utc = t.getTime() + 6e4 * t.getTimezoneOffset(); 1289 | var e = new Date(utc); 1290 | return e 1291 | }, this.formatDate = function(t, e) { 1292 | var i = this.zeroPadding, 1293 | n = this.localDateToUTC(t), 1294 | r = String(n.getFullYear()); 1295 | "utc" == e && (r = r.substr(2, 2)); 1296 | var s = i(String(n.getMonth() + 1), 2), 1297 | o = i(String(n.getDate()), 2), 1298 | a = i(String(n.getHours()), 2), 1299 | u = i(String(n.getMinutes()), 2), 1300 | c = i(String(n.getSeconds()), 2); 1301 | return r + s + o + a + u + c + "Z" 1302 | }, this.zeroPadding = function(t, e) { 1303 | return t.length >= e ? t : new Array(e - t.length + 1) 1304 | .join("0") + t 1305 | }, this.getString = function() { 1306 | return this.s 1307 | }, this.setString = function(t) { 1308 | this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(this.s) 1309 | }, this.setByDateValue = function(t, e, i, n, r, s) { 1310 | var o = new Date(Date.UTC(t, e - 1, i, n, r, s, 0)); 1311 | this.setByDate(o) 1312 | }, this.getFreshValueHex = function() { 1313 | return this.hV 1314 | } 1315 | }, Li.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractStructured = function(t) { 1316 | KJUR.asn1.DERAbstractString.superclass.constructor.call(this); 1317 | this.setByASN1ObjectArray = function(t) { 1318 | this.hTLV = null, this.isModified = !0, this.asn1Array = t 1319 | }, this.appendASN1Object = function(t) { 1320 | this.hTLV = null, this.isModified = !0, this.asn1Array.push(t) 1321 | }, this.asn1Array = new Array, "undefined" != typeof t && "undefined" != typeof t.array && (this.asn1Array = t.array) 1322 | }, Li.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object), KJUR.asn1.DERBoolean = function() { 1323 | KJUR.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff" 1324 | }, Li.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object), KJUR.asn1.DERInteger = function(t) { 1325 | KJUR.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(t) { 1326 | this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t) 1327 | }, this.setByInteger = function(t) { 1328 | var i = new e(String(t), 10); 1329 | this.setByBigInteger(i) 1330 | }, this.setValueHex = function(t) { 1331 | this.hV = t 1332 | }, this.getFreshValueHex = function() { 1333 | return this.hV 1334 | }, "undefined" != typeof t && ("undefined" != typeof t.bigint ? this.setByBigInteger(t.bigint) : "undefined" != typeof t["int"] ? this.setByInteger(t["int"]) : "undefined" != typeof t.hex && this.setValueHex(t.hex)) 1335 | }, Li.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object), KJUR.asn1.DERBitString = function(t) { 1336 | KJUR.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(t) { 1337 | this.hTLV = null, this.isModified = !0, this.hV = t 1338 | }, this.setUnusedBitsAndHexValue = function(t, e) { 1339 | if (0 > t || t > 7) throw "unused bits shall be from 0 to 7: u = " + t; 1340 | var i = "0" + t; 1341 | this.hTLV = null, this.isModified = !0, this.hV = i + e 1342 | }, this.setByBinaryString = function(t) { 1343 | t = t.replace(/0+$/, ""); 1344 | var e = 8 - t.length % 8; 1345 | 8 == e && (e = 0); 1346 | for (var i = 0; e >= i; i++) t += "0"; 1347 | for (var n = "", i = 0; i < t.length - 1; i += 8) { 1348 | var r = t.substr(i, 8), 1349 | s = parseInt(r, 2) 1350 | .toString(16); 1351 | 1 == s.length && (s = "0" + s), n += s 1352 | } 1353 | this.hTLV = null, this.isModified = !0, this.hV = "0" + e + n 1354 | }, this.setByBooleanArray = function(t) { 1355 | for (var e = "", i = 0; i < t.length; i++) e += 1 == t[i] ? "1" : "0"; 1356 | this.setByBinaryString(e) 1357 | }, this.newFalseArray = function(t) { 1358 | for (var e = new Array(t), i = 0; t > i; i++) e[i] = !1; 1359 | return e 1360 | }, this.getFreshValueHex = function() { 1361 | return this.hV 1362 | }, "undefined" != typeof t && ("undefined" != typeof t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : "undefined" != typeof t.bin ? this.setByBinaryString(t.bin) : "undefined" != typeof t.array && this.setByBooleanArray(t.array)) 1363 | }, Li.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object), KJUR.asn1.DEROctetString = function(t) { 1364 | KJUR.asn1.DEROctetString.superclass.constructor.call(this, t), this.hT = "04" 1365 | }, Li.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNull = function() { 1366 | KJUR.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500" 1367 | }, Li.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object), KJUR.asn1.DERObjectIdentifier = function(t) { 1368 | var i = function(t) { 1369 | var e = t.toString(16); 1370 | return 1 == e.length && (e = "0" + e), e 1371 | }, 1372 | n = function(t) { 1373 | var n = "", 1374 | r = new e(t, 10), 1375 | s = r.toString(2), 1376 | o = 7 - s.length % 7; 1377 | 7 == o && (o = 0); 1378 | for (var a = "", u = 0; o > u; u++) a += "0"; 1379 | s = a + s; 1380 | for (var u = 0; u < s.length - 1; u += 7) { 1381 | var c = s.substr(u, 7); 1382 | u != s.length - 7 && (c = "1" + c), n += i(parseInt(c, 2)) 1383 | } 1384 | return n 1385 | }; 1386 | KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(t) { 1387 | this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t 1388 | }, this.setValueOidString = function(t) { 1389 | if (!t.match(/^[0-9.]+$/)) throw "malformed oid string: " + t; 1390 | var e = "", 1391 | r = t.split("."), 1392 | s = 40 * parseInt(r[0]) + parseInt(r[1]); 1393 | e += i(s), r.splice(0, 2); 1394 | for (var o = 0; o < r.length; o++) e += n(r[o]); 1395 | this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e 1396 | }, this.setValueName = function(t) { 1397 | if ("undefined" == typeof KJUR.asn1.x509.OID.name2oidList[t]) throw "DERObjectIdentifier oidName undefined: " + t; 1398 | var e = KJUR.asn1.x509.OID.name2oidList[t]; 1399 | this.setValueOidString(e) 1400 | }, this.getFreshValueHex = function() { 1401 | return this.hV 1402 | }, "undefined" != typeof t && ("undefined" != typeof t.oid ? this.setValueOidString(t.oid) : "undefined" != typeof t.hex ? this.setValueHex(t.hex) : "undefined" != typeof t.name && this.setValueName(t.name)) 1403 | }, Li.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object), KJUR.asn1.DERUTF8String = function(t) { 1404 | KJUR.asn1.DERUTF8String.superclass.constructor.call(this, t), this.hT = "0c" 1405 | }, Li.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNumericString = function(t) { 1406 | KJUR.asn1.DERNumericString.superclass.constructor.call(this, t), this.hT = "12" 1407 | }, Li.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERPrintableString = function(t) { 1408 | KJUR.asn1.DERPrintableString.superclass.constructor.call(this, t), this.hT = "13" 1409 | }, Li.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERTeletexString = function(t) { 1410 | KJUR.asn1.DERTeletexString.superclass.constructor.call(this, t), this.hT = "14" 1411 | }, Li.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERIA5String = function(t) { 1412 | KJUR.asn1.DERIA5String.superclass.constructor.call(this, t), this.hT = "16" 1413 | }, Li.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERUTCTime = function(t) { 1414 | KJUR.asn1.DERUTCTime.superclass.constructor.call(this, t), this.hT = "17", this.setByDate = function(t) { 1415 | this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s) 1416 | }, "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex ? this.setStringHex(t.hex) : "undefined" != typeof t.date && this.setByDate(t.date)) 1417 | }, Li.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERGeneralizedTime = function(t) { 1418 | KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), this.hT = "18", this.setByDate = function(t) { 1419 | this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "gen"), this.hV = stohex(this.s) 1420 | }, "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex ? this.setStringHex(t.hex) : "undefined" != typeof t.date && this.setByDate(t.date)) 1421 | }, Li.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERSequence = function(t) { 1422 | KJUR.asn1.DERSequence.superclass.constructor.call(this, t), this.hT = "30", this.getFreshValueHex = function() { 1423 | for (var t = "", e = 0; e < this.asn1Array.length; e++) { 1424 | var i = this.asn1Array[e]; 1425 | t += i.getEncodedHex() 1426 | } 1427 | return this.hV = t, this.hV 1428 | } 1429 | }, Li.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERSet = function(t) { 1430 | KJUR.asn1.DERSet.superclass.constructor.call(this, t), this.hT = "31", this.getFreshValueHex = function() { 1431 | for (var t = new Array, e = 0; e < this.asn1Array.length; e++) { 1432 | var i = this.asn1Array[e]; 1433 | t.push(i.getEncodedHex()) 1434 | } 1435 | return t.sort(), this.hV = t.join(""), this.hV 1436 | } 1437 | }, Li.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERTaggedObject = function(t) { 1438 | KJUR.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(t, e, i) { 1439 | this.hT = e, this.isExplicit = t, this.asn1Object = i, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = i.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, e), this.isModified = !1) 1440 | }, this.getFreshValueHex = function() { 1441 | return this.hV 1442 | }, "undefined" != typeof t && ("undefined" != typeof t.tag && (this.hT = t.tag), "undefined" != typeof t.explicit && (this.isExplicit = t.explicit), "undefined" != typeof t.obj && (this.asn1Object = t.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object))) 1443 | }, Li.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object), 1444 | function(t) { 1445 | "use strict"; 1446 | var e, i = {}; 1447 | i.decode = function(i) { 1448 | var n; 1449 | if (e === t) { 1450 | var r = "0123456789ABCDEF", 1451 | s = " \f\n\r \xa0\u2028\u2029"; 1452 | for (e = [], n = 0; 16 > n; ++n) e[r.charAt(n)] = n; 1453 | for (r = r.toLowerCase(), n = 10; 16 > n; ++n) e[r.charAt(n)] = n; 1454 | for (n = 0; n < s.length; ++n) e[s.charAt(n)] = -1 1455 | } 1456 | var o = [], 1457 | a = 0, 1458 | u = 0; 1459 | for (n = 0; n < i.length; ++n) { 1460 | var c = i.charAt(n); 1461 | if ("=" == c) break; 1462 | if (c = e[c], -1 != c) { 1463 | if (c === t) throw "Illegal character at offset " + n; 1464 | a |= c, ++u >= 2 ? (o[o.length] = a, a = 0, u = 0) : a <<= 4 1465 | } 1466 | } 1467 | if (u) throw "Hex encoding incomplete: 4 bits missing"; 1468 | return o 1469 | }, window.Hex = i 1470 | }(), 1471 | function(t) { 1472 | "use strict"; 1473 | var e, i = {}; 1474 | i.decode = function(i) { 1475 | var n; 1476 | if (e === t) { 1477 | var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 1478 | s = "= \f\n\r \xa0\u2028\u2029"; 1479 | for (e = [], n = 0; 64 > n; ++n) e[r.charAt(n)] = n; 1480 | for (n = 0; n < s.length; ++n) e[s.charAt(n)] = -1 1481 | } 1482 | var o = [], 1483 | a = 0, 1484 | u = 0; 1485 | for (n = 0; n < i.length; ++n) { 1486 | var c = i.charAt(n); 1487 | if ("=" == c) break; 1488 | if (c = e[c], -1 != c) { 1489 | if (c === t) throw "Illegal character at offset " + n; 1490 | a |= c, ++u >= 4 ? (o[o.length] = a >> 16, o[o.length] = a >> 8 & 255, o[o.length] = 255 & a, a = 0, u = 0) : a <<= 6 1491 | } 1492 | } 1493 | switch (u) { 1494 | case 1: 1495 | throw "Base64 encoding incomplete: at least 2 bits missing"; 1496 | case 2: 1497 | o[o.length] = a >> 10; 1498 | break; 1499 | case 3: 1500 | o[o.length] = a >> 16, o[o.length] = a >> 8 & 255 1501 | } 1502 | return o 1503 | }, i.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, i.unarmor = function(t) { 1504 | var e = i.re.exec(t); 1505 | if (e) 1506 | if (e[1]) t = e[1]; 1507 | else { 1508 | if (!e[2]) throw "RegExp out of sync"; 1509 | t = e[2] 1510 | } return i.decode(t) 1511 | }, window.Base64 = i 1512 | }(), 1513 | function(t) { 1514 | "use strict"; 1515 | 1516 | function e(t, i) { 1517 | t instanceof e ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = i) 1518 | } 1519 | 1520 | function i(t, e, i, n, r) { 1521 | this.stream = t, this.header = e, this.length = i, this.tag = n, this.sub = r 1522 | } 1523 | var n = 100, 1524 | r = "\u2026", 1525 | s = { 1526 | tag: function(t, e) { 1527 | var i = document.createElement(t); 1528 | return i.className = e, i 1529 | }, 1530 | text: function(t) { 1531 | return document.createTextNode(t) 1532 | } 1533 | }; 1534 | e.prototype.get = function(e) { 1535 | if (e === t && (e = this.pos++), e >= this.enc.length) throw "Requesting byte offset " + e + " on a stream of length " + this.enc.length; 1536 | return this.enc[e] 1537 | }, e.prototype.hexDigits = "0123456789ABCDEF", e.prototype.hexByte = function(t) { 1538 | return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t) 1539 | }, e.prototype.hexDump = function(t, e, i) { 1540 | for (var n = "", r = t; e > r; ++r) 1541 | if (n += this.hexByte(this.get(r)), i !== !0) switch (15 & r) { 1542 | case 7: 1543 | n += " "; 1544 | break; 1545 | case 15: 1546 | n += "\n"; 1547 | break; 1548 | default: 1549 | n += " " 1550 | } 1551 | return n 1552 | }, e.prototype.parseStringISO = function(t, e) { 1553 | for (var i = "", n = t; e > n; ++n) i += String.fromCharCode(this.get(n)); 1554 | return i 1555 | }, e.prototype.parseStringUTF = function(t, e) { 1556 | for (var i = "", n = t; e > n;) { 1557 | var r = this.get(n++); 1558 | i += String.fromCharCode(128 > r ? r : r > 191 && 224 > r ? (31 & r) << 6 | 63 & this.get(n++) : (15 & r) << 12 | (63 & this.get(n++)) << 6 | 63 & this.get(n++)) 1559 | } 1560 | return i 1561 | }, e.prototype.parseStringBMP = function(t, e) { 1562 | for (var i = "", n = t; e > n; n += 2) { 1563 | var r = this.get(n), 1564 | s = this.get(n + 1); 1565 | i += String.fromCharCode((r << 8) + s) 1566 | } 1567 | return i 1568 | }, e.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, e.prototype.parseTime = function(t, e) { 1569 | var i = this.parseStringISO(t, e), 1570 | n = this.reTime.exec(i); 1571 | return n ? (i = n[1] + "-" + n[2] + "-" + n[3] + " " + n[4], n[5] && (i += ":" + n[5], n[6] && (i += ":" + n[6], n[7] && (i += "." + n[7]))), n[8] && (i += " UTC", "Z" != n[8] && (i += n[8], n[9] && (i += ":" + n[9]))), i) : "Unrecognized time: " + i 1572 | }, e.prototype.parseInteger = function(t, e) { 1573 | var i = e - t; 1574 | if (i > 4) { 1575 | i <<= 3; 1576 | var n = this.get(t); 1577 | if (0 === n) i -= 8; 1578 | else 1579 | for (; 128 > n;) n <<= 1, --i; 1580 | return "(" + i + " bit)" 1581 | } 1582 | for (var r = 0, s = t; e > s; ++s) r = r << 8 | this.get(s); 1583 | return r 1584 | }, e.prototype.parseBitString = function(t, e) { 1585 | var i = this.get(t), 1586 | n = (e - t - 1 << 3) - i, 1587 | r = "(" + n + " bit)"; 1588 | if (20 >= n) { 1589 | var s = i; 1590 | r += " "; 1591 | for (var o = e - 1; o > t; --o) { 1592 | for (var a = this.get(o), u = s; 8 > u; ++u) r += a >> u & 1 ? "1" : "0"; 1593 | s = 0 1594 | } 1595 | } 1596 | return r 1597 | }, e.prototype.parseOctetString = function(t, e) { 1598 | var i = e - t, 1599 | s = "(" + i + " byte) "; 1600 | i > n && (e = t + n); 1601 | for (var o = t; e > o; ++o) s += this.hexByte(this.get(o)); 1602 | return i > n && (s += r), s 1603 | }, e.prototype.parseOID = function(t, e) { 1604 | for (var i = "", n = 0, r = 0, s = t; e > s; ++s) { 1605 | var o = this.get(s); 1606 | if (n = n << 7 | 127 & o, r += 7, !(128 & o)) { 1607 | if ("" === i) { 1608 | var a = 80 > n ? 40 > n ? 0 : 1 : 2; 1609 | i = a + "." + (n - 40 * a) 1610 | } else i += "." + (r >= 31 ? "bigint" : n); 1611 | n = r = 0 1612 | } 1613 | } 1614 | return i 1615 | }, i.prototype.typeName = function() { 1616 | if (this.tag === t) return "unknown"; 1617 | var e = this.tag >> 6, 1618 | i = (this.tag >> 5 & 1, 31 & this.tag); 1619 | switch (e) { 1620 | case 0: 1621 | switch (i) { 1622 | case 0: 1623 | return "EOC"; 1624 | case 1: 1625 | return "BOOLEAN"; 1626 | case 2: 1627 | return "INTEGER"; 1628 | case 3: 1629 | return "BIT_STRING"; 1630 | case 4: 1631 | return "OCTET_STRING"; 1632 | case 5: 1633 | return "NULL"; 1634 | case 6: 1635 | return "OBJECT_IDENTIFIER"; 1636 | case 7: 1637 | return "ObjectDescriptor"; 1638 | case 8: 1639 | return "EXTERNAL"; 1640 | case 9: 1641 | return "REAL"; 1642 | case 10: 1643 | return "ENUMERATED"; 1644 | case 11: 1645 | return "EMBEDDED_PDV"; 1646 | case 12: 1647 | return "UTF8String"; 1648 | case 16: 1649 | return "SEQUENCE"; 1650 | case 17: 1651 | return "SET"; 1652 | case 18: 1653 | return "NumericString"; 1654 | case 19: 1655 | return "PrintableString"; 1656 | case 20: 1657 | return "TeletexString"; 1658 | case 21: 1659 | return "VideotexString"; 1660 | case 22: 1661 | return "IA5String"; 1662 | case 23: 1663 | return "UTCTime"; 1664 | case 24: 1665 | return "GeneralizedTime"; 1666 | case 25: 1667 | return "GraphicString"; 1668 | case 26: 1669 | return "VisibleString"; 1670 | case 27: 1671 | return "GeneralString"; 1672 | case 28: 1673 | return "UniversalString"; 1674 | case 30: 1675 | return "BMPString"; 1676 | default: 1677 | return "Universal_" + i.toString(16) 1678 | } 1679 | case 1: 1680 | return "Application_" + i.toString(16); 1681 | case 2: 1682 | return "[" + i + "]"; 1683 | case 3: 1684 | return "Private_" + i.toString(16) 1685 | } 1686 | }, i.prototype.reSeemsASCII = /^[ -~]+$/, i.prototype.content = function() { 1687 | if (this.tag === t) return null; 1688 | var e = this.tag >> 6, 1689 | i = 31 & this.tag, 1690 | s = this.posContent(), 1691 | o = Math.abs(this.length); 1692 | if (0 !== e) { 1693 | if (null !== this.sub) return "(" + this.sub.length + " elem)"; 1694 | var a = this.stream.parseStringISO(s, s + Math.min(o, n)); 1695 | return this.reSeemsASCII.test(a) ? a.substring(0, 2 * n) + (a.length > 2 * n ? r : "") : this.stream.parseOctetString(s, s + o) 1696 | } 1697 | switch (i) { 1698 | case 1: 1699 | return 0 === this.stream.get(s) ? "false" : "true"; 1700 | case 2: 1701 | return this.stream.parseInteger(s, s + o); 1702 | case 3: 1703 | return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(s, s + o); 1704 | case 4: 1705 | return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(s, s + o); 1706 | case 6: 1707 | return this.stream.parseOID(s, s + o); 1708 | case 16: 1709 | case 17: 1710 | return "(" + this.sub.length + " elem)"; 1711 | case 12: 1712 | return this.stream.parseStringUTF(s, s + o); 1713 | case 18: 1714 | case 19: 1715 | case 20: 1716 | case 21: 1717 | case 22: 1718 | case 26: 1719 | return this.stream.parseStringISO(s, s + o); 1720 | case 30: 1721 | return this.stream.parseStringBMP(s, s + o); 1722 | case 23: 1723 | case 24: 1724 | return this.stream.parseTime(s, s + o) 1725 | } 1726 | return null 1727 | }, i.prototype.toString = function() { 1728 | return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]" 1729 | }, i.prototype.print = function(e) { 1730 | if (e === t && (e = ""), document.writeln(e + this), null !== this.sub) { 1731 | e += " "; 1732 | for (var i = 0, n = this.sub.length; n > i; ++i) this.sub[i].print(e) 1733 | } 1734 | }, i.prototype.toPrettyString = function(e) { 1735 | e === t && (e = ""); 1736 | var i = e + this.typeName() + " @" + this.stream.pos; 1737 | if (this.length >= 0 && (i += "+"), i += this.length, 32 & this.tag ? i += " (constructed)" : 3 != this.tag && 4 != this.tag || null === this.sub || (i += " (encapsulates)"), i += "\n", null !== this.sub) { 1738 | e += " "; 1739 | for (var n = 0, r = this.sub.length; r > n; ++n) i += this.sub[n].toPrettyString(e) 1740 | } 1741 | return i 1742 | }, i.prototype.toDOM = function() { 1743 | var t = s.tag("div", "node"); 1744 | t.asn1 = this; 1745 | var e = s.tag("div", "head"), 1746 | i = this.typeName() 1747 | .replace(/_/g, " "); 1748 | e.innerHTML = i; 1749 | var n = this.content(); 1750 | if (null !== n) { 1751 | n = String(n) 1752 | .replace(/", i += "Length: " + this.header + "+", i += this.length >= 0 ? this.length : -this.length + " (undefined)", 32 & this.tag ? i += "
(constructed)" : 3 != this.tag && 4 != this.tag || null === this.sub || (i += "
(encapsulates)"), null !== n && (i += "
Value:
" + n + "", "object" == typeof oids && 6 == this.tag)) { 1759 | var a = oids[n]; 1760 | a && (a.d && (i += "
" + a.d), a.c && (i += "
" + a.c), a.w && (i += "
(warning!)")) 1761 | } 1762 | o.innerHTML = i, t.appendChild(o); 1763 | var u = s.tag("div", "sub"); 1764 | if (null !== this.sub) 1765 | for (var c = 0, h = this.sub.length; h > c; ++c) u.appendChild(this.sub[c].toDOM()); 1766 | return t.appendChild(u), e.onclick = function() { 1767 | t.className = "node collapsed" == t.className ? "node" : "node collapsed" 1768 | }, t 1769 | }, i.prototype.posStart = function() { 1770 | return this.stream.pos 1771 | }, i.prototype.posContent = function() { 1772 | return this.stream.pos + this.header 1773 | }, i.prototype.posEnd = function() { 1774 | return this.stream.pos + this.header + Math.abs(this.length) 1775 | }, i.prototype.fakeHover = function(t) { 1776 | this.node.className += " hover", t && (this.head.className += " hover") 1777 | }, i.prototype.fakeOut = function(t) { 1778 | var e = / ?hover/; 1779 | this.node.className = this.node.className.replace(e, ""), t && (this.head.className = this.head.className.replace(e, "")) 1780 | }, i.prototype.toHexDOM_sub = function(t, e, i, n, r) { 1781 | if (!(n >= r)) { 1782 | var o = s.tag("span", e); 1783 | o.appendChild(s.text(i.hexDump(n, r))), t.appendChild(o) 1784 | } 1785 | }, i.prototype.toHexDOM = function(e) { 1786 | var i = s.tag("span", "hex"); 1787 | if (e === t && (e = i), this.head.hexNode = i, this.head.onmouseover = function() { 1788 | this.hexNode.className = "hexCurrent" 1789 | }, this.head.onmouseout = function() { 1790 | this.hexNode.className = "hex" 1791 | }, i.asn1 = this, i.onmouseover = function() { 1792 | var t = !e.selected; 1793 | t && (e.selected = this.asn1, this.className = "hexCurrent"), this.asn1.fakeHover(t) 1794 | }, i.onmouseout = function() { 1795 | var t = e.selected == this.asn1; 1796 | this.asn1.fakeOut(t), t && (e.selected = null, this.className = "hex") 1797 | }, this.toHexDOM_sub(i, "tag", this.stream, this.posStart(), this.posStart() + 1), this.toHexDOM_sub(i, this.length >= 0 ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()), null === this.sub) i.appendChild(s.text(this.stream.hexDump(this.posContent(), this.posEnd()))); 1798 | else if (this.sub.length > 0) { 1799 | var n = this.sub[0], 1800 | r = this.sub[this.sub.length - 1]; 1801 | this.toHexDOM_sub(i, "intro", this.stream, this.posContent(), n.posStart()); 1802 | for (var o = 0, a = this.sub.length; a > o; ++o) i.appendChild(this.sub[o].toHexDOM(e)); 1803 | this.toHexDOM_sub(i, "outro", this.stream, r.posEnd(), this.posEnd()) 1804 | } 1805 | return i 1806 | }, i.prototype.toHexString = function() { 1807 | return this.stream.hexDump(this.posStart(), this.posEnd(), !0) 1808 | }, i.decodeLength = function(t) { 1809 | var e = t.get(), 1810 | i = 127 & e; 1811 | if (i == e) return i; 1812 | if (i > 3) throw "Length over 24 bits not supported at position " + (t.pos - 1); 1813 | if (0 === i) return -1; 1814 | e = 0; 1815 | for (var n = 0; i > n; ++n) e = e << 8 | t.get(); 1816 | return e 1817 | }, i.hasContent = function(t, n, r) { 1818 | if (32 & t) return !0; 1819 | if (3 > t || t > 4) return !1; 1820 | var s = new e(r); 1821 | 3 == t && s.get(); 1822 | var o = s.get(); 1823 | if (o >> 6 & 1) return !1; 1824 | try { 1825 | var a = i.decodeLength(s); 1826 | return s.pos - r.pos + a == n 1827 | } catch (u) { 1828 | return !1 1829 | } 1830 | }, i.decode = function(t) { 1831 | t instanceof e || (t = new e(t, 0)); 1832 | var n = new e(t), 1833 | r = t.get(), 1834 | s = i.decodeLength(t), 1835 | o = t.pos - n.pos, 1836 | a = null; 1837 | if (i.hasContent(r, s, t)) { 1838 | var u = t.pos; 1839 | if (3 == r && t.get(), a = [], s >= 0) { 1840 | for (var c = u + s; t.pos < c;) a[a.length] = i.decode(t); 1841 | if (t.pos != c) throw "Content size is not correct for container starting at offset " + u 1842 | } else try { 1843 | for (;;) { 1844 | var h = i.decode(t); 1845 | if (0 === h.tag) break; 1846 | a[a.length] = h 1847 | } 1848 | s = u - t.pos 1849 | } catch (l) { 1850 | throw "Exception while decoding undefined length content: " + l 1851 | } 1852 | } else t.pos += s; 1853 | return new i(n, o, s, r, a) 1854 | }, i.test = function() { 1855 | for (var t = [{ 1856 | value: [39], 1857 | expected: 39 1858 | }, { 1859 | value: [129, 201], 1860 | expected: 201 1861 | }, { 1862 | value: [131, 254, 220, 186], 1863 | expected: 16702650 1864 | }], n = 0, r = t.length; r > n; ++n) { 1865 | var s = new e(t[n].value, 0), 1866 | o = i.decodeLength(s); 1867 | o != t[n].expected && document.write("In test[" + n + "] expected " + t[n].expected + " got " + o + "\n") 1868 | } 1869 | }, window.ASN1 = i 1870 | }(), ASN1.prototype.getHexStringValue = function() { 1871 | var t = this.toHexString(), 1872 | e = 2 * this.header, 1873 | i = 2 * this.length; 1874 | return t.substr(e, i) 1875 | }, ci.prototype.parseKey = function(t) { 1876 | try { 1877 | var e = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, 1878 | i = e.test(t) ? Hex.decode(t) : Base64.unarmor(t), 1879 | n = ASN1.decode(i); 1880 | if (9 === n.sub.length) { 1881 | var r = n.sub[1].getHexStringValue(); 1882 | this.n = ai(r, 16); 1883 | var s = n.sub[2].getHexStringValue(); 1884 | this.e = parseInt(s, 16); 1885 | var o = n.sub[3].getHexStringValue(); 1886 | this.d = ai(o, 16); 1887 | var a = n.sub[4].getHexStringValue(); 1888 | this.p = ai(a, 16); 1889 | var u = n.sub[5].getHexStringValue(); 1890 | this.q = ai(u, 16); 1891 | var c = n.sub[6].getHexStringValue(); 1892 | this.dmp1 = ai(c, 16); 1893 | var h = n.sub[7].getHexStringValue(); 1894 | this.dmq1 = ai(h, 16); 1895 | var l = n.sub[8].getHexStringValue(); 1896 | this.coeff = ai(l, 16) 1897 | } else { 1898 | if (2 !== n.sub.length) return !1; 1899 | var f = n.sub[1], 1900 | d = f.sub[0], 1901 | r = d.sub[0].getHexStringValue(); 1902 | this.n = ai(r, 16); 1903 | var s = d.sub[1].getHexStringValue(); 1904 | this.e = parseInt(s, 16) 1905 | } 1906 | return !0 1907 | } catch (p) { 1908 | return !1 1909 | } 1910 | }, ci.prototype.getPrivateBaseKey = function() { 1911 | var t = { 1912 | array: [new KJUR.asn1.DERInteger({ 1913 | "int": 0 1914 | }), new KJUR.asn1.DERInteger({ 1915 | bigint: this.n 1916 | }), new KJUR.asn1.DERInteger({ 1917 | "int": this.e 1918 | }), new KJUR.asn1.DERInteger({ 1919 | bigint: this.d 1920 | }), new KJUR.asn1.DERInteger({ 1921 | bigint: this.p 1922 | }), new KJUR.asn1.DERInteger({ 1923 | bigint: this.q 1924 | }), new KJUR.asn1.DERInteger({ 1925 | bigint: this.dmp1 1926 | }), new KJUR.asn1.DERInteger({ 1927 | bigint: this.dmq1 1928 | }), new KJUR.asn1.DERInteger({ 1929 | bigint: this.coeff 1930 | })] 1931 | }, 1932 | e = new KJUR.asn1.DERSequence(t); 1933 | return e.getEncodedHex() 1934 | }, ci.prototype.getPrivateBaseKeyB64 = function() { 1935 | return wi(this.getPrivateBaseKey()) 1936 | }, ci.prototype.getPublicBaseKey = function() { 1937 | var t = { 1938 | array: [new KJUR.asn1.DERObjectIdentifier({ 1939 | oid: "1.2.840.113549.1.1.1" 1940 | }), new KJUR.asn1.DERNull] 1941 | }, 1942 | e = new KJUR.asn1.DERSequence(t); 1943 | t = { 1944 | array: [new KJUR.asn1.DERInteger({ 1945 | bigint: this.n 1946 | }), new KJUR.asn1.DERInteger({ 1947 | "int": this.e 1948 | })] 1949 | }; 1950 | var i = new KJUR.asn1.DERSequence(t); 1951 | t = { 1952 | hex: "00" + i.getEncodedHex() 1953 | }; 1954 | var n = new KJUR.asn1.DERBitString(t); 1955 | t = { 1956 | array: [e, n] 1957 | }; 1958 | var r = new KJUR.asn1.DERSequence(t); 1959 | return r.getEncodedHex() 1960 | }, ci.prototype.getPublicBaseKeyB64 = function() { 1961 | return wi(this.getPublicBaseKey()) 1962 | }, ci.prototype.wordwrap = function(t, e) { 1963 | if (e = e || 64, !t) return t; 1964 | var i = "(.{1," + e + "})( +|$\n?)|(.{1," + e + "})"; 1965 | return t.match(RegExp(i, "g")) 1966 | .join("\n") 1967 | }, ci.prototype.getPrivateKey = function() { 1968 | var t = "-----BEGIN RSA PRIVATE KEY-----\n"; 1969 | return t += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n", t += "-----END RSA PRIVATE KEY-----" 1970 | }, ci.prototype.getPublicKey = function() { 1971 | var t = "-----BEGIN PUBLIC KEY-----\n"; 1972 | return t += this.wordwrap(this.getPublicBaseKeyB64()) + "\n", t += "-----END PUBLIC KEY-----" 1973 | }, ci.prototype.hasPublicKeyProperty = function(t) { 1974 | return t = t || {}, t.hasOwnProperty("n") && t.hasOwnProperty("e") 1975 | }, ci.prototype.hasPrivateKeyProperty = function(t) { 1976 | return t = t || {}, t.hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff") 1977 | }, ci.prototype.parsePropertiesFrom = function(t) { 1978 | this.n = t.n, this.e = t.e, t.hasOwnProperty("d") && (this.d = t.d, this.p = t.p, this.q = t.q, this.dmp1 = t.dmp1, this.dmq1 = t.dmq1, this.coeff = t.coeff) 1979 | }; 1980 | var Gi = function(t) { 1981 | ci.call(this), t && ("string" == typeof t ? this.parseKey(t) : (this.hasPrivateKeyProperty(t) || this.hasPublicKeyProperty(t)) && this.parsePropertiesFrom(t)) 1982 | }; 1983 | Gi.prototype = new ci, Gi.prototype.constructor = Gi; 1984 | var Wi = function(t) { 1985 | t = t || {}, this.default_key_size = parseInt(t.default_key_size) || 1024, this.default_public_exponent = t.default_public_exponent || "010001", this.log = t.log || !1, this.key = null 1986 | }; 1987 | return Wi.prototype.setKey = function(t) { 1988 | this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new Gi(t) 1989 | }, Wi.prototype.setPrivateKey = function(t) { 1990 | this.setKey(t) 1991 | }, Wi.prototype.setPublicKey = function(t) { 1992 | this.setKey(t) 1993 | }, Wi.prototype.decrypt = function(t) { 1994 | try { 1995 | return this.getKey() 1996 | .decrypt(xi(t)) 1997 | } catch (e) { 1998 | return !1 1999 | } 2000 | }, Wi.prototype.encrypt = function(t) { 2001 | try { 2002 | return wi(this.getKey() 2003 | .encrypt(t)) 2004 | } catch (e) { 2005 | return !1 2006 | } 2007 | }, Wi.prototype.alipayEncrypt = function(t, e, i) { 2008 | try { 2009 | return wi(this.getKey() 2010 | .alipayEncrypt(t, e, i)) 2011 | } catch (n) { 2012 | return !1 2013 | } 2014 | }, Wi.prototype.getKey = function(t) { 2015 | if (!this.key) { 2016 | if (this.key = new Gi, t && "[object Function]" === {}.toString.call(t)) return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t); 2017 | this.key.generate(this.default_key_size, this.default_public_exponent) 2018 | } 2019 | return this.key 2020 | }, Wi.prototype.getPrivateKey = function() { 2021 | return this.getKey() 2022 | .getPrivateKey() 2023 | }, Wi.prototype.getPrivateKeyB64 = function() { 2024 | return this.getKey() 2025 | .getPrivateBaseKeyB64() 2026 | }, Wi.prototype.getPublicKey = function() { 2027 | return this.getKey() 2028 | .getPublicKey() 2029 | }, Wi.prototype.getPublicKeyB64 = function() { 2030 | return this.getKey() 2031 | .getPublicBaseKeyB64() 2032 | }, t = Wi 2033 | }(), security_client_utils_202_lib_keysequence = function(t) { 2034 | /* 2035 | function e(t) { 2036 | var e = document.getElementById(t); 2037 | if (e) { 2038 | var i = s[t] = []; 2039 | o(e, "keydown", function(t) { 2040 | i.push(["D", t.keyCode, (new Date).getTime()]) 2041 | }), o(e, "keyup", function(n) { 2042 | "" === e.value ? i = s[t] = [] : i.push(["U", n.keyCode, (new Date).getTime()]) 2043 | }) 2044 | } 2045 | } 2046 | */ 2047 | function e(t) { 2048 | var i = s[t] = []; 2049 | var timeNow = (new Date).getTime(); 2050 | i.push(["D", undefined, timeNow],["U", undefined, timeNow]) 2051 | } 2052 | 2053 | function i(t) { 2054 | var e = s[t]; 2055 | if (!e || 0 === e.length) return ""; 2056 | for (var i = n(e).join("|"); e.length;) e.pop(); 2057 | return i.length >= 1024 ? "" : i 2058 | } 2059 | 2060 | function n(t) { 2061 | for (var e, i, n = t[0][2], r = 0, s = t.length; s > r; r++) e = t[r], e[2] -= n, i = e[1], i >= 48 && 57 >= i || i >= 65 && 90 >= i || i >= 186 && 192 >= i || i >= 219 && 222 >= i ? e[1] = 0 : i >= 96 && 111 >= i && (e[1] = -1); 2062 | return t 2063 | } 2064 | 2065 | function r(t, e) { 2066 | for (var i, n = [], r = 0, s = "", o = 0; 256 > o; o++) n[o] = o; 2067 | for (o = 0; 256 > o; o++) r = (r + n[o] + t.charCodeAt(o % t.length)) % 256, i = n[o], n[o] = n[r], n[r] = i; 2068 | o = 0, r = 0; 2069 | for (var a = 0; a < e.length; a++) o = (o + 1) % 256, r = (r + n[o]) % 256, i = n[o], n[o] = n[r], n[r] = i, s += String.fromCharCode(e.charCodeAt(a) ^ n[(n[o] + n[r]) % 256]); 2070 | return s 2071 | } 2072 | var s = {}, 2073 | o = function() { 2074 | return document.addEventListener ? function(t, e, i) { 2075 | t.addEventListener(e, i, !1) 2076 | } : document.attachEvent ? function(t, e, i) { 2077 | t.attachEvent("on" + e, i) 2078 | } : function(t, e, i) { 2079 | t["on" + e.toLowerCase()] = i 2080 | } 2081 | }(); 2082 | return t = { 2083 | start: e, 2084 | get: i, 2085 | ksk: r 2086 | } 2087 | }(), security_password_222_lib_six_digit_password = function(t) { 2088 | function e(t, e) { 2089 | return t - t % e 2090 | } 2091 | 2092 | function i(t, e) { 2093 | return new Array(e + 1) 2094 | .join(t) 2095 | } 2096 | 2097 | function n(t) { 2098 | return function() { 2099 | var e = t.val() 2100 | .length; 2101 | t.focus(); 2102 | try { 2103 | t[0].setSelectionRange(e, e) 2104 | } catch (i) { 2105 | if (t[0].createTextRange) { 2106 | var n = t[0].createTextRange(); 2107 | n.collapse(!0), n.moveEnd("character", e), n.moveStart("character", e), n.select() 2108 | } 2109 | } 2110 | } 2111 | } 2112 | var r = window.jQuery, 2113 | s = arale_events_120_events, 2114 | o = 6, 2115 | a = { 2116 | FOCUS: 1, 2117 | BLUR: 2, 2118 | COMPLETE: 3 2119 | }, 2120 | u = function(t) { 2121 | this._element = r(t), this._events = new s, this._length = parseInt(this._element.attr("maxlength"), 10) || o, this._parentWidth, this._status, this._cursor, this._step, this._mo 2122 | }; 2123 | return u.prototype = { 2124 | _getMO: function() { 2125 | return this._mo || (this._mo = r('
' + i("", this._length) + "
")), this 2126 | }, 2127 | _getCursor: function() { 2128 | return this._cursor || (this._cursor = r("")) 2129 | .appendTo(this._mo), this 2130 | }, 2131 | _initStyle: function() { 2132 | var t = this, 2133 | i = parseInt(t._mo.parent() 2134 | .css("width"), 10) || 182; 2135 | return t._parentWidth = e(i, t._length), t._step = t._parentWidth / 6, t._mo.css({ 2136 | width: t._parentWidth 2137 | }) 2138 | .find("i") 2139 | .css({ 2140 | width: t._step - 1 2141 | }), t._cursor.css({ 2142 | width: t._step - 1 2143 | }), this 2144 | }, 2145 | _fixedCousor: function() { 2146 | var t = this, 2147 | e = (t._element.val(), t._element.val() 2148 | .length), 2149 | i = r("b", t._mo), 2150 | n = r("i", t._mo), 2151 | s = t._step * (e >= t._length ? t._length - 1 : e); 2152 | return i.each(function(t) { 2153 | r(this) 2154 | .css({ 2155 | visibility: e > t ? "visible" : "hidden" 2156 | }) 2157 | }), (this._status == a.FOCUS || this._status == a.COMPLETE) && n.removeClass("active") 2158 | .eq(e) 2159 | .addClass("active"), t._cursor.animate({ 2160 | left: s 2161 | }, 50), this 2162 | }, 2163 | render: function() { 2164 | var t = this; 2165 | this._getMO() 2166 | ._getCursor(), this._element.attr("maxlength", 6) 2167 | .attr("minlength", 6) 2168 | .css({ 2169 | outline: "none", 2170 | "margin-left": "-999px" 2171 | }), this._element.parent(".ui-form-item") 2172 | .css("over-flow", "hidden"); 2173 | var e = (r("b", t._mo), r("i", t._mo)); 2174 | return t._element.addClass("sixDigitPassword") 2175 | .on("focus", function() { 2176 | var i = t._element.val() 2177 | .length; 2178 | t._status = a.FOCUS, e.eq(i) 2179 | .addClass("active"), t._cursor.css({ 2180 | visibility: "visible" 2181 | }) 2182 | }) 2183 | .on("blur", function() { 2184 | t._status = a.BLUR, e.removeClass("active"), t._cursor.css({ 2185 | visibility: "hidden" 2186 | }) 2187 | }) 2188 | .on("keyup input paste", function() { 2189 | var e = t._element.val() 2190 | .length, 2191 | i = t._element.val(); 2192 | e === t._length ? (t._status = a.COMPLETE, t._events.trigger("complete", i)) : (t._status = a.FOCUS, t._events.trigger("uncomplete", i)), t._fixedCousor() 2193 | }) 2194 | .after(this._mo), t._mo.focus(function() { 2195 | t._status = a.FOCUS, t._element.focus(), n(t._element)(), t._cursor.css({ 2196 | visibility: "visible" 2197 | }) 2198 | }) 2199 | .click(function() { 2200 | t._status = a.FOCUS, t._element.focus(), n(t._element)(), t._cursor.css({ 2201 | visibility: "visible" 2202 | }) 2203 | }), t._initStyle(), e.eq(0) 2204 | .css({ 2205 | "border-color": "transparent" 2206 | }), setInterval(function() { 2207 | t._fixedCousor(), t._status == a.FOCUS || t._status == a.COMPLETE ? t._element.focus() : t._status == a.BLUR && t._element.blur() 2208 | }, 500), r(window) 2209 | .on("resize", function() { 2210 | t._initStyle() 2211 | ._fixedCousor() 2212 | }), this 2213 | }, 2214 | on: function(t, e) { 2215 | return this._events.on(t, e, this), this 2216 | }, 2217 | off: function(t, e) { 2218 | return this._events.off(t, e), this 2219 | }, 2220 | val: function() { 2221 | return this._element.val() 2222 | }, 2223 | clear: function() { 2224 | return this._element.val(""), this._fixedCousor(), this 2225 | }, 2226 | focus: function() { 2227 | return this._status = a.FOCUS, n(this._element)(), this 2228 | }, 2229 | blur: function() { 2230 | return this._status = a.BLUR, this._element.blur(), this 2231 | } 2232 | }, t = u 2233 | }(), security_crypto_200_index = function(t) { 2234 | return t = { 2235 | Base64: security_crypto_200_lib_base64, 2236 | RSA: security_crypto_200_lib_rsa 2237 | } 2238 | }() 2239 | 2240 | 2241 | const id = "payPassword_rsainput"; 2242 | 2243 | function securityPassword(password,PK,TS){ 2244 | var s = security_crypto_200_index; 2245 | 2246 | var e = new s.RSA; 2247 | var i = s.Base64.decode(TS); 2248 | e.setPublicKey(PK); 2249 | for (var n = "", r = 5, o = 0; r > o && (n = e.alipayEncrypt(2, i, password), 344 != n.length); o++); 2250 | 344 != n.length && (n = ""); 2251 | 2252 | return n 2253 | } 2254 | 2255 | function getKeySeq(ksk){ 2256 | var o = security_client_utils_202_lib_keysequence, 2257 | s = security_crypto_200_index; 2258 | 2259 | o.start(id) 2260 | var t = '{"type":"js", "in":"' + o.get(id) + '"}'; 2261 | 2262 | return s.Base64.encode(o.ksk(ksk, t)) 2263 | } 2264 | --------------------------------------------------------------------------------