Repository: XIU2/SHELL Branch: master Commit: 242ee91a641a Files: 18 Total size: 96.6 KB Directory structure: gitextract_43twnla2/ ├── .github/ │ └── ISSUE_TEMPLATE/ │ └── --bug.md ├── CNAME ├── LICENSE ├── README.md ├── index.html ├── lanzou_up.sh ├── md/ │ ├── lanzou_up.md │ ├── qa.md │ ├── qb_p.md │ ├── qbee_p.md │ ├── sidebar.md │ ├── unblock163.md │ └── zs.md ├── qb_p.sh ├── qbee_p.sh ├── service/ │ ├── unblock163_centos │ └── unblock163_debian └── unblock163.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/--bug.md ================================================ --- name: 反馈BUG about: 让脚本更好用一点! title: "[XXX.sh] 一句话说明情况" labels: '' assignees: '' --- ### 脚本名称 ### 问题描述 ### 重现步骤 ### 预期行为 ### 报错内容 ### 设备信息 ================================================ FILE: CNAME ================================================ shell.xiu2.xyz ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================ # 📖 Shell - 帮助文档 [![GitHub license](https://img.shields.io/github/license/XIU2/Shell.svg?style=flat-square&color=3ba675&logo=github)](https://github.com/XIU2/Shell/) [![GitHub Star](https://img.shields.io/github/stars/XIU2/Shell.svg?style=flat-square&label=Star&color=3ba675&logo=github)](https://github.com/XIU2/Shell/) [![GitHub Fork](https://img.shields.io/github/forks/XIU2/Shell.svg?style=flat-square&label=Fork&color=3ba675&logo=github)](https://github.com/XIU2/Shell/) [![SHELL.XIU2.XYZ](https://img.shields.io/static/v1?label=%20&message=SHELL.XIU2.XYZ&style=flat-square&labelColor=42B983&color=3ba675&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAUElEQVR42mN02tn8n4ECwEg1A/a61eBUtOHxGTh78vUdNDYAm+JcTY+hZAA2vwfImmDIOe9qobIBMIDNuchiMMOGiAHY/E5SGJBlAKmAYgMA9YZy4TweQEoAAAAASUVORK5CYII=)](https://shell.xiu2.xyz) 🔧 自用的一些乱七八糟脚本,有什么问题请发 [Issues](https://github.com/XIU2/Shell/issues/new/choose),**觉得好用请点个⭐鼓励一下下~** > _分享我其他开源项目:[**TrackersList.com** - 全网热门 BT Tracker 列表!有效提高 BT 下载速度~](https://github.com/XIU2/TrackersListCollection) _ > _[**CloudflareSpeedTest** - 🌩 测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4+IPv6)~](https://github.com/XIU2/CloudflareSpeedTest) _ > _[**UserScript** - 🐵 Github 高速下载、知乎增强、自动无缝翻页、护眼模式 等十几个**油猴脚本**~](https://github.com/XIU2/UserScript) _ > _[📚「阅读」APP 精品书源~](https://github.com/XIU2/Yuedu) ,[**SNIProxy** - 🧷 支持全平台、全系统、前置代理等~](https://github.com/XIU2/SNIProxy) _ **** ## 使用说明 > **如果当前位于 Github,请先访问:[https://shell.xiu2.xyz](https://shell.xiu2.xyz)** 在左边侧栏中选择脚本,即可看到详细安装及使用说明等。 > 如遇到脚本报错,请先查看脚本相关文档中是否说明,如没有请通过 [issue](https://github.com/XIU2/Shell/issues/new/choose) 提供完整报错内容及相关截图! **** ## 问题反馈 - 请通过 [GitHub issue](https://github.com/XIU2/Shell/issues) 提交问题。 - 记得提供完整报错内容及相关截图! - 问题描述越详细越好(我不怕看着累,就怕看不到)! **** ## 其他说明 本项目中的脚本仅供日常学习使用,不得用于任何商业用途。 学习使用请遵守您所在国家的法律,任何非法行为由使用者本身承担。 有什么好玩的也可以建议我写相关脚本,虽然我可能不听不听不听不听。🙄 **** ## 赞赏支持 ![微信赞赏](https://bitbucket.org/xiu2/xiu2/raw/master/img/zs-01.png)![支付宝赞赏](https://bitbucket.org/xiu2/xiu2/raw/master/img/zs-02.png) **** ## License The GPL-3.0 License. ================================================ FILE: index.html ================================================  XIU2/SHELL - 帮助文档
Load...
================================================ FILE: lanzou_up.sh ================================================ #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # -------------------------------------------------------------- # 系统: ALL # 项目: 蓝奏云上传文件 # 版本: 1.0.4 # 作者: XIU2 # 官网: https://shell.xiu2.xyz # 项目: https://github.com/XIU2/Shell # -------------------------------------------------------------- USERNAME="XXX" # 蓝奏云用户名 COOKIE_PHPDISK_INFO="XXX" # 替换 XXX 为 Cookie 中 phpdisk_info 的值 COOKIE_YLOGIN="XXX" # 替换 XXX 为 Cookie 中 ylogin 的值 TOKEN="XXX" # 微信推送链接 Token,可选 UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" HEADER_CHECK_LOGIN="User-Agent: ${UA} Referer: https://up.woozooo.com/mydisk.php?item=files&action=index&u=${USERNAME} Accept-Language: zh-CN,zh;q=0.9" URL_ACCOUNT="https://pc.woozooo.com/account.php" URL_UPLOAD="https://up.woozooo.com/fileup.php" INFO="[信息]" && ERROR="[错误]" && TIP="[注意]" # 检查是否已登录 _CHECK_LOGIN() { if [[ -z "${COOKIE_PHPDISK_INFO}" || "${COOKIE_PHPDISK_INFO}" == "XXX" ]]; then echo -e "${ERROR} 请指定 Cookie 中 phpdisk_info 的值!" fi if [[ -z "${COOKIE_YLOGIN}" || "${COOKIE_YLOGIN}" == "XXX" ]]; then echo -e "${ERROR} 请指定 Cookie 中 ylogin 的值!" fi HTML_CHECK_LOGIN=$(curl -s --http1.1 -b "ylogin=${COOKIE_YLOGIN};phpdisk_info=${COOKIE_PHPDISK_INFO}" -H "${HEADER_CHECK_LOGIN}" "${URL_ACCOUNT}"|grep "登录") [[ ! -z "${HTML_CHECK_LOGIN}" ]] && _NOTICE "ERROR" "Cookie 已失效,请更新!" } # 上传文件 _UPLOAD() { [[ $(du "${NAME_FILE}"|awk '{print $1}') -gt 100000000 ]] && _NOTICE "ERROR" "${NAME}文件大于 100MB!" HTML_UPLOAD=$(curl --connect-timeout 120 -m 5000 --retry 2 -s -b "ylogin=${COOKIE_YLOGIN};phpdisk_info=${COOKIE_PHPDISK_INFO}" -H "${URL_UPLOAD}" -F "task=1" -F "id=WU_FILE_0" -F "folder_id=${FOLDER_ID}" -F "name=${NAME}" -F "upload_file=@${NAME_FILE}" "${URL_UPLOAD}"|grep '\\u4e0a\\u4f20\\u6210\\u529f') [[ -z "${HTML_UPLOAD}" ]] && _NOTICE "ERROR" "${NAME}文件上传失败!" echo -e "${INFO} 文件上传成功![$(date '+%Y/%m/%d %H:%M')]" } # 消息推送至微信 _NOTICE() { PARAMETER_1="$1" PARAMETER_2="$2" if [[ "${TOKEN}" != "" && "${TOKEN}" != "XXX" ]]; then # 微信推送 Server酱 https://sc.ftqq.com/3.version #wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "https://sc.ftqq.com/${TOKEN}.send?text=${PARAMETER_1}${PARAMETER_2}" # 微信推送 pushplus http://pushplus.hxtrip.com/ wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "http://pushplus.hxtrip.com/customer/push/send?token=${TOKEN}&title=${PARAMETER_1}&content=${PARAMETER_2}" fi if [[ ${PARAMETER_1} == "INFO" ]]; then echo -e "${INFO} ${PARAMETER_2} [$(date '+%Y/%m/%d %H:%M')]" else echo -e "${ERROR} ${PARAMETER_2} [$(date '+%Y/%m/%d %H:%M')]" fi exit 1 } NAME="$1" # 文件名 NAME_FILE="$2" # 文件路径 FOLDER_ID="$3" # 上传文件夹ID if [[ -z "${NAME}" ]]; then echo -e "${ERROR} 未指定文件名!" && exit 1 elif [[ -z "${NAME_FILE}" ]]; then echo -e "${ERROR} 未指定文件路径!" && exit 1 elif [[ -z "${FOLDER_ID}" ]]; then echo -e "${ERROR} 未指定上传文件夹ID!" && exit 1 fi _CHECK_LOGIN _UPLOAD ================================================ FILE: md/lanzou_up.md ================================================ # 📑 lanzou_up.sh ## 脚本介绍 很早之前,为了实现自动制作便携版并上传 qBittorret、qBittorretEE 到蓝奏云网盘,我就特地写了这个脚本来解决上传文件到蓝奏云网盘的问题。 该脚本作用很简单,**自动登陆并上传文件到蓝奏云指定文件夹**,方便 Linux 系统使用 或 其他脚本调用。 ?> _[ **「油猴脚本」蓝奏云网盘增强!** 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自动打开/复制分享链接、拖入文件自动显示上传框...](https://github.com/XIU2/UserScript#脚本列表)_ ### 脚本版本 **最新版本:** v1.0.4 ### 系统要求 所有 Linux 系统均支持。 **** ## 下载安装 先下载脚本并赋予执行权限,还不能运行,需要简单配置一下。 ``` bash wget -N --no-check-certificate https://shell.xiu2.xyz/lanzou_up.sh && chmod +x lanzou_up.sh ``` **** ## 使用方法 ### 账号配置 使用 vim 或 nano 来编辑脚本,下面以 nano 为例。 ``` bash nano lanzou_up.sh # 打开脚本文件后,可以看到脚本头部有以下三行内容。 # 修改 XXX 为你的蓝奏云用户名,并指定 Cookie (获取方法见下)。 # 然后按下 Ctrl+X 并回车两下即可保存。 USERNAME="XXX" # 蓝奏云用户名 COOKIE_PHPDISK_INFO="XXX" # 替换 XXX 为 Cookie 中 phpdisk_info 的值 COOKIE_YLOGIN="XXX" # 替换 XXX 为 Cookie 中 ylogin 的值 TOKEN="XXX" # 微信推送链接 Token,可选 ``` > 脚本支持推送错误消息至微信,但是需要配置 TOKEN,支持 [PushPlus(默认)](http://pushplus.hxtrip.com)、[Server酱](https://sc.ftqq.com/3.version),自行了解,不需要可留空或保留 XXX。 ### 获取Cookie 网页端登陆蓝奏云后,按 **F12** 键,然后如下图所示依次点击:*Application - Cookies - https://pc.woozooo.com* 这样就能看到 Cookie 中的 *phpdisk_info(值就是那一大串字符)* 和 *ylogin(值就是那几位数字)* 了。 双击值即可按 **Ctrl+C** 复制,然后将脚本头部对应变量的 *XXX* 替换即可。 ![蓝奏云获取文件夹ID](https://shell.xiu2.xyz/img/lanzou_up-03.png) **** 再尝试上传文件前,你还需要知道 **文件夹 ID** 才行。 ### 获取文件夹ID 网页端登陆蓝奏云,找到目标文件夹,*右键文件夹名称 - 检查*。如下图所示,红框中的就是文件夹 ID *(880498)*。 ![蓝奏云获取文件夹ID](https://shell.xiu2.xyz/img/lanzou_up-01.png) ### 上传文件 知道 文件夹 ID 了,那就先随便找个文件(注意文件后缀要满足蓝奏云要求,且文件不大于 100MB),然后就可以上传了: ``` bash # 格式: bash lanzou_up.sh "文件名" "文件路径" "文件夹 ID" # 示例 bash lanzou_up.sh "233.zip" "/root/233.zip" "880498" ``` **** ## 更新日志 #### 2026年05月06日,版本 v1.0.4 :id=104 - **1. 修复** Cookie 检查判断。 #### 2020年11月10日,版本 v1.0.3 :id=103 - **1. 新增** 上传超时时间。 #### 2020年11月09日,版本 v1.0.2 :id=102 - **1. 新增** 提示信息时显示当前时间。 #### 2020年09月10日,版本 v1.0.1 :id=101 - **1. 移除** 用户名登陆方式。 `刚发布没几天就发现用户名登陆方式失效了,所以现在只能用 Cookie 方式登陆了。` #### 2020年09月06日,版本 v1.0.0 :id=100 - **1. 发布** 第一个版本。 ================================================ FILE: md/qa.md ================================================ ### \# 脚本运行出现错误了怎么办? 不要慌,先去 **[Github Issues](https://github.com/XIU2/Shell/issues)** 中看看是否已经有其他人出现过**类似问题**了(记得看看 [Closed](https://github.com/XIU2/Shell/issues?q=is%3Aissue+is%3Aclosed) 的)。 如果没有类似问题,请发个 **[Issues](https://github.com/XIU2/Shell/issues/new?assignees=&labels=&template=--bug.md&title=%5BBUG%2Fxxx.sh%5D+-+%E4%B8%80%E5%8F%A5%E8%AF%9D%E8%AF%B4%E6%98%8E%E6%83%85%E5%86%B5)** 告诉我,越详细越好(有截图更好)! **** ### \# 下载脚本时报错 wget: command not found 这个是因为你的 Linux 系统太过于精简,缺少基本的下载工具 wget,装个就好了。 #### CentOS 系统: ```bash yum update yum install wget -y ``` #### Debian/Ubuntu 系统: ```bash apt-get update apt-get install wget -y # 如果你是较新版本的系统,可以把命令中的 apt-get 替换为 apt(新版包管理器) ``` 如果没有报错,说明安装成功,继续下载安装脚本即可。 **** ?> 稍后补充 ================================================ FILE: md/qb_p.md ================================================ # 📑 qb_p.sh ## 脚本介绍 本来是制作便携版给自己用的,后来一些人希望我分享出去,于是为了实现自动制作便携版已失效~~并上传到蓝奏云网盘~~,我就特地写了这个脚本。 该脚本作用很简单,**下载最新版本 qBittorrent 制作为便携版并上传到蓝奏云**,效果:[蓝奏云](https://xiu.lanzoub.com/b073jjwta)。 ### 脚本版本 **最新版本:** v1.0.7 ### 系统要求 所有 Linux 系统均支持。 **** ## 下载安装 因为涉及到解压缩,而系统自带的 unzip 并不能解压 .exe ,所以需要额外安装 7z。 ``` bash # CentOS 系统执行: yum install p7zip-full -y # Debian/Ubuntu 系统执行: apt-get install p7zip-full -y ``` 然后下载脚本并赋予执行权限,还不能运行,需要简单配置一下。 ``` bash wget -N --no-check-certificate https://shell.xiu2.xyz/qb_p.sh && chmod +x qb_p.sh ``` **** ## 使用方法 ### 首次配置 使用 vim 或 nano 来编辑脚本,下面以 nano 为例。 ``` bash nano qb_p.sh # 打开脚本文件后,可以看到脚本头部有以下几行内容。 # 根据自己的情况修改后下面的变量内容。 # 然后按下 Ctrl+X 并回车两下即可保存。 FOLDER_ID="12345" # 蓝奏云网盘要上传文件的文件夹 ID TOKEN="XXX" # 微信推送链接 Token,可选 FOLDER="/root/qBittorrent" # 脚本工作目录(下载、解压、压缩、上传等操作都在这个文件夹内),脚本会自动创建文件夹 LZY_PATH="/root/lanzou_up.sh" # 蓝奏云上传文件脚本位置 FILE_FORMAT="zip" # 最后打包的压缩包格式,推荐 zip 或 7z ``` ?> 脚本支持推送错误消息至微信,但是需要配置 TOKEN,支持 [PushPlus(默认)](http://pushplus.hxtrip.com)、[Server酱](https://sc.ftqq.com/3.version),自行了解,不需要可留空或保留 XXX。 已失效~~蓝奏云文件夹ID获取方法:[https://shell.xiu2.xyz/#/md/lanzou_up?id=获取文件夹ID](https://shell.xiu2.xyz/#/md/lanzou_up?id=%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%a4%b9id) 蓝奏云上传文件脚本:[https://shell.xiu2.xyz/#/md/lanzou_up](https://shell.xiu2.xyz/#/md/lanzou_up)~~ 然后去 [蓝奏云](https://xiu.lanzoub.com/b073jjwta) 下载一个最新版本,把压缩包内的 `profile` 文件夹放到服务器的 `qBittorrent/Other` 文件夹下(没有就新建,可以添加其他说明文件,就像我做的那样)。 配置完毕后,就可以先试一试能不能正常使用了! ### 使用示例 ``` bash # 格式: bash qb_p.sh "指定版本号 (可选)" # 示例,最新版本: bash qb_p.sh # 示例,指定版本: bash qb_p.sh "4.2.3" ``` **** ## 更新日志 #### 2026年05月06日,版本 v1.0.7 :id=107 - **1. 新增** 只保留 10 个压缩包文件(默认注释)。 - **2. 新增** 一些进度提示。 - **3. 适配** 最新的多版本文件改动。 #### 2025年01月07日,版本 v1.0.6 :id=106 - **1. 适配** 最新的多版本文件改动。 #### 2023年06月06日,版本 v1.0.5 :id=105 - **1. 适配** 最新的多版本文件。 #### 2022年01月07日,版本 v1.0.4 :id=104 - **1. 修复** 下载失败一次后,后续下载都会失败的问题。 #### 2020年10月24日,版本 v1.0.3 :id=103 - **1. 修复** 压缩前没有添加便携配置文件的问题。 #### 2020年09月10日,版本 v1.0.2 :id=102 - **1. 修复** 最终压缩包文件名后缀前面少个点的问题(这就很尴尬了...)。 #### 2020年09月06日,版本 v1.0.1 :id=101 - **1. 新增** 自定义压缩包格式功能(详见[首次配置](#首次配置))。 - **2. 更换** 默认压缩格式为 zip。 - **3. 优化** 最后打包为压缩包时的路径为相对路径。 #### 2020年09月06日,版本 v1.0.0 :id=100 - **1. 发布** 第一个版本。 ================================================ FILE: md/qbee_p.md ================================================ # 📑 qbee_p.sh ## 脚本介绍 本来是制作便携版给自己用的,后来一些人希望我分享出去,于是为了实现自动制作便携版~~并上传到蓝奏云网盘~~(已失效),我就特地写了这个脚本。 该脚本作用很简单,**下载最新版本 qBittorrentEE 制作为便携版并上传到蓝奏云**,效果:[蓝奏云](https://xiu.lanzoub.com/b073dnr7g)。 ### 脚本版本 **最新版本:** v1.0.8 ### 系统要求 所有 Linux 系统均支持。 **** ## 下载安装 因为涉及到解压缩,而系统自带的 unzip 并不能解压 .exe ,所以需要额外安装 7z。 ``` bash # CentOS 系统执行: yum install p7zip-full -y # Debian/Ubuntu 系统执行: apt-get install p7zip-full -y ``` 然后下载脚本并赋予执行权限,还不能运行,需要简单配置一下。 ``` bash wget -N --no-check-certificate https://shell.xiu2.xyz/qbee_p.sh && chmod +x qbee_p.sh ``` **** ## 使用方法 ### 首次配置 使用 vim 或 nano 来编辑脚本,下面以 nano 为例。 ``` bash nano qbee_p.sh # 打开脚本文件后,可以看到脚本头部有以下几行内容。 # 根据自己的情况修改后下面的变量内容。 # 然后按下 Ctrl+X 并回车两下即可保存。 FOLDER_ID="12345" # 蓝奏云网盘要上传文件的文件夹 ID TOKEN="XXX" # 微信推送链接 Token,可选 FOLDER="/root/qBittorrentEE" # 脚本工作目录(下载、解压、压缩、上传等操作都在这个文件夹内),脚本会自动创建文件夹 LZY_PATH="/root/lanzou_up.sh" # 蓝奏云上传文件脚本位置 FILE_FORMAT="zip" # 最后打包的压缩包格式,推荐 zip 或 7z ``` ?> 脚本支持推送错误消息至微信,但是需要配置 TOKEN,支持 [PushPlus(默认)](http://pushplus.hxtrip.com)、[Server酱](https://sc.ftqq.com/3.version),自行了解,不需要可留空或保留 XXX。 已失效~~蓝奏云文件夹ID获取方法:[https://shell.xiu2.xyz/#/md/lanzou_up?id=获取文件夹ID](https://shell.xiu2.xyz/#/md/lanzou_up?id=%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%a4%b9id) 蓝奏云上传文件脚本:[https://shell.xiu2.xyz/#/md/lanzou_up](https://shell.xiu2.xyz/#/md/lanzou_up)~~ 然后去 [蓝奏云](https://xiu.lanzoub.com/b073jjwta) 下载一个最新版本,把压缩包内的 `profile` 文件夹放到服务器的 `qBittorrentEE/Other` 文件夹下(没有就新建,可以添加其他说明文件,就像我做的那样)。 配置完毕后,就可以先试一试能不能正常使用了! ### 使用示例 ``` bash # 格式: bash qbee_p.sh "指定版本号 (可选)" # 示例,最新版本: bash qbee_p.sh # 示例,指定版本: bash qbee_p.sh "4.25.11" ``` **** ## 更新日志 #### 2026年05月06日,版本 v1.0.8 :id=108 - **1. 新增** 只保留 10 个压缩包文件(默认注释)。 - **2. 新增** 一些进度提示。 #### 2025年01月07日,版本 v1.0.7 :id=107 - **1. 适配** 最新的多版本文件改动。 #### 2023年06月06日,版本 v1.0.6 :id=106 - **1. 适配** 最新的多版本文件。 #### 2022年01月07日,版本 v1.0.5 :id=105 - **1. 修复** 下载失败一次后,后续下载都会失败的问题。 #### 2020年10月24日,版本 v1.0.4 :id=104 - **1. 修复** 压缩前没有添加便携配置文件的问题。 #### 2020年09月28日,版本 v1.0.3 :id=103 - **1. 修复** 因脚本变量中 [FOLDER_DOWNLOAD_UNZIP] 错误,而导致的更新错误的问题。 #### 2020年09月10日,版本 v1.0.2 :id=102 - **1. 修复** 最终压缩包文件名后缀前面少个点的问题(这就很尴尬了...)。 #### 2020年09月06日,版本 v1.0.1 :id=101 - **1. 新增** 自定义压缩包格式功能(详见[首次配置](#首次配置))。 - **2. 更换** 默认压缩格式为 zip。 - **3. 优化** 最后打包为压缩包时的路径为相对路径。 #### 2020年09月06日,版本 v1.0.0 :id=100 - **1. 发布** 第一个版本。 ================================================ FILE: md/sidebar.md ================================================ - **** - [· *lanzou_up.sh* ***- 蓝奏云上传文件***](md/lanzou_up.md) - [· *qb_p.sh* ***- qBittorrent 自动制作便携版***](md/qb_p.md) - [· *qbee_p.sh* ***- qBittorrentEE 自动制作便携版***](md/qbee_p.md) - [· *unblock163.sh* ***- 解锁网易云音乐灰色无版权***](md/unblock163.md) - **** - [· *Q&A* ***- 常见问题***](md/qa.md) - [· *Z&S* ***- 赞赏支持***](md/zs.md) ================================================ FILE: md/unblock163.md ================================================ # 📑 unblock163.sh ## 脚本介绍 ?> 该脚本基于 [UnblockNeteaseMusic](https://github.com/UnblockNeteaseMusic/server) 项目。 UnblockNeteaseMusic 是一个可以解锁网易云音乐灰色无版权音乐的代理工具。 原理是通过替换无版权音乐的链接为其他音源(QQ、酷我、酷狗、百度、咪咕、JOOX等)来实现解锁无版权音乐。**相当于在网易云音乐客户端中听全网版权音乐!** ?> 该脚本只适用于服务器,如果只想本地使用,请使用我写的 ~~[Windows 版](https://xiu.lanzoub.com/b0sopazc)~~ (被律师函警告,已停止更新)! **建议有条件的部署在国内服务器**,国外服务器只能用 QQ 音源,况且部署在国外相比国内或本地会慢上不少。 ### 脚本版本 **最新版本:** v1.1.9 ### 系统要求 CentOS 6+ / Debian 6+ / Ubuntu 14.04 + **** ## 下载安装 !> **注意:**因为涉及防火墙端口开关、服务脚本安装,所以脚本需要以 ROOT 用户执行。 ``` bash # 如果你不是 ROOT 用户,请执行下面这行代码切换为 ROOT 用户。 # 如果你已经是 ROOT 用户了,那么请跳过下面这行代码! sudo su # 执行上面一行代码后会提示你输入当前用户的密码,回车后没有报错即可继续。 ``` **** ?> 如果你要更新脚本,除了使用脚本中的 **[0. 更新脚本]** 功能以外,还可以再次输入下面这一行代码。 执行下面一行代码下载并运行脚本: ``` bash wget -N --no-check-certificate https://shell.xiu2.xyz/unblock163.sh && chmod +x unblock163.sh && bash unblock163.sh ``` 下载运行后会提示你输入数字来选择要做什么。 输入 **1** ,就会开始安装了,根据提示依次输入配置信息(或直接回车使用默认配置)即可。 ``` bash 请输入数字 [0-10]:1 [信息] 开始设置 用户配置... 请输入要使用的代理端口。 [1-65535] [注意] 如果你在本地通过 Hosts 方式使用该代理,那么只能选择 80 端口,格式示例:80 [注意] 如果需要搭配自签证书,那么还需要配置 HTTPS 端口,格式:HTTP:HTTPS,两个端口不能相同,格式示例:80:443" (默认: 80): ------------------------ 代理端口 : 80 ------------------------ 请输入要使用的音源排序。 [qq kuwo kugou baidu xiami migu joox] [注意] 音源排序指的是,无版权音乐会根据此处顺序优先匹配首位音源,如果匹配到就返回,反之就继续往后匹配。 [注意] 不同音源之间请用空格隔开。 (默认: qq migu kuwo kugou baidu): ------------------------ 音源排序 : qq migu kuwo kugou baidu ------------------------ 是否启用严格模式?[Y/n] [注意] 启用严格模式后,本代理仅允许网易云音乐域名访问,即本地设备只能通过 Host 或 PAC 使用,强烈建议开启,否则所有设备流量都会经过本代理。 (默认:Y [启用]): ------------------------ 严格模式 : YES ------------------------ 指定网易服务器 IP,不懂请跳过。[格式:IPv4] (默认为空): ------------------------ 指定 IP : ------------------------ [信息] 开始安装/配置 依赖... [信息] 开始下载/安装... ... ``` 如果安装过程没有出错,那么最后就会提示: ``` bash UnblockNeteaseMusic 配置信息: ------------------------ 本机地址: X.X.X.X 代理端口: 80 音源排序: qq migu kuwo kugou baidu 严格模式: YES 指定 IP: PAC 地址: http://X.X.X.X:80/proxy.pac ``` **** ## 使用方法 ### 本地使用 安装并启动成功后,就可以在本地设备上使用了。 以下两种模式任选其一,不要同时使用。 #### Hosts模式 在 Hosts 末尾中添加下面两行: ``` bash X.X.X.X music.163.com X.X.X.X interface.music.163.com ``` > X.X.X.X 指的是你的服务器IP,记得修改,不要傻傻的跟着写。 #### PAC模式 如果无法配置 Hosts(例如手机),那么可以使用 PAC。 修改设备的代理自动配置为下面一行内容: ``` bash http://X.X.X.X:端口/proxy.pac ``` > X.X.X.X 指的是你的服务器IP,端口是你的代理端口,记得修改,不要傻傻的跟着写。 | 客户端平台 | PAC 设置步骤 | | :------ | :------------------------------- | | **Windows** | _设置 **->** 工具 **->** 自定义代理(客户端内) **->** HTTP代理 **->** 服务器: ... 端口: ..._ | | **UWP** | _Windows 设置 **->** 网络和 Internet **->** 代理 **->** 勾选\[使用设置脚本\] **->** 脚本地址: ..._ | | **Linux** | _系统设置 **->** 网络 **->** 网络代理 **->** 方法:自动 **->** 配置 URL: ..._ | | **macOS** | _系统偏好设置 **->** 网络 **->** 高级 **->** 代理 **->** 自动代理配置 **->** URL: ..._ | | **Android** | _WLAN **->** 修改网络 **->** 高级选项 **->** 代理 **->** 代理自动配置 **->** PAC网址: ..._ | | **iOS** | _无线局域网 **->** HTTP 代理 **->** 配置代理 **->** 自动 **->** URL: ..._ | **** ### 脚本说明 运行脚本 ``` bash bash unblock163.sh ``` 输入对应的数字来执行相应的命令。 ``` bash UnblockNeteaseMusic 一键脚本 [vX.X.X] 0. 更新脚本 ---------- 1. 安装 2. 更新 3. 卸载 ---------- 4. 启动 5. 停止 6. 重启 ---------- 7. 设置 配置信息 8. 查看 账号信息 9. 查看 日志信息 10. 查看 链接信息 当前状态: 已安装 并 已启动 请输入数字 [0-10]: ``` **** ### 文件位置 - **安装目录:**/usr/local/UnblockNeteaseMusic - **日志文件:**/usr/local/UnblockNeteaseMusic/UnblockNeteaseMusic.log **** ### 其他命令 除了用脚本启动、停止、重启以外,还能通过其他命令操作。 - **启动:**/etc/init.d/unblock163 start - **停止:**/etc/init.d/unblock163 stop - **重启:**/etc/init.d/unblock163 restart - **查看状态:**/etc/init.d/unblock163 status **** ## 注意事项 ### 启动失败的可能原因 #### 1. 端口被占用 如果日志中显示以下内容,即说明端口被占用了。
点击展开 查看更多 ``` HTTP Server running @ http://0.0.0.0:80 events.js:174 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE: address already in use 0.0.0.0:80 at Server.setupListenHandle [as _listen2] (net.js:1279:14) at listenInCluster (net.js:1327:12) at doListen (net.js:1460:7) at process._tickCallback (internal/process/next_tick.js:63:19) Emitted 'error' event at: at emitErrorNT (net.js:1306:8) at process._tickCallback (internal/process/next_tick.js:63:19) ``` 请使用 `ss -ltp|grep 端口号` 查看是被哪个程序占用了。 例如提示如下内容,则可以使用 `kill -9 2333` 命令来结束该进程(如果有两个 pid 就结束最后那个)。 ``` State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=6666,fd=14),("nginx",pid=2333,fd=14)) ```
**** ### 其他 #### 阿里云/腾讯云/微软云/谷歌云等无法连接的可能原因 阿里云/腾讯云/微软云/谷歌云等服务商的云服务器,服务器与网络实际上是分开的,所以分为内网防火墙和外网防火墙,脚本只能修改到内网防火墙,外网防火墙需要你自行去后台寻找 [防火墙/安全规则/端口规则] 等字样相关选项开放代理端口。 **** ## 更新日志 #### 2022年08月31日,版本 v1.1.9 :id=119 - **1. 更新** UnblockNeteaseMusic 仓库源镜像源。 #### 2022年07月16日,版本 v1.1.8 :id=118 - **1. 更新** UnblockNeteaseMusic 仓库源镜像源。 #### 2022年04月16日,版本 v1.1.7 :id=117 - **1. 更新** UnblockNeteaseMusic 仓库源镜像源。 #### 2022年02月14日,版本 v1.1.6 :id=116 - **1. 更新** UnblockNeteaseMusic 仓库源镜像源。 #### 2021年09月21日,版本 v1.1.5 :id=115 - **1. 调整** 调整 严格模式 与 Endpoint 模式分开配置。 - **2. 调整** Node 版本。 - **3. 更新** 音源。 #### 2021年09月20日,版本 v1.1.4 :id=114 - **1. 调整** 软件源为第三方持续维护的版本。 ****
点击展开 查看更多 #### 2021年07月26日,版本 v1.1.3 :id=113 - **1. 修复** aarch64 ARMv8 支持。 #### 2021年07月26日,版本 v1.1.2 :id=112 - **1. 新增** aarch64 ARMv8 支持。 #### 2021年03月25日,版本 v1.1.1 :id=111 - **1. 调整** UnblockNeteaseMusic 仓库源为国内镜像源。 > 有效解决国内服务器从 Github 下载慢/无法下载的问题。 #### 2020年12月01日,版本 v1.1.0 :id=110 - **1. 新增** 指定网易云音乐 IP(即 -f 参数)。 #### 2020年09月06日,版本 v1.0.9 :id=109 - **1. 更新** 脚本更新地址、系统服务脚本地址(不影响旧脚本检查更新)。 - **2. 修复** 安装过程中,修改服务器时区可能报错的问题(纯粹强迫症)。 #### 2020年06月17日,版本 v1.0.8 :id=108 - **1. 修复** 查看链接信息时,[显示 IP+IP归属地 格式]选项报错的问题。 #### 2020年06月09日,版本 v1.0.7 :id=107 - **1. 修复** 监听双端口时,无法查看链接信息的问题。 #### 2020年04月05日,版本 v1.0.6 :id=106 - **1. 修复** 当使用自签证书时,配置信息中代理端口显示不正确的问题。 #### 2019年12月02日,版本 v1.0.5 :id=105 - **1. 修复** 安装时异常退出的问题。 #### 2019年11月09日,版本 v1.0.4 :id=104 - **1. 新增** 支持 HTTP:HTTPS 监听双端口,搭配自签证书使用。 #### 2019年09月09日,版本 v1.0.3 :id=103 - **1. 优化** 获取 Node 最新版本失败后,将使用备用的版本号。 #### 2019年09月09日,版本 v1.0.2 :id=102 - **1. 修复** 部分系统因根证书不完整而导致下载失败的问题。 #### 2019年09月03日,版本 v1.0.1 :id=101 - **1. 修复** 谷歌云、腾讯云这类服务器安装后无法使用的问题。 #### 2019年08月31日,版本 v1.0.0 :id=100 - **1. 发布** 第一个版本。
================================================ FILE: md/zs.md ================================================ ### \# 赞赏支持 ![微信赞赏](https://bitbucket.org/xiu2/xiu2/raw/master/img/zs-01.png)![支付宝赞赏](https://bitbucket.org/xiu2/xiu2/raw/master/img/zs-02.png) ================================================ FILE: qb_p.sh ================================================ #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # -------------------------------------------------------------- # 系统: ALL # 项目: qBittorrent 便携版制作 脚本 # 版本: 1.0.7 # 作者: XIU2 # 官网: https://shell.xiu2.xyz # 项目: https://github.com/XIU2/Shell # -------------------------------------------------------------- # 首次使用脚本前,请先配置好 FOLDER_ID、TOKEN、FOLDER、LZY_PATH 四个变量。 FOLDER_ID="12345" # 蓝奏云网盘要上传文件的文件夹 ID, https://shell.xiu2.xyz/#/md/lanzou_up?id=%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%a4%b9id TOKEN="XXX" # 微信推送链接 Token,可选 FOLDER="/root/qBittorrent" # 脚本工作目录(下载、解压、压缩、上传等操作都在这个文件夹内),脚本会自动创建文件夹 LZY_PATH="/root/lanzou_up.sh" # 蓝奏云上传文件脚本位置, https://shell.xiu2.xyz/#/md/lanzou_up FILE_FORMAT="zip" # 最后打包的压缩包格式,推荐 zip 或 7z UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" FOLDER_DOWNLOAD="${FOLDER}/Download" # 存放下载文件的文件夹 FOLDER_DOWNLOAD_UNZIP="${FOLDER_DOWNLOAD}/qBittorrent" # 解压下载文件的文件夹 FOLDER_OTHER="${FOLDER}/Other" # 存放配置等文件文件夹 FOLDER_UPLOAD="${FOLDER}/Upload" # 存放压缩后文件 并 上传的文件夹 FILE_OLD_VER="${FOLDER}/old_ver.txt" # 存放旧版本号的文件(每次执行脚本都会检查最新版本) ARRAY=(_x64 _lt20_x64) INFO="[信息]" && ERROR="[错误]" && TIP="[注意]" # 检查最新版本,可以通过 _CHECK_VER "x.x.x" 来指定版本 _CHECK_VER(){ NEW_VER=$1 # 此处是手动指定版本号时的代码 [[ -z ${NEW_VER} ]] && NEW_VER=$(wget -qO- https://api.github.com/repos/qbittorrent/qBittorrent/tags | grep "name"|grep -v "beta"|grep -v "alpha"|grep -v "rc"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g;s/release-//') [[ -z ${NEW_VER} ]] && _NOTICE "ERROR" "qBittorrent最新版本获取失败!" [[ ! -e ${FOLDER} ]] && mkdir "${FOLDER}" # 如果主文件夹不存在,就新建 [[ ! -e ${FILE_OLD_VER} ]] && echo -n ${NEW_VER} > ${FILE_OLD_VER} # 如果旧版本文件不存在,说明是首次运行,则把当前版本号写入该文件 [[ $(cat ${FILE_OLD_VER}) == ${NEW_VER} ]] && echo -e "${INFO} 已经是最新版本!${NEW_VER} [$(date '+%Y/%m/%d %H:%M')]" && exit 1 echo -e "${INFO} 检测到新版本 ${NEW_VER} 开始下载..." } # 下载 _DOWNLOAD(){ [[ ! -e ${FOLDER_DOWNLOAD} ]] && mkdir "${FOLDER_DOWNLOAD}" # 如果下载文件夹不存在,就新建 cd ${FOLDER_DOWNLOAD} if ! wget --no-check-certificate -q -t2 -T5 -4 -O "qbittorrent${1}.exe" "https://sourceforge.net/projects/qbittorrent/files/qbittorrent-win32/qbittorrent-${NEW_VER}/qbittorrent_${NEW_VER}${1}_setup.exe/download"; then rm -f "qbittorrent${1}.exe" _NOTICE "ERROR" "qBittorrent${1}_v${NEW_VER}下载失败!" fi } # 解压 _UNZIP(){ [[ -e ${FOLDER_DOWNLOAD_UNZIP} ]] && rm -rf "${FOLDER_DOWNLOAD_UNZIP}" # 如果解压文件夹存在,就删除并重建 mkdir "${FOLDER_DOWNLOAD_UNZIP}" 7z x -bb0 -x'!qbittorrent.pdb' -x'!$PLUGINSDIR' -o"${FOLDER_DOWNLOAD_UNZIP}" "qbittorrent${1}.exe" > /dev/null # 解压 [[ ! -e "${FOLDER_DOWNLOAD_UNZIP}/qbittorrent.exe" ]] && _NOTICE "ERROR" "qBittorrent${1}_v${NEW_VER}解压失败!" rm -rf "qbittorrent${1}.exe" cd "${FOLDER_DOWNLOAD_UNZIP}/translations" rm -f $(ls|egrep -v 'zh_') # 删除非中文语言文件,如果需要全语言,则注释这一行及上一行(行首加井号) } # 压缩 _ZIP(){ cd ${FOLDER_DOWNLOAD} # 复制配置等文件到文件夹内 cp -r "${FOLDER_OTHER}"/* "${FOLDER_DOWNLOAD_UNZIP}" 7z a -bb0 "qBittorrent_v${NEW_VER}${1}_便携版.${FILE_FORMAT}" "qBittorrent" > /dev/null # 压缩 rm -rf "${FOLDER_DOWNLOAD_UNZIP}" # 删除前面解压,已经无用文件夹 [[ ! -e "qBittorrent_v${NEW_VER}${1}_便携版.${FILE_FORMAT}" ]] && _NOTICE "ERROR" "qBittorrent_v${NEW_VER}${1} 压缩失败!" [[ ! -e ${FOLDER_UPLOAD} ]] && mkdir "${FOLDER_UPLOAD}" # 如果上传文件夹不存在,就新建 mv "qBittorrent_v${NEW_VER}${1}_便携版.${FILE_FORMAT}" "${FOLDER_UPLOAD}" # 移动到上传文件夹 } # 上传 _UPLOAD(){ for (( i=0; i <= ((${#ARRAY[*]}-1)); i++ )) do echo -e "${INFO} 开始上传 qBittorrent_v${NEW_VER}${ARRAY[i]}_便携版.${FILE_FORMAT}..." bash ${LZY_PATH} "${FOLDER_UPLOAD}/qBittorrent_v${NEW_VER}${ARRAY[i]}_便携版.${FILE_FORMAT}" "${FOLDER_ID}" [[ ${?} -ne 0 ]] && echo -e "${ERROR} 上传到蓝奏云失败,终止后续!" && exit 1 done #_NOTICE "INFO" "qBittorrent_v${NEW_VER}" # 你可以取消井号注释,这样每次更新也会推送消息至微信 } # 扫尾,控制上传文件夹内文件数量为最大 10 个 _CLEANUP(){ cd ${FOLDER_UPLOAD} FILE_COUNT=$(ls -1 | wc -l) if [[ ${FILE_COUNT} -gt 10 ]]; then REMOVE_COUNT=$((FILE_COUNT-10)) ls -1t | tail -n +11 | xargs rm -f fi } # 消息推送至微信 _NOTICE() { PARAMETER_1="$1" PARAMETER_2="$2" if [[ "${TOKEN}" != "" && "${TOKEN}" != "XXX" ]]; then # 微信推送 Server酱 https://sc.ftqq.com/3.version #wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "https://sc.ftqq.com/${TOKEN}.send?text=${PARAMETER_1}${PARAMETER_2}" # 微信推送 pushplus http://pushplus.hxtrip.com/ wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "http://pushplus.hxtrip.com/customer/push/send?token=${TOKEN}&title=${PARAMETER_1}&content=${PARAMETER_2}" fi if [[ ${PARAMETER_1} == "INFO" ]]; then echo -e "${INFO} ${PARAMETER_2}" else echo -e "${ERROR} ${PARAMETER_2}" fi exit 1 } _CHECK_VER "$1" # 运行脚本的时候传递参数可以指定版本号,例:bash qb_p.sh "4.2.3" for (( i=0; i <= ((${#ARRAY[*]}-1)); i++ )) do [[ -e "${FOLDER_UPLOAD}/qBittorrent_v${NEW_VER}${ARRAY[i]}_便携版.${FILE_FORMAT}" ]] && echo -e "${INFO} qBittorrent_v${NEW_VER}${ARRAY[i]}_便携版.${FILE_FORMAT} 已经存在,跳过..." && continue # 如果压缩包已经存在,就跳过下载、解压、压缩步骤,直接进入下一轮循环(下一个版本) _DOWNLOAD "${ARRAY[i]}" _UNZIP "${ARRAY[i]}" _ZIP "${ARRAY[i]}" done echo -n ${NEW_VER} > ${FILE_OLD_VER} #_UPLOAD # 如果不想上传到蓝奏云,可以把这行注释掉(行首加井号) #_CLEANUP # 控制上传文件夹内文件数量为最大 10 个 ================================================ FILE: qbee_p.sh ================================================ #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # -------------------------------------------------------------- # 系统: ALL # 项目: qBittorrent Enhanced Edition 便携版制作 脚本 # 版本: 1.0.8 # 作者: XIU2 # 官网: https://shell.xiu2.xyz # 项目: https://github.com/XIU2/Shell # -------------------------------------------------------------- # 首次使用脚本前,请先配置好 FOLDER_ID、TOKEN、FOLDER、LZY_PATH 四个变量。 FOLDER_ID="12345" # 蓝奏云网盘要上传文件的文件夹 ID, https://shell.xiu2.xyz/#/md/lanzou_up?id=%e8%8e%b7%e5%8f%96%e6%96%87%e4%bb%b6%e5%a4%b9id TOKEN="XXX" # 微信推送链接 Token,可选 FOLDER="/root/qBittorrentEE" # 脚本工作目录(下载、解压、压缩、上传等操作都在这个文件夹内),脚本会自动创建文件夹 LZY_PATH="/root/lanzou_up.sh" # 蓝奏云上传文件脚本位置, https://shell.xiu2.xyz/#/md/lanzou_up FILE_FORMAT="zip" # 最后打包的压缩包格式,推荐 zip 或 7z UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" FOLDER_DOWNLOAD="${FOLDER}/Download" # 存放下载文件的文件夹 FOLDER_DOWNLOAD_UNZIP="${FOLDER_DOWNLOAD}/qBittorrentEE" # 解压下载文件的文件夹 FOLDER_OTHER="${FOLDER}/Other" # 存放配置等文件文件夹 FOLDER_UPLOAD="${FOLDER}/Upload" # 存放压缩后文件 并 上传的文件夹 FILE_OLD_VER="${FOLDER}/old_ver.txt" # 存放旧版本号的文件(每次执行脚本都会检查最新版本) INFO="[信息]" && ERROR="[错误]" && TIP="[注意]" # 检查最新版本,可以通过 _CHECK_VER "x.x.x" 来指定版本 _CHECK_VER(){ NEW_VER=$1 # 此处是手动指定版本号时的代码 [[ -z ${NEW_VER} ]] && NEW_VER=$(wget -qO- https://api.github.com/repos/c0re100/qBittorrent-Enhanced-Edition/releases| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g;s/release-//') [[ -z ${NEW_VER} ]] && _NOTICE "ERROR" "qBittorrentEE最新版本获取失败!" [[ ! -e ${FOLDER} ]] && mkdir "${FOLDER}" # 如果主文件夹不存在,就新建 [[ ! -e ${FILE_OLD_VER} ]] && echo -n ${NEW_VER} > ${FILE_OLD_VER} # 如果旧版本文件不存在,说明是首次运行,则把当前版本号写入该文件 [[ $(cat ${FILE_OLD_VER}) == ${NEW_VER} ]] && echo -e "${INFO} 已经是最新版本!${NEW_VER} [$(date '+%Y/%m/%d %H:%M')]" && exit 1 echo -e "${INFO} 检测到新版本 ${NEW_VER} 开始下载..." } # 下载 _DOWNLOAD(){ [[ ! -e ${FOLDER_DOWNLOAD} ]] && mkdir "${FOLDER_DOWNLOAD}" # 如果下载文件夹不存在,就新建 cd ${FOLDER_DOWNLOAD} if ! wget --no-check-certificate -q -t2 -T5 -4 -U "${UA}" -O "qbittorrentEE_x64.exe" "https://github.com/c0re100/qBittorrent-Enhanced-Edition/releases/download/release-${NEW_VER}/qbittorrent_enhanced_${NEW_VER}_x64_setup.exe"; then rm -f qbittorrentEE_x64.exe _NOTICE "ERROR" "qBittorrentEE_x64_v${NEW_VER}下载失败!" fi } # 解压 _UNZIP(){ [[ -e ${FOLDER_DOWNLOAD_UNZIP} ]] && rm -rf "${FOLDER_DOWNLOAD_UNZIP}" # 如果解压文件夹存在,就删除并重建 mkdir "${FOLDER_DOWNLOAD_UNZIP}" 7z x -bb0 -x'!qbittorrent.pdb' -x'!$PLUGINSDIR' -o"${FOLDER_DOWNLOAD_UNZIP}" qbittorrentEE_x64.exe > /dev/null # 解压64位文件 [[ ! -e "${FOLDER_DOWNLOAD_UNZIP}/qbittorrent.exe" ]] && _NOTICE "ERROR" "qBittorrentEE_x64_v${NEW_VER} 解压失败!" rm -rf qbittorrentEE_x64.exe cd "${FOLDER_DOWNLOAD_UNZIP}/translations" rm -f $(ls|egrep -v 'zh_') # 删除非中文语言文件,如果需要全语言,则注释这一行及上一行(行首加井号) } # 压缩 _ZIP(){ cd ${FOLDER_DOWNLOAD} # 复制配置等文件到文件夹内 cp -r "${FOLDER_OTHER}"/* "${FOLDER_DOWNLOAD_UNZIP}" 7z a -bb0 "qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}" "qBittorrentEE" "" > /dev/null # 压缩 rm -rf "${FOLDER_DOWNLOAD_UNZIP}" # 删除前面解压,已经无用文件夹 [[ ! -e "qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}" ]] && _NOTICE "ERROR" "qBittorrentEE_v${NEW_VER} 压缩失败!" [[ ! -e ${FOLDER_UPLOAD} ]] && mkdir "${FOLDER_UPLOAD}" # 如果上传文件夹不存在,就新建 mv "qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}" "${FOLDER_UPLOAD}" # 移动到上传文件夹 } #上传 _UPLOAD(){ echo -e "${INFO} 开始上传 qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}..." bash ${LZY_PATH} "${FOLDER_UPLOAD}/qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}" "${FOLDER_ID}" [[ ${?} -ne 0 ]] && echo -e "${ERROR} 上传到蓝奏云失败,终止后续!" && exit 1 #_NOTICE "INFO" "qBittorrentEE_v${NEW_VER}" # 你可以取消井号注释,这样每次更新也会推送消息至微信 } # 扫尾,控制上传文件夹内文件数量为最大 10 个 _CLEANUP(){ cd ${FOLDER_UPLOAD} FILE_COUNT=$(ls -1 | wc -l) if [[ ${FILE_COUNT} -gt 10 ]]; then REMOVE_COUNT=$((FILE_COUNT-10)) ls -1t | tail -n +11 | xargs rm -f fi } # 通知 _NOTICE() { PARAMETER_1="$1" PARAMETER_2="$2" if [[ "${TOKEN}" != "" && "${TOKEN}" != "XXX" ]]; then # 微信推送 Server酱 https://sc.ftqq.com/3.version #wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "https://sc.ftqq.com/${TOKEN}.send?text=${PARAMETER_1}${PARAMETER_2}" # 微信推送 pushplus http://pushplus.hxtrip.com/ wget --no-check-certificate -t2 -T5 -4 -U "${UA}" -qO- "http://pushplus.hxtrip.com/customer/push/send?token=${TOKEN}&title=${PARAMETER_1}&content=${PARAMETER_2}" fi if [[ ${PARAMETER_1} == "INFO" ]]; then echo -e "${INFO} ${PARAMETER_2}" else echo -e "${ERROR} ${PARAMETER_2}" fi exit 1 } _CHECK_VER "$1" # 运行脚本的时候传递参数可以指定版本号,例:bash qbee_p.sh "4.2.5.11" [[ -e "${FOLDER_UPLOAD}/qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT}" ]] && echo -e "${INFO} qBittorrentEE_v${NEW_VER}_x64_便携版.${FILE_FORMAT} 已经存在,跳过..." && exit 1 _DOWNLOAD _UNZIP _ZIP echo -n ${NEW_VER} > ${FILE_OLD_VER} #_UPLOAD # 如果不想上传到蓝奏云,可以把这行注释掉(行首加井号) #_CLEANUP # 控制上传文件夹内文件数量为最大 10 个 ================================================ FILE: service/unblock163_centos ================================================ #!/bin/bash # chkconfig: 2345 90 10 # description: UnblockNeteaseMusic: a tool to unlock NetEase cloud music. ### BEGIN INIT INFO # Provides: UnblockNeteaseMusic # Required-Start: $network $syslog # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: UnblockNeteaseMusic: a tool to unlock NetEase cloud music. # Description: Start or stop the UnblockNeteaseMusic ### END INIT INFO ##### 我的变量 ##### export ENABLE_LOCAL_VIP=true #export ENABLE_HTTPDNS=true #export LOG_LEVEL=debug #################### NAME="UnblockNeteaseMusic" NAME_BIN="UnblockNeteaseMusic" FOLDER="/usr/local/UnblockNeteaseMusic" FILE="${FOLDER}/app.js" FILE_CONF="${FOLDER}/UnblockNeteaseMusic.conf" FILE_LOG="${FOLDER}/UnblockNeteaseMusic.log" FILE_NODE="${FOLDER}/node/bin/node" GREEN_FONT_PREFIX="\033[32m" && RED_FONT_PREFIX="\033[31m" && GREEN_BACKGROUND_PREFIX="\033[42;37m" && RED_BACKGROUND_PREFIX="\033[41;37m" && FONT_COLOR_SUFFIX="\033[0m" INFO="${GREEN_FONT_PREFIX}[信息]${FONT_COLOR_SUFFIX}" && ERROR="${RED_FONT_PREFIX}[错误]${FONT_COLOR_SUFFIX}" && TIP="${GREEN_FONT_PREFIX}[注意]${FONT_COLOR_SUFFIX}" RETVAL=0 _CHECK_PID(){ PID=$(ps -ef |grep "${NAME_BIN}" |grep -v "grep" |grep -v "init.d" |grep -v "service" |awk '{print $2}') if [[ ! -z "${PID}" ]]; then return 0 else return 1 fi } _CONFIG_READ(){ [[ ! -e ${FILE_CONF} ]] && echo -e "${ERROR} ${NAME} 配置文件不存在 !" && exit 1 PORT=$(cat ${FILE_CONF}|grep 'PORT = '|awk -F 'PORT = ' '{print $NF}') SOURCE=$(cat ${FILE_CONF}|grep 'SOURCE = '|awk -F 'SOURCE = ' '{print $NF}') STRICT=$(cat ${FILE_CONF}|grep 'STRICT = '|awk -F 'STRICT = ' '{print $NF}') ENDPOINT=$(cat ${FILE_CONF}|grep 'ENDPOINT = '|awk -F 'ENDPOINT = ' '{print $NF}') ENDPOINTURL=$(cat ${FILE_CONF}|grep 'ENDPOINTURL = '|awk -F 'ENDPOINTURL = ' '{print $NF}') FORCEHOST=$(cat ${FILE_CONF}|grep 'FORCEHOST = '|awk -F 'FORCEHOST = ' '{print $NF}') } _START(){ _CHECK_PID if [[ ${?} == 0 ]]; then echo -e "${INFO} $NAME (PID ${PID}) 正在运行..." && exit 0 else _CONFIG_READ echo -e "${INFO} $NAME 启动中..." ulimit -n 51200 if [[ "${STRICT}" == "NO" ]]; then ARGUMENTS_S="" else ARGUMENTS_S="-s" fi if [[ "${ENDPOINT}" == "NO" ]]; then ARGUMENTS_E="" else ARGUMENTS_E="-e ${ENDPOINTURL}" fi if [[ -z "${FORCEHOST}" ]]; then ARGUMENTS_F="" else ARGUMENTS_F="-f" fi nohup "${FILE_NODE}" "${FILE}" -a 0.0.0.0 -p ${PORT} -o ${SOURCE} ${ARGUMENTS_S} ${ARGUMENTS_E} ${ARGUMENTS_F} ${FORCEHOST} > "${FILE_LOG}" 2>&1 & sleep 2s _CHECK_PID if [[ ${?} == 0 ]]; then echo -e "${INFO} $NAME 启动成功 !" else echo -e "${ERROR} $NAME 启动失败(请运行脚本查看日志错误输出内容) !" fi fi } _STOP(){ _CHECK_PID if [[ ${?} == 0 ]]; then kill -9 "${PID}" RETVAL=${?} if [[ ${RETVAL} == 0 ]]; then echo -e "${INFO} $NAME 停止成功 !" else echo -e "${ERROR} $NAME 停止失败 !" fi else echo -e "${INFO} $NAME 未运行" RETVAL=1 fi } _STATUS(){ _CHECK_PID if [[ ${?} == 0 ]]; then _CONFIG_READ echo -e "${INFO} $NAME (PID ${PID}) 正在运行..." else echo -e "${INFO} $NAME 未运行 !" RETVAL=1 fi } _RESTART(){ _STOP _START } case "$1" in start|stop|restart|status) INDEX=$(echo ${1^^}) _${INDEX} ;; *) echo -e "使用方法: $0 { start | stop | restart | status }" RETVAL=1 ;; esac exit $RETVAL ================================================ FILE: service/unblock163_debian ================================================ #!/bin/bash ### BEGIN INIT INFO # Provides: UnblockNeteaseMusic # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: UnblockNeteaseMusic: a tool to unlock NetEase cloud music. # Description: Start or stop the UnblockNeteaseMusic ### END INIT INFO ##### 我的变量 ##### export ENABLE_LOCAL_VIP=true #export ENABLE_HTTPDNS=true #export LOG_LEVEL=debug #################### NAME="UnblockNeteaseMusic" NAME_BIN="UnblockNeteaseMusic" FOLDER="/usr/local/UnblockNeteaseMusic" FILE="${FOLDER}/app.js" FILE_CONF="${FOLDER}/UnblockNeteaseMusic.conf" FILE_LOG="${FOLDER}/UnblockNeteaseMusic.log" FILE_NODE="${FOLDER}/node/bin/node" GREEN_FONT_PREFIX="\033[32m" && RED_FONT_PREFIX="\033[31m" && GREEN_BACKGROUND_PREFIX="\033[42;37m" && RED_BACKGROUND_PREFIX="\033[41;37m" && FONT_COLOR_SUFFIX="\033[0m" INFO="${GREEN_FONT_PREFIX}[信息]${FONT_COLOR_SUFFIX}" && ERROR="${RED_FONT_PREFIX}[错误]${FONT_COLOR_SUFFIX}" && TIP="${GREEN_FONT_PREFIX}[注意]${FONT_COLOR_SUFFIX}" RETVAL=0 _CHECK_PID(){ PID=$(ps -ef |grep "${NAME_BIN}" |grep -v "grep" |grep -v "init.d" |grep -v "service" |awk '{print $2}') if [[ ! -z "${PID}" ]]; then return 0 else return 1 fi } _CONFIG_READ(){ [[ ! -e ${FILE_CONF} ]] && echo -e "${ERROR} ${NAME} 配置文件不存在 !" && exit 1 PORT=$(cat ${FILE_CONF}|grep 'PORT = '|awk -F 'PORT = ' '{print $NF}') SOURCE=$(cat ${FILE_CONF}|grep 'SOURCE = '|awk -F 'SOURCE = ' '{print $NF}') STRICT=$(cat ${FILE_CONF}|grep 'STRICT = '|awk -F 'STRICT = ' '{print $NF}') ENDPOINT=$(cat ${FILE_CONF}|grep 'ENDPOINT = '|awk -F 'ENDPOINT = ' '{print $NF}') ENDPOINTURL=$(cat ${FILE_CONF}|grep 'ENDPOINTURL = '|awk -F 'ENDPOINTURL = ' '{print $NF}') FORCEHOST=$(cat ${FILE_CONF}|grep 'FORCEHOST = '|awk -F 'FORCEHOST = ' '{print $NF}') } _START(){ _CHECK_PID if [[ ${?} == 0 ]]; then echo -e "${INFO} $NAME (PID ${PID}) 正在运行..." && exit 0 else _CONFIG_READ echo -e "${INFO} $NAME 启动中..." ulimit -n 51200 if [[ "${STRICT}" == "NO" ]]; then ARGUMENTS_S="" else ARGUMENTS_S="-s" fi if [[ "${ENDPOINT}" == "NO" ]]; then ARGUMENTS_E="" else ARGUMENTS_E="-e ${ENDPOINTURL}" fi if [[ -z "${FORCEHOST}" ]]; then ARGUMENTS_F="" else ARGUMENTS_F="-f" fi nohup "${FILE_NODE}" "${FILE}" -a 0.0.0.0 -p ${PORT} -o ${SOURCE} ${ARGUMENTS_S} ${ARGUMENTS_E} ${ARGUMENTS_F} ${FORCEHOST} > "${FILE_LOG}" 2>&1 & sleep 2s _CHECK_PID if [[ ${?} == 0 ]]; then echo -e "${INFO} $NAME 启动成功 !" else echo -e "${ERROR} $NAME 启动失败(请运行脚本查看日志错误输出内容) !" fi fi } _STOP(){ _CHECK_PID if [[ ${?} == 0 ]]; then kill -9 "${PID}" RETVAL=${?} if [[ ${RETVAL} == 0 ]]; then echo -e "${INFO} $NAME 停止成功 !" else echo -e "${ERROR} $NAME 停止失败 !" fi else echo -e "${INFO} $NAME 未运行" RETVAL=1 fi } _STATUS(){ _CHECK_PID if [[ ${?} == 0 ]]; then _CONFIG_READ echo -e "${INFO} $NAME (PID ${PID}) 正在运行..." else echo -e "${INFO} $NAME 未运行 !" RETVAL=1 fi } _RESTART(){ _STOP _START } case "$1" in start|stop|restart|status) INDEX=$(echo ${1^^}) _${INDEX} ;; *) echo -e "使用方法: $0 { start | stop | restart | status }" RETVAL=1 ;; esac exit $RETVAL ================================================ FILE: unblock163.sh ================================================ #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # -------------------------------------------------------------- # 系统: CentOS/Debian/Ubuntu # 项目: 解锁网易云音乐 # 版本: 1.1.9 # 作者: XIU2 # 官网: https://shell.xiu2.xyz # 项目: https://github.com/XIU2/Shell # -------------------------------------------------------------- NOW_VER_SHELL="1.1.5" NEW_VER_NODE_BACKUP="16.9.1" FILEPASH=$(cd "$(dirname "$0")"; pwd) FILEPASH_NOW=$(echo -e "${FILEPASH}"|awk -F "$0" '{print $1}') NAME="UnblockNeteaseMusic" NAME_PID="UnblockNeteaseMusic" NAME_SERVICE="unblock163" FOLDER="/usr/local/UnblockNeteaseMusic" FILE="${FOLDER}/app.js" FOLDER_NODE="/usr/local/UnblockNeteaseMusic/node" FILE_NODE="${FOLDER_NODE}/bin/node" FILE_CONF="${FOLDER}/UnblockNeteaseMusic.conf" FILE_LOG="${FOLDER}/UnblockNeteaseMusic.log" FILE_CRONTAB="/usr/bin/crontab" GREEN_FONT_PREFIX="\033[32m" && RED_FONT_PREFIX="\033[31m" && GREEN_BACKGROUND_PREFIX="\033[42;37m" && RED_BACKGROUND_PREFIX="\033[41;37m" && FONT_COLOR_SUFFIX="\033[0m" INFO="${GREEN_FONT_PREFIX}[信息]${FONT_COLOR_SUFFIX}" && ERROR="${RED_FONT_PREFIX}[错误]${FONT_COLOR_SUFFIX}" && TIP="${GREEN_FONT_PREFIX}[注意]${FONT_COLOR_SUFFIX}" # 获取各项信息 _CHECK_INFO(){ if [[ "${1}" == "ROOT" ]]; then [[ $EUID != 0 ]] && echo -e "${ERROR} 当前非ROOT账号(或没有ROOT权限),无法继续操作,请更换ROOT账号或使用 ${GREEN_BACKGROUND_PREFIX}sudo su${FONT_COLOR_SUFFIX} 命令获取临时ROOT权限(执行后可能会提示输入当前账号的密码)。" && exit 1 elif [[ "${1}" == "OS" ]]; then if [[ -f /etc/redhat-release ]]; then SYSTEM_RELEASE="centos" elif cat /etc/issue | grep -q -E -i "debian"; then SYSTEM_RELEASE="debian" elif cat /etc/issue | grep -q -E -i "ubuntu"; then SYSTEM_RELEASE="ubuntu" elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then SYSTEM_RELEASE="centos" elif cat /proc/version | grep -q -E -i "debian"; then SYSTEM_RELEASE="debian" elif cat /proc/version | grep -q -E -i "ubuntu"; then SYSTEM_RELEASE="ubuntu" elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then SYSTEM_RELEASE="centos" fi SYSTEM_BIT=$(uname -m) elif [[ "${1}" == "INSTALL_STATUS" ]]; then [[ ! -e "${FILE}" ]] && echo -e "${ERROR} ${NAME} 没有安装,请检查 !" && exit 1 elif [[ "${1}" == "CRONTAB_INSTALL_STATUS" ]]; then if [[ ! -e "${FILE_CRONTAB}" ]]; then echo -e "${ERROR} Crontab 没有安装,开始安装..." if [[ "${SYSTEM_RELEASE}" == "centos" ]]; then yum install crond -y else apt-get install cron -y fi if [[ ! -e "${FILE_CRONTAB}" ]]; then echo -e "${ERROR} Crontab 安装失败,请检查!" && exit 1 else echo -e "${INFO} Crontab 安装成功!" fi fi elif [[ "${1}" == "PID" ]]; then PID=$(ps -ef| grep "${NAME_PID}"| grep -v "grep" | grep -v "init.d" |grep -v "service" |awk '{print $2}') elif [[ "${1}" == "NEW_VER_NODE" ]]; then NEW_VER_NODE=$(wget -qO- https://nodejs.org/en/download/current/| grep "Latest Current Version"| awk -F '' '{print $2}'| awk -F '' '{print $1}') [[ -z "${NEW_VER_NODE}" ]] && NEW_VER_NODE="${NEW_VER_NODE_BACKUP}" echo -e "${INFO} 检测到 Node 最新版本为 [ ${NEW_VER_NODE} ]" elif [[ "${1}" == "IPV4" ]]; then IPV4=$(wget -qO- -4 -t1 -T2 ipinfo.io/ip) if [[ -z "${IPV4}" ]]; then IPV4=$(wget -qO- -4 -t1 -T2 api.ip.sb/ip) if [[ -z "${IPV4}" ]]; then IPV4=$(wget -qO- -4 -t1 -T2 members.3322.org/dyndns/getip) if [[ -z "${IPV4}" ]]; then IPV4="IPv4地址获取失败" fi fi fi elif [[ "${1}" == "IP_ADDRESS" ]]; then if [[ ! -z "${TARGET_IP}" ]]; then for((IP_ADDRESS_INTEGER = ${TARGET_IP_TOTAL}; IP_ADDRESS_INTEGER >= 1; IP_ADDRESS_INTEGER--)) do IP_ADDRESS_IP=$(echo "${TARGET_IP}" |sed -n "$IP_ADDRESS_INTEGER"p) IP_ADDRESS_IP_ADDRESS=$(wget -qO- -t2 -T3 http://freeapi.ipip.net/${IP_ADDRESS_IP}|sed 's/\"//g;s/,//g;s/\[//g;s/\]//g') echo -e "${GREEN_FONT_PREFIX}${IP_ADDRESS_IP}${FONT_COLOR_SUFFIX} (${IP_ADDRESS_IP_ADDRESS})" sleep 1s done fi fi } # 安装前置依赖 _INSTALLATION_DEPENDENCY(){ GIT_VER=$(git --version) XZ_VER=$(xz -V) TAR_VER=$(tar --version) [[ -z "${GIT_VER}" ]] && PACK_NAME="${pack_name}git " [[ -z "${XZ_VER}" ]] && pack_name="${pack_name}xz " [[ -z "${TAR_VER}" ]] && pack_name="${pack_name}tar " if [[ ! -z "${PACK_NAME}" ]]; then if [[ "${SYSTEM_RELEASE}" == "centos" ]]; then yum update yum install -y ${PACK_NAME} else apt-get update apt-get install -y ${PACK_NAME} fi fi GIT_VER=$(git --version) XZ_VER=$(xz -V) TAR_VER=$(tar --version) [[ -z "${GIT_VER}" ]] && echo -e "${ERROR} 依赖 Git 安装失败,请检查!" && exit 1 [[ -z "${XZ_VER}" ]] && echo -e "${ERROR} 解压缩依赖 xz 安装失败,请检查!" && exit 1 [[ -z "${TAR_VER}" ]] && echo -e "${ERROR} 解压缩依赖 tar 安装失败,请检查!" && exit 1 # 修改服务器时区为北京时间 MD5_SHANGHAI=$(md5sum /usr/share/zoneinfo/Asia/Shanghai | awk '{print $1}') MD5_LOCALTIME=$(md5sum /etc/localtime | awk '{print $1}') [[ "${MD5_SHANGHAI}" != "${MD5_LOCALTIME}" ]] && \cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime } # 下载主程序 _DOWNLOAD(){ [[ -e "${FOLDER}" ]] && rm -rf "${FOLDER}" echo -e "${INFO} 开始安装 ${NAME} ..." env GIT_SSL_NO_VERIFY=true git clone -b enhanced https://ghproxy.com/https://github.com/UnblockNeteaseMusic/server.git "${FOLDER}" [[ ! -e "${FOLDER}" ]] && echo -e "${ERROR} ${NAME} 下载失败 !" && _INSTALLATION_FAILURE_CLEANUP echo -e "${INFO} ${NAME} 安装完成,开始安装其依赖 Node ..." _DOWNLOAD_NODE } # 下载NODE _DOWNLOAD_NODE(){ cd "${FOLDER}" [[ -e "${FOLDER_NODE}" ]] && rm -rf "${FOLDER_NODE}" if [[ "${SYSTEM_BIT}" == "x86_64" ]]; then FILE_NAME="node-v${NEW_VER_NODE}-linux-x64" wget --no-check-certificate "https://nodejs.org/dist/v${NEW_VER_NODE}/${FILE_NAME}.tar.xz" else FILE_NAME="node-v${NEW_VER_NODE}-linux-arm64" wget --no-check-certificate "https://nodejs.org/dist/v${NEW_VER_NODE}/${FILE_NAME}.tar.xz" fi [[ ! -e "${FILE_NAME}.tar.xz" ]] && echo -e "${ERROR} 依赖 Node 压缩包下载失败!" && _INSTALLATION_FAILURE_CLEANUP xz -d "${FILE_NAME}.tar.xz" [[ ! -e "${FILE_NAME}.tar" ]] && echo -e "${ERROR} 依赖 Node 压缩包解压失败(可能是 压缩包损坏 或者 没有安装解压工具 xz)!" && _INSTALLATION_FAILURE_CLEANUP tar -xf "${FILE_NAME}.tar" [[ ! -e "${FILE_NAME}" ]] && echo -e "${ERROR} 依赖 Node 压缩包解压失败(可能是 压缩包损坏 或者 没有安装解压工具 tar)!" && _INSTALLATION_FAILURE_CLEANUP mv "${FILE_NAME}" "node" [[ ! -e "${FOLDER_NODE}" ]] && echo -e "${ERROR} 依赖 Node 文件夹重命名失败!" && _INSTALLATION_FAILURE_CLEANUP chmod +x "{FILE_NODE}" rm "${FILE_NAME}"* } # 安装系统服务 _SERVICE(){ if [[ "${SYSTEM_RELEASE}" = "centos" ]]; then wget --no-check-certificate "https://shell.xiu2.xyz/service/${NAME_SERVICE}_centos" -O "/etc/init.d/${NAME_SERVICE}" [[ ! -e "/etc/init.d/${NAME_SERVICE}" ]] && echo -e "${ERROR} ${NAME} 服务管理脚本下载失败 !" && _INSTALLATION_FAILURE_CLEANUP chmod +x "/etc/init.d/${NAME_SERVICE}" chkconfig --add "${NAME_SERVICE}" chkconfig "${NAME_SERVICE}" on else wget --no-check-certificate "https://shell.xiu2.xyz/service/${NAME_SERVICE}_debian" -O "/etc/init.d/${NAME_SERVICE}" [[ ! -e "/etc/init.d/${NAME_SERVICE}" ]] && echo -e "${ERROR} ${NAME} 服务管理脚本下载失败 !" && _INSTALLATION_FAILURE_CLEANUP chmod +x "/etc/init.d/${NAME_SERVICE}" update-rc.d -f "${NAME_SERVICE}" defaults fi echo -e "${INFO} ${NAME} 服务管理脚本下载完成 !" } # 安装失败善后处理 _INSTALLATION_FAILURE_CLEANUP() { [[ -e "${FOLDER}" ]] && rm -rf "${FOLDER}" [[ -e "/etc/init.d/${NAME_SERVICE}" ]] && rm -rf "${FOLDER}" exit 1 } # 读入/写出配置 _CONFIG_OPERATION(){ if [[ "${1}" == "READ" ]]; then [[ ! -e "${FILE_CONF}" ]] && echo -e "${ERROR} ${NAME} 配置文件不存在 !" && exit 1 PORT=$(cat ${FILE_CONF}|grep 'PORT = '|awk -F 'PORT = ' '{print $NF}') SOURCE=$(cat ${FILE_CONF}|grep 'SOURCE = '|awk -F 'SOURCE = ' '{print $NF}') STRICT=$(cat ${FILE_CONF}|grep 'STRICT = '|awk -F 'STRICT = ' '{print $NF}') ENDPOINT=$(cat ${FILE_CONF}|grep 'ENDPOINT = '|awk -F 'ENDPOINT = ' '{print $NF}') ENDPOINTURL=$(cat ${FILE_CONF}|grep 'ENDPOINTURL = '|awk -F 'ENDPOINTURL = ' '{print $NF}') FORCEHOST=$(cat ${FILE_CONF}|grep 'FORCEHOST = '|awk -F 'FORCEHOST = ' '{print $NF}') elif [[ "${1}" == "WRITE" ]]; then cat > ${FILE_CONF}<<-EOF PORT = ${PORT} SOURCE = ${SOURCE} STRICT = ${STRICT} ENDPOINT = ${ENDPOINT} ENDPOINTURL = ${ENDPOINTURL} FORCEHOST = ${FORCEHOST} EOF fi } # 设置选择 _SET(){ _CHECK_INFO "INSTALL_STATUS" echo && echo -e "你要做什么? ${GREEN_FONT_PREFIX}1.${FONT_COLOR_SUFFIX} 修改 代理端口 ${GREEN_FONT_PREFIX}2.${FONT_COLOR_SUFFIX} 修改 音源排序 ${GREEN_FONT_PREFIX}3.${FONT_COLOR_SUFFIX} 修改 严格模式 ${GREEN_FONT_PREFIX}4.${FONT_COLOR_SUFFIX} 修改 配置 ENDPOINT ${GREEN_FONT_PREFIX}5.${FONT_COLOR_SUFFIX} 修改 指定 IP ${GREEN_FONT_PREFIX}6.${FONT_COLOR_SUFFIX} 修改 全部配置" && echo read -e -p "(默认: 取消):" SET_INDEX [[ -z "${SET_INDEX}" ]] && echo "已取消..." && exit 1 if [[ "${SET_INDEX}" == "1" ]]; then _CONFIG_OPERATION "READ" OLD_PORT="${PORT}" _PORT_SET _CONFIG_OPERATION "WRITE" _IPTABLES_OPTION "DEL" "${OLD_PORT}" _IPTABLES_OPTION "ADD" _RESTART elif [[ "${SET_INDEX}" == "2" ]]; then _CONFIG_OPERATION "READ" _SOURCE_SET _CONFIG_OPERATION "WRITE" _RESTART elif [[ "${SET_INDEX}" == "3" ]]; then _CONFIG_OPERATION "READ" _STRICT_SET _CONFIG_OPERATION "WRITE" _RESTART elif [[ "${SET_INDEX}" == "4" ]]; then _CONFIG_OPERATION "READ" _ENDPOINT_SET _CONFIG_OPERATION "WRITE" _RESTART elif [[ "${SET_INDEX}" == "5" ]]; then _CONFIG_OPERATION "READ" _FORCEHOST_SET _CONFIG_OPERATION "WRITE" _RESTART elif [[ "${SET_INDEX}" == "6" ]]; then _CONFIG_OPERATION "READ" OLD_PORT="${PORT}" _PORT_SET _SOURCE_SET _STRICT_SET _ENDPOINT_SET _FORCEHOST_SET _CONFIG_OPERATION "WRITE" _IPTABLES_OPTION "DEL" "${OLD_PORT}" _IPTABLES_OPTION "ADD" _RESTART else echo -e "${ERROR} 请输入正确的数字! [1-6]" && exit 1 fi } # 修改 端口 _PORT_SET() { while true do echo -e "请输入要使用的代理端口。 [1-65535]" echo -e "${TIP} 如果你在本地通过 Hosts 方式使用该代理,那么只能选择 80 端口,格式示例:80" echo -e "${TIP} 如果需要搭配自签证书,那么还需要配置 HTTPS 端口,格式:HTTP:HTTPS,两个端口不能相同,格式示例:80:443" read -e -p "(默认: 80):" PORT [[ -z "${PORT}" ]] && PORT="80" PORT_FORMAT_DETECTION=$(echo "${PORT}"|grep ":") if [[ -z ${PORT_FORMAT_DETECTION} ]]; then echo $((${PORT}+0)) &>/dev/null if [[ ${?} == 0 ]]; then if (( ${PORT} >= 1 )) && (( ${PORT} <= 65536 )); then echo && echo "------------------------" echo -e " 代理端口 : ${RED_BACKGROUND_PREFIX} ${PORT} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo break else echo "输入错误,请输入正确的端口。" fi else echo "输入错误,请输入正确的端口。" fi else echo && echo "------------------------" echo -e " 代理端口 : ${RED_BACKGROUND_PREFIX} ${PORT} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo break fi done } # 修改 音源 _SOURCE_SET() { echo -e "请输入要使用的音源排序。 [kuwo kugou pyncmd qq migu bilibili joox youtube]" echo -e "${TIP} 音源排序指的是,无版权音乐会根据此处顺序优先匹配首位音源,如果匹配到就返回,反之就继续往后匹配。" echo -e "${TIP} 不同音源之间请用空格隔开。" read -e -p "(默认: kuwo kugou):" SOURCE [[ -z "${SOURCE}" ]] && SOURCE="kuwo kugou" SOURCE=$(echo "${SOURCE}"|sed -e 's/^ *//g;s/ *$//g') echo && echo "------------------------" echo -e " 音源排序 : ${RED_BACKGROUND_PREFIX} ${SOURCE} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo } # 修改 严格模式 _STRICT_SET() { echo -e "是否启用严格模式?[Y/n]" echo -e "${TIP} 启用严格模式后,本代理仅允许网易云音乐域名访问,即本地设备只能通过 Host 或 PAC 使用,强烈建议开启,否则所有设备流量都会经过本代理。" read -e -p "(默认:N [禁用]):" STRICT [[ -z "${STRICT}" ]] && STRICT="N" if [[ "${STRICT}" == [Nn] ]]; then STRICT="NO" else STRICT="YES" if [[ "${ENDPOINT}" == "YES" && "${ENDPOINTURL}" != "http://music.163.com" ]]; then ENDPOINT="NO" echo -e " 检测到 ENDPOINTURL 服务器不是网易云,强制关闭ENDPOINT功能。" fi fi echo && echo "------------------------" echo -e " 严格模式 : ${RED_BACKGROUND_PREFIX} ${STRICT} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo } # 配置 ENDPOINT _ENDPOINT_SET() { echo -e "是否启用 ENDPOINT 功能?[Y/n]" echo -e "${TIP} 启用 ENDPOINT 功能后,需要指定虚拟网易云音乐的域名。如不清楚作用,请勿开启。" read -e -p "(默认:N [禁用]):" ENDPOINT [[ -z "${ENDPOINT}" ]] && ENDPOINT="N" if [[ "${ENDPOINT}" == [Nn] ]]; then ENDPOINT="NO" else ENDPOINT="YES" echo -e "指定ENDPOINT服务器:" read -e -p "(默认为:http://music.163.com ):" ENDPOINTURL [[ -z "${ENDPOINTURL}" ]] && ENDPOINTURL="http://music.163.com" if [[ "${ENDPOINTURL}" != "http://music.163.com" ]]; then STRICT="NO" echo -e " 检测到 ENDPOINTURL 服务器不是网易云,强制禁用严格模式。" fi fi echo && echo "------------------------" echo -e " ENDPOINT模式 : ${RED_BACKGROUND_PREFIX} ${ENDPOINT} ${FONT_COLOR_SUFFIX}" echo -e " ENDPOINTURL : ${RED_BACKGROUND_PREFIX} ${ENDPOINTURL} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo } # 修改 指定网易服务器 IP _FORCEHOST_SET() { echo -e "指定网易服务器 IP,不懂请跳过。[格式:IPv4]" read -e -p "(默认为空):" FORCEHOST echo && echo "------------------------" echo -e " 指定 IP : ${RED_BACKGROUND_PREFIX} ${FORCEHOST} ${FONT_COLOR_SUFFIX}" echo "------------------------" && echo } # 安装 _INSTALL() { _CHECK_INFO "ROOT" [[ -e "${FILE}" ]] && echo -e "${ERROR} 检测到 ${NAME} 已安装 !" && exit 1 echo -e "${INFO} 开始设置 用户配置..." _PORT_SET _SOURCE_SET _STRICT_SET _ENDPOINT_SET _FORCEHOST_SET echo -e "${INFO} 开始安装/配置 依赖..." _INSTALLATION_DEPENDENCY echo -e "${INFO} 开始下载/安装..." _CHECK_INFO "NEW_VER_NODE" _DOWNLOAD echo -e "${INFO} 开始下载/安装 服务脚本(init)..." _SERVICE echo -e "${INFO} 开始写入 配置文件..." _CONFIG_OPERATION "WRITE" echo -e "${INFO} 开始设置 iptables防火墙..." _IPTABLES_OPTION "SET" echo -e "${INFO} 开始添加 iptables防火墙规则..." _IPTABLES_OPTION "ADD" echo -e "${INFO} 开始保存 iptables防火墙规则..." _IPTABLES_OPTION "SAVE" echo -e "${INFO} 所有步骤 安装完毕,开始启动..." _START } # 更新主程序 _UPDATE(){ _CHECK_INFO "INSTALL_STATUS" echo -e "\n${INFO} 开始更新..." cd "${FOLDER}" env GIT_SSL_NO_VERIFY=true git pull _UPDATE_NODE echo -e "${INFO} 更新完成!开始重启...\n" _RESTART } # 更新NODE _UPDATE_NODE(){ echo -e "\n${INFO} 开始更新NODE..." _CHECK_INFO "NEW_VER_NODE" NOW_VER_NODE=$("${FILE_NODE}" -v | awk -F 'v' '{print $2}') if [[ "${NEW_VER_NODE}}" != "${NOW_VER_NODE}}" ]]; then _DOWNLOAD_NODE echo -e "脚本已更新为最新版本[ ${NEW_VER_NODE} ] !" else echo -e "NODE当前为最新版本不需更新 !" fi } # 卸载 _UNINSTALL() { _CHECK_INFO "INSTALL_STATUS" echo -e "确定要卸载 ${NAME} ? (y/N)\n" read -e -p "(默认: n):" UNINSTALL_YN [[ -z "${UNINSTALL_YN}" ]] && UNINSTALL_YN="n" if [[ "${UNINSTALL_YN}" == [Yy] ]]; then _CHECK_INFO "PID" [[ ! -z "${PID}" ]] && kill -9 "${PID}" if [[ -e ${FILE_CONF} ]]; then _CONFIG_OPERATION "READ" _IPTABLES_OPTION "DEL" _IPTABLES_OPTION "SAVE" fi [[ -e "${FOLDER}" ]] && rm -rf "${FOLDER}" if [[ -e "/etc/init.d/${NAME_SERVICE}" ]];then if [[ "${SYSTEM_RELEASE}" = "centos" ]]; then chkconfig --del "${NAME_SERVICE}" else update-rc.d -f "${NAME_SERVICE}" remove fi rm -rf "/etc/init.d/${NAME_SERVICE}" fi echo -e "\n${INFO} ${NAME} 卸载完成 !\n" else echo -e "\n${INFO} 卸载已取消...\n" fi } # 启动 _START(){ _CHECK_INFO "INSTALL_STATUS" _CHECK_INFO "PID" [[ ! -z "${PID}" ]] && echo -e "${ERROR} ${NAME} 正在运行,请检查 !" && exit 1 "/etc/init.d/${NAME_SERVICE}" start _CHECK_INFO "PID" [[ ! -z "${PID}" ]] && _VIEW } # 停止 _STOP(){ _CHECK_INFO "INSTALL_STATUS" _CHECK_INFO "PID" [[ -z "${PID}" ]] && echo -e "${ERROR} ${NAME} 没有运行,请检查 !" && exit 1 "/etc/init.d/${NAME_SERVICE}" stop } # 重启 _RESTART(){ _CHECK_INFO "INSTALL_STATUS" _CHECK_INFO "PID" [[ ! -z "${PID}" ]] && "/etc/init.d/${NAME_SERVICE}" stop "/etc/init.d/${NAME_SERVICE}" start _CHECK_INFO "PID" [[ ! -z "${PID}" ]] && _VIEW } # 查看 配置信息 _VIEW(){ _CHECK_INFO "INSTALL_STATUS" _CONFIG_OPERATION "READ" _CHECK_INFO "IPV4" PORT_HTTP=$(echo ${PORT} | awk -F ':' '{print $(NF-1)}') clear echo -e "\n UnblockNeteaseMusic 配置信息: ------------------------ 本机地址: ${GREEN_FONT_PREFIX}${IPV4}${FONT_COLOR_SUFFIX} 代理端口: ${GREEN_FONT_PREFIX}${PORT}${FONT_COLOR_SUFFIX} 音源排序: ${GREEN_FONT_PREFIX}${SOURCE}${FONT_COLOR_SUFFIX} 严格模式: ${GREEN_FONT_PREFIX}${STRICT}${FONT_COLOR_SUFFIX} ENDPOINT模式: ${GREEN_FONT_PREFIX}${ENDPOINT}${FONT_COLOR_SUFFIX} ENDPOINTURL: ${GREEN_FONT_PREFIX}${ENDPOINTURL}${FONT_COLOR_SUFFIX} 指定 IP: ${GREEN_FONT_PREFIX}${FORCEHOST}${FONT_COLOR_SUFFIX}\n PAC 地址: ${RED_FONT_PREFIX}http://${IPV4}:${PORT_HTTP}/proxy.pac${FONT_COLOR_SUFFIX}\n" } # 查看 日志 _VIEW_LOG(){ _CHECK_INFO "INSTALL_STATUS" [[ ! -e "${FILE_LOG}" ]] && echo -e "${ERROR} ${NAME} 日志文件不存在 !" && exit 1 echo -e "\n${TIP} 按 ${RED_FONT_PREFIX}Ctrl+C${FONT_COLOR_SUFFIX} 终止查看日志\n 如果需要查看完整日志内容,请使用 ${RED_FONT_PREFIX}cat ${FILE_LOG}${FONT_COLOR_SUFFIX} 命令。" tail -f "${FILE_LOG}" } # 查看 链接信息 _VIEW_CONNECTION_INFO_WITH(){ _CONFIG_OPERATION "READ" PORT_FORMAT_DETECTION=$(echo "${PORT}"|grep ":") [[ ! -z ${PORT_FORMAT_DETECTION} ]] && PORT=$(echo "${PORT}"|sed 's/:/ /g') for ONE_PORT in ${PORT} do TARGET_IP=$(ss state connected sport = :${ONE_PORT} -tn|sed '1d'|awk '{print $NF}'|awk -F ':' '{print $(NF-1)}'|sort -u) if [[ -z ${TARGET_IP} ]]; then TARGET_IP_TOTAL="0" echo -e "端口: ${GREEN_FONT_PREFIX}"${ONE_PORT}"${FONT_COLOR_SUFFIX}\t 链接IP总数: ${GREEN_FONT_PREFIX}"${TARGET_IP_TOTAL}"${FONT_COLOR_SUFFIX}\t 当前链接IP: " else TARGET_IP_TOTAL=$(echo -e "${TARGET_IP}"|wc -l) if [[ "${1}" == "IP_ADDRESS" ]]; then echo -e "端口: ${GREEN_FONT_PREFIX}"${ONE_PORT}"${FONT_COLOR_SUFFIX}\t 链接IP总数: ${GREEN_FONT_PREFIX}"${TARGET_IP_TOTAL}"${FONT_COLOR_SUFFIX}\t 当前链接IP: " _CHECK_INFO "IP_ADDRESS" echo else TARGET_IP=$(echo -e "\n${TARGET_IP}") echo -e "端口: ${GREEN_FONT_PREFIX}"${ONE_PORT}"${FONT_COLOR_SUFFIX}\t 链接IP总数: ${GREEN_FONT_PREFIX}"${TARGET_IP_TOTAL}"${FONT_COLOR_SUFFIX}\t 当前链接IP: ${GREEN_FONT_PREFIX}${TARGET_IP}${FONT_COLOR_SUFFIX}\n" fi fi TARGET_IP="" done } # 选择 链接信息 _VIEW_CONNECTION_INFO(){ #_CHECK_INFO "INSTALL_STATUS" echo && echo -e "请选择要显示的格式: ${GREEN_FONT_PREFIX}1.${FONT_COLOR_SUFFIX} 显示 IP 格式 ${GREEN_FONT_PREFIX}2.${FONT_COLOR_SUFFIX} 显示 IP+IP归属地 格式" && echo read -e -p "(默认: 1):" VIEW_CONNECTION_INFO_INDEX [[ -z "${VIEW_CONNECTION_INFO_INDEX}" ]] && VIEW_CONNECTION_INFO_INDEX="1" if [[ "${VIEW_CONNECTION_INFO_INDEX}" == "1" ]]; then _VIEW_CONNECTION_INFO_WITH elif [[ "${VIEW_CONNECTION_INFO_INDEX}" == "2" ]]; then echo -e "${TIP} 检测IP归属地(IP源:ipip.net),如果IP较多,可能时间会比较长..." _VIEW_CONNECTION_INFO_WITH "IP_ADDRESS" else echo -e "${ERROR} 请输入正确的数字 [1-2]" && exit 1 fi } # 配置 防火墙 _IPTABLES_OPTION(){ if [[ "${1}" == "ADD" ]]; then if [[ ! "${2}" ]]; then ADD_PORT="${PORT}" else ADD_PORT="${2}" fi iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ADD_PORT} -j ACCEPT iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${ADD_PORT} -j ACCEPT ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ADD_PORT} -j ACCEPT ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport ${ADD_PORT} -j ACCEPT elif [[ "${1}" == "DEL" ]]; then if [[ ! "${2}" ]]; then DEL_PORT="${PORT}" else DEL_PORT="${2}" fi iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${DEL_PORT} -j ACCEPT iptables -D INPUT -m state --state NEW -m udp -p udp --dport ${DEL_PORT} -j ACCEPT ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${DEL_PORT} -j ACCEPT ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport ${DEL_PORT} -j ACCEPT elif [[ "${1}" == "SAVE" ]]; then if [[ "${SYSTEM_RELEASE}" == "centos" ]]; then service iptables save service ip6tables save else iptables-save > /etc/iptables.up.rules ip6tables-save > /etc/ip6tables.up.rules fi elif [[ "${1}" == "SET" ]]; then if [[ "${SYSTEM_RELEASE}" == "centos" ]]; then service iptables save service ip6tables save chkconfig --level 2345 iptables on chkconfig --level 2345 ip6tables on else iptables-save > /etc/iptables.up.rules ip6tables-save > /etc/ip6tables.up.rules echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules\n/sbin/ip6tables-restore < /etc/ip6tables.up.rules' > /etc/network/if-pre-up.d/iptables chmod +x /etc/network/if-pre-up.d/iptables fi fi } # 更新脚本 _UPDATE_SHELL(){ NEW_VER_SHELL=$(wget --no-check-certificate -qO- -t1 -T3 "https://shell.xiu2.xyz/unblock163.sh"|grep 'NOW_VER_SHELL="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1) [[ -z "${NEW_VER_SHELL}" ]] && echo -e "${ERROR} 获取脚本最新版本失败!无法链接到 Github !" && exit 1 #if [[ "${NEW_VER_SHELL}" != "${NOW_VER_SHELL}" ]]; then if [[ -e "/etc/init.d/${NAME_SERVICE}" ]]; then rm -rf "/etc/init.d/${NAME_SERVICE}" _SERVICE fi wget -N --no-check-certificate "https://shell.xiu2.xyz/unblock163.sh" chmod +x "${FILEPASH_NOW}/unblock163.sh" echo -e "脚本已更新为最新版本[ ${NEW_VER_SHELL} ] !\n${TIP} 因为更新方式为直接覆盖当前运行的脚本,所以可能下面会提示一些报错,无视即可。" && exit 0 #else #echo -e "脚本当前为最新版本[ ${NEW_VER_SHELL} ] !" && exit 0 #fi } # 脚本起始位置 _CHECK_INFO "OS" [[ "${SYSTEM_RELEASE}" != "centos" ]] && [[ "${SYSTEM_RELEASE}" != "debian" ]] && [[ "${SYSTEM_RELEASE}" != "ubuntu" ]] && echo -e "${ERROR} 本脚本不支持当前系统 ${SYSTEM_RELEASE} !" && exit 1 [[ "${SYSTEM_BIT}" != "x86_64" ]] && [[ "${SYSTEM_BIT}" != "aarch64" ]] && echo -e "${ERROR} ${NAME} 的依赖 Node 不支持当前系统位数 ${SYSTEM_BIT} !" && exit 1 echo && echo -e " UnblockNeteaseMusic 一键脚本 ${RED_FONT_PREFIX}[v${NOW_VER_SHELL}]${FONT_COLOR_SUFFIX} ${GREEN_FONT_PREFIX} 0.${FONT_COLOR_SUFFIX} 更新脚本 ---------- ${GREEN_FONT_PREFIX} 1.${FONT_COLOR_SUFFIX} 安装 ${GREEN_FONT_PREFIX} 2.${FONT_COLOR_SUFFIX} 更新 ${GREEN_FONT_PREFIX} 3.${FONT_COLOR_SUFFIX} 卸载 ---------- ${GREEN_FONT_PREFIX} 4.${FONT_COLOR_SUFFIX} 启动 ${GREEN_FONT_PREFIX} 5.${FONT_COLOR_SUFFIX} 停止 ${GREEN_FONT_PREFIX} 6.${FONT_COLOR_SUFFIX} 重启 ---------- ${GREEN_FONT_PREFIX} 7.${FONT_COLOR_SUFFIX} 设置 配置信息 ${GREEN_FONT_PREFIX} 8.${FONT_COLOR_SUFFIX} 查看 配置信息 ${GREEN_FONT_PREFIX} 9.${FONT_COLOR_SUFFIX} 查看 日志信息 ${GREEN_FONT_PREFIX}10.${FONT_COLOR_SUFFIX} 查看 链接信息\n" if [[ -e "${FILE}" ]]; then _CHECK_INFO "PID" if [[ ! -z "${PID}" ]]; then echo -e " 当前状态: ${GREEN_FONT_PREFIX}已安装${FONT_COLOR_SUFFIX} 并 ${GREEN_FONT_PREFIX}已启动${FONT_COLOR_SUFFIX}" else echo -e " 当前状态: ${GREEN_FONT_PREFIX}已安装${FONT_COLOR_SUFFIX} 但 ${RED_FONT_PREFIX}未启动${FONT_COLOR_SUFFIX}" fi else echo -e " 当前状态: ${RED_FONT_PREFIX}未安装${FONT_COLOR_SUFFIX}" fi echo read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) _UPDATE_SHELL ;; 1) _INSTALL ;; 2) _UPDATE ;; 3) _UNINSTALL ;; 4) _START ;; 5) _STOP ;; 6) _RESTART ;; 7) _SET ;; 8) _VIEW ;; 9) _VIEW_LOG ;; 10) _VIEW_CONNECTION_INFO ;; *) echo "请输入正确数字 [0-10]" ;; esac