Committer: root <root@fruw.org>

This commit is contained in:
root 2023-07-29 16:42:28 +05:00
parent d46885fdc8
commit 6afc76eb9c
74 changed files with 5643 additions and 0 deletions

View File

@ -0,0 +1,235 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero 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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
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 AGPL, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,2 @@
# ad-ald-migration-tool

View File

@ -0,0 +1,108 @@
package main
import (
"fmt"
"io/ioutil"
"math/rand"
"regexp"
"strings"
"time"
)
var trimVariable = [5]string{`displayName: `, `sAMAccountName: `,
`memberOf: CN=`, `mobile: `, `mail: `}
var department = []string{}
var userVariable = []string{}
var users = make(map[int][]string)
var letters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func main() {
backupFile, err := ioutil.ReadFile("/home/user/Documents/output_file.ldif")
checkError(err)
//userTemplate, err := ioutil.ReadFile("/home/user/Documents/templateUser")
checkError(err)
//departamentTemplate, err := ioutil.ReadFile("/home/user/Documents/templateDepartament")
checkError(err)
//fmt.Println(departamentTemplate, userTemplate)
paragraph := strings.Split(string(backupFile), "\n\r\n")
for i := range paragraph {
if i > 0 {
rand.Seed(time.Now().UnixNano())
userVariable = append(userVariable, "test")
userVariable = append(userVariable, fmt.Sprintln(2500+i))
userVariable = append(userVariable, fmt.
Sprintln(randSeq(8)+"-"+randSeq(4)+"-"+randSeq(4)+"-"+randSeq(12)))
users[i] = userVariable
userVariable = nil
}
currentParagraph := paragraph[i]
grepVariables(currentParagraph)
}
fmt.Printf("%v", department)
//remakeBackup()
remakeDepartment()
}
func grepVariables(currentParagraph string) {
breakDown:
for i := range trimVariable {
searchVariable := trimVariable[i] + ".+"
if i == 2 {
searchVariable = `memberOf: CN=[\w]+`
}
re, _ := regexp.Compile(searchVariable)
variable := strings.TrimPrefix(strings.Trim(fmt.
Sprint(re.FindAllString(currentParagraph, -1)), "[]"), trimVariable[i])
userVariable = append(userVariable, variable)
if i == 2 {
for i := range department {
if department[i] == variable {
continue breakDown
}
}
department = append(department, variable)
}
}
}
func randSeq(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
func remakeBackup() {
for i := range department {
fmt.Println(department[i])
}
for i := 0; i < 2; i++ { //range users {
for range users[i] {
//fmt.Println(m)
//fmt.Println(users[i][m])
}
}
}
func remakeDepartment() {
for i := range department {
fmt.Println(department[i])
if department[i] != "" {
rand.Seed(time.Now().UnixNano())
gid := 2500 + len(users) + i
entryUUID := fmt.Sprintln(randSeq(8) + "-" + randSeq(4) + "-" + randSeq(4) + "-" + randSeq(12))
for u := range users {
if department[i] == users[u][2] {
fmt.Println(users[u][0])
}
}
}
}
}
func checkError(err error) {
if err != nil {
panic(err)
}
}

View File

@ -0,0 +1,560 @@
dn: dc=demo,dc=lab
objectClass: top
objectClass: dcObject
objectClass: organization
dc: demo
o: Astra Linux Directory
structuralObjectClass: organization
entryUUID: a8523dd2-ce44-103c-92c3-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.469936Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=users,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: users
structuralObjectClass: organizationalUnit
entryUUID: a854e8e8-ce44-103c-92c4-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.487417Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=trustedDomains,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: trustedDomains
structuralObjectClass: organizationalUnit
entryUUID: a855f1ca-ce44-103c-92c5-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.494197Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: ald-config
structuralObjectClass: organizationalUnit
entryUUID: a8562c9e-ce44-103c-92c6-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.495707Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=policies,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: policies
structuralObjectClass: organizationalUnit
entryUUID: a8567f64-ce44-103c-92c7-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.497826Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=tasks,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: tasks
structuralObjectClass: organizationalUnit
entryUUID: a856a052-ce44-103c-92c8-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.498670Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: cn=task-settings,ou=tasks,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: x-ald-task-settings-object
cn: task-settings
x-ald-task-history: 100
structuralObjectClass: x-ald-task-settings-object
entryUUID: a856e648-ce44-103c-92c9-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.500460Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: cn=administrators,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: groupOfNames
cn: administrators
member: uid=admin/admin,ou=users,dc=demo,dc=lab
member: uid=aldd/dc.demo.lab,ou=users,dc=demo,dc=lab
structuralObjectClass: groupOfNames
entryUUID: a857bf5a-ce44-103c-92ca-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220156.198562Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=hostadders,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: groupOfNames
cn: hostadders
member: uid=admin/admin,ou=users,dc=demo,dc=lab
structuralObjectClass: groupOfNames
entryUUID: a858bae0-ce44-103c-92cb-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.512455Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: cn=server-timestamp,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: x-ald-timestamp-object
cn: server-timestamp
structuralObjectClass: x-ald-timestamp-object
entryUUID: a8591058-ce44-103c-92cc-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
x-ald-timestamp: Thu, 22 Sep 2022 03:41:07 +0500
entryCSN: 20220921224107.476261Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921224107Z
dn: cn=client-timestamp,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: x-ald-timestamp-object
cn: client-timestamp
x-ald-timestamp: NO_TIMESTAMP
structuralObjectClass: x-ald-timestamp-object
entryUUID: a859541e-ce44-103c-92cd-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.516379Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=hosts,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: hosts
structuralObjectClass: organizationalUnit
entryUUID: a85990dc-ce44-103c-92ce-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.517935Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: cn=dc.demo.lab,ou=hosts,dc=demo,dc=lab
objectClass: top
objectClass: x-ald-host-object
cn: dc.demo.lab
description: PDC
x-ald-host-flags: [PCF]
x-ald-id: 1
structuralObjectClass: x-ald-host-object
entryUUID: a859b80a-ce44-103c-92cf-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.518937Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: service-configs
structuralObjectClass: organizationalUnit
entryUUID: a85b5e6c-ce44-103c-92d0-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.529749Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=mail-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: mail-services
structuralObjectClass: organizationalUnit
entryUUID: a85ba4ee-ce44-103c-92d1-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.531555Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: ou=user-accounts,ou=mail-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: user-accounts
structuralObjectClass: organizationalUnit
entryUUID: a85be418-ce44-103c-92d2-e7413749625f
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220115Z
entryCSN: 20220921220115.533172Z#000000#000#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220115Z
dn: cn=aldd-timestamp,cn=dc.demo.lab,ou=hosts,dc=demo,dc=lab
objectClass: top
objectClass: x-ald-timestamp-object
structuralObjectClass: x-ald-timestamp-object
cn: aldd-timestamp
entryUUID: bf3a1b00-ce44-103c-8c5e-8303c4b93e1d
creatorsName: uid=aldd/dc.demo.lab,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220153Z
x-ald-timestamp: Thu, 22 Sep 2022 03:41:07 +0500
entryCSN: 20220921224107.544465Z#000000#001#000000
modifiersName: uid=aldd/dc.demo.lab,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921224107Z
dn: cn=default,ou=policies,ou=ald-config,dc=demo,dc=lab
cn: default
objectClass: top
objectClass: x-ald-krb5-pass-policy
x-ald-kpp-history: 1
x-ald-kpp-maxlife: 0
x-ald-kpp-minclasses: 3
x-ald-kpp-minlen: 8
x-ald-kpp-minlife: 0
structuralObjectClass: x-ald-krb5-pass-policy
entryUUID: c09174bc-ce44-103c-8c5f-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.149537Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=Domain Users,ou=users,dc=demo,dc=lab
cn: Domain Users
description:: 0J/QvtC70YzQt9C+0LLQsNGC0LXQu9C4INC00L7QvNC10L3QsA==
gidNumber: 2500
objectClass: top
objectClass: posixGroup
structuralObjectClass: posixGroup
entryUUID: c091ed70-ce44-103c-8c60-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
memberUid: username
memberUid: penis
entryCSN: 20220921224107.487855Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921224107Z
dn: cn=Domain Computers,ou=hosts,dc=demo,dc=lab
cn: Domain Computers
description:: 0JrQvtC80L/RjNGO0YLQtdGA0Ysg0LTQvtC80LXQvdCw
objectClass: top
objectClass: x-ald-host-group-object
structuralObjectClass: x-ald-host-group-object
entryUUID: c092b25a-ce44-103c-8c61-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.157670Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=Domain Controllers,ou=hosts,dc=demo,dc=lab
cn: Domain Controllers
description:: 0JrQvtC90YLRgNC+0LvQu9C10YDRiyDQtNC+0LzQtdC90LA=
objectClass: top
objectClass: x-ald-host-group-object
structuralObjectClass: x-ald-host-group-object
entryUUID: c0933a36-ce44-103c-8c62-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
x-ald-hosts: dc.demo.lab
entryCSN: 20220921220156.188642Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=Domain File Servers,ou=hosts,dc=demo,dc=lab
cn: Domain File Servers
description:: 0KTQsNC50LvRgdC10YDQstC10YDRiyDQtNC+0LzQtdC90LA=
objectClass: top
objectClass: x-ald-host-group-object
structuralObjectClass: x-ald-host-group-object
entryUUID: c0938324-ce44-103c-8c63-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
x-ald-hosts: dc.demo.lab
entryCSN: 20220921220156.194360Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=documents,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: documents
structuralObjectClass: organizationalUnit
entryUUID: c0940e8e-ce44-103c-8c64-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.166583Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=event-tasks,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: event-tasks
structuralObjectClass: organizationalUnit
entryUUID: c0948e4a-ce44-103c-8c65-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.169853Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: documentIdentifier=ALD/DOMAIN/NextUID,ou=documents,ou=ald-config,dc=demo
,dc=lab
description:: 0KHQu9C10LTRg9GO0YnQuNC5IFVJRCDQtNC+0LzQtdC90L3QvtCz0L4g0L/Qvt
C70YzQt9C+0LLQsNGC0LXQu9GP
documentIdentifier: ALD/DOMAIN/NextUID
documentLocation: ALD://LDAP
documentVersion: 2501
objectClass: top
objectClass: document
structuralObjectClass: document
entryUUID: c09568c4-ce44-103c-8c66-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.175446Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: documentIdentifier=ALD/DOMAIN/NextGID,ou=documents,ou=ald-config,dc=demo
,dc=lab
description:: 0KHQu9C10LTRg9GO0YnQuNC5IEdJRCDQtNC+0LzQtdC90L3QvtC5INCz0YDRg9
C/0L/Riw==
documentIdentifier: ALD/DOMAIN/NextGID
documentLocation: ALD://LDAP
documentVersion: 2501
objectClass: top
objectClass: document
structuralObjectClass: document
entryUUID: c0958f0c-ce44-103c-8c67-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.176427Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: documentIdentifier=ALD/DOMAIN/NextTID,ou=documents,ou=ald-config,dc=demo
,dc=lab
description:: 0KHQu9C10LTRg9GO0YnQuNC5IElEINC30LDQtNCw0L3QuNGP
documentIdentifier: ALD/DOMAIN/NextTID
documentLocation: ALD://LDAP
objectClass: top
objectClass: document
structuralObjectClass: document
entryUUID: c095fb2c-ce44-103c-8c68-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
documentVersion: 3
entryCSN: 20220921224107.470299Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921224107Z
dn: documentIdentifier=ALD/DOMAIN/NextEID,ou=documents,ou=ald-config,dc=demo
,dc=lab
description:: 0KHQu9C10LTRg9GO0YnQuNC5IElEINGB0L7QsdGL0YLQuNGP
documentIdentifier: ALD/DOMAIN/NextEID
documentLocation: ALD://LDAP
documentVersion: 1
objectClass: top
objectClass: document
structuralObjectClass: document
entryUUID: c0966e54-ce44-103c-8c69-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.182142Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=audit-policies,ou=ald-config,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: audit-policies
structuralObjectClass: organizationalUnit
entryUUID: c09bd5d8-ce44-103c-8c6a-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.217559Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=other:,ou=audit-policies,ou=ald-config,dc=demo,dc=lab
cn: other:
objectClass: top
objectClass: x-ald-audit-policy
x-ald-aud-mask: 0x0:0x0
x-ald-aud-type: 2
structuralObjectClass: x-ald-audit-policy
entryUUID: c09c4fc2-ce44-103c-8c6b-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.220681Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=dev-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: dev-services
structuralObjectClass: organizationalUnit
entryUUID: c09f8aa2-ce44-103c-8c6c-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.241849Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=devices,ou=dev-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: devices
structuralObjectClass: organizationalUnit
entryUUID: c09fee70-ce44-103c-8c6d-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.244404Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=rules,ou=dev-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: rules
structuralObjectClass: organizationalUnit
entryUUID: c0a06d6e-ce44-103c-8c6e-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.247655Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=mac-administrators,ou=ald-config,dc=demo,dc=lab
cn: mac-administrators
member: uid=admin/admin,ou=users,dc=demo,dc=lab
member: uid=aldd/dc.demo.lab,ou=users,dc=demo,dc=lab
objectClass: top
objectClass: groupOfNames
structuralObjectClass: groupOfNames
entryUUID: c0a3ec46-ce44-103c-8c6f-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.270563Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=mac-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: mac-services
structuralObjectClass: organizationalUnit
entryUUID: c0a46770-ce44-103c-8c70-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.273716Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=mac-levels,ou=mac-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: mac-levels
structuralObjectClass: organizationalUnit
entryUUID: c0a4cb48-ce44-103c-8c71-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.276272Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: ou=mac-categories,ou=mac-services,ou=service-configs,dc=demo,dc=lab
objectClass: top
objectClass: organizationalUnit
ou: mac-categories
structuralObjectClass: organizationalUnit
entryUUID: c0a5433e-ce44-103c-8c72-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.279343Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn:: Y2490KPRgNC+0LLQtdC90YxfMCxvdT1tYWMtbGV2ZWxzLG91PW1hYy1zZXJ2aWNlcyxvdT1
zZXJ2aWNlLWNvbmZpZ3MsZGM9ZGVtbyxkYz1sYWI=
cn:: 0KPRgNC+0LLQtdC90YxfMA==
objectClass: top
objectClass: x-ald-mac-level-object
x-ald-mac-level: 0
structuralObjectClass: x-ald-mac-level-object
entryUUID: c0a5e2d0-ce44-103c-8c73-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.283427Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn: cn=mac-timestamp,ou=mac-services,ou=service-configs,dc=demo,dc=lab
cn: mac-timestamp
objectClass: top
objectClass: x-ald-timestamp-object
structuralObjectClass: x-ald-timestamp-object
entryUUID: c0a6c0f6-ce44-103c-8c74-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
x-ald-timestamp: Thu, 22 Sep 2022 03:41:07 +0500
entryCSN: 20220921224107.524647Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921224107Z
dn:: Y2490KPRgNC+0LLQtdC90YxfMSxvdT1tYWMtbGV2ZWxzLG91PW1hYy1zZXJ2aWNlcyxvdT1
zZXJ2aWNlLWNvbmZpZ3MsZGM9ZGVtbyxkYz1sYWI=
cn:: 0KPRgNC+0LLQtdC90YxfMQ==
objectClass: top
objectClass: x-ald-mac-level-object
x-ald-mac-level: 1
structuralObjectClass: x-ald-mac-level-object
entryUUID: c0a8df76-ce44-103c-8c75-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.303001Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn:: Y2490KPRgNC+0LLQtdC90YxfMixvdT1tYWMtbGV2ZWxzLG91PW1hYy1zZXJ2aWNlcyxvdT1
zZXJ2aWNlLWNvbmZpZ3MsZGM9ZGVtbyxkYz1sYWI=
cn:: 0KPRgNC+0LLQtdC90YxfMg==
objectClass: top
objectClass: x-ald-mac-level-object
x-ald-mac-level: 2
structuralObjectClass: x-ald-mac-level-object
entryUUID: c0aa606c-ce44-103c-8c76-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.312854Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z
dn:: Y2490KPRgNC+0LLQtdC90YxfMyxvdT1tYWMtbGV2ZWxzLG91PW1hYy1zZXJ2aWNlcyxvdT1
zZXJ2aWNlLWNvbmZpZ3MsZGM9ZGVtbyxkYz1sYWI=
cn:: 0KPRgNC+0LLQtdC90YxfMw==
objectClass: top
objectClass: x-ald-mac-level-object
x-ald-mac-level: 3
structuralObjectClass: x-ald-mac-level-object
entryUUID: c0ac6dda-ce44-103c-8c77-8303c4b93e1d
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220921220156Z
entryCSN: 20220921220156.326308Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220921220156Z

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
dn: cn=hr,ou=users,dc=demo,dc=lab
cn: названиеДепартамента
gidNumber: гид
objectClass: top
objectClass: posixGroup
structuralObjectClass: posixGroup
entryUUID: ентриУУИД
creatorsName: uid=admin/admin,ou=users,dc=demo,dc=lab
createTimestamp: 20220924170642Z
memberUid: мембер
entryCSN: 20220925134020.252056Z#000000#001#000000
modifiersName: uid=admin/admin,ou=users,dc=demo,dc=lab
modifyTimestamp: 20220925134020Z

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
web: bin/asciisay-bot

View File

@ -0,0 +1,48 @@
### [t.me/asciisaybot](https://t.me/asciisaybot)
```
.__.__ ___. __
_____ ______ ____ |__|__| ___________ ___.__. \_ |__ _____/ |_
\__ \ / ___// ___\| | |/ ___/\__ \< | | ______ | __ \ / _ \ __\
/ __ \_\___ \\ \___| | |\___ \ / __ \\___ | /_____/ | \_\ ( <_> ) |
(____ /____ >\___ >__|__/____ >(____ / ____| |___ /\____/|__|
\/ \/ \/ \/ \/\/ \/
```
Вариация cowsay, сделанная Телеграм-ботом. В арсенале 33 животных.<br />
Животину можно выбрать самому, или же довериться случаю.<br />
Сделано с помощью: [asciiart.eu](https://www.asciiart.eu/animals/) + [tbot](https://github.com/yanzay/tbot).
### Случайное животное
```
user:
Я люблю писать на го!
bot:
< Я люблю писать на го! >
\ /
/ ___ _,.--.,_
: .-~ ~--"~-. ._ "-.
\ / ./_ Y "-. \
: Y :~ ! Y
/ l | / .|
:_ \O O-, l / |j
()\___) |/ \_/"; !
\._____.-~\ . ~\. ./
Y_ Y_. "vr"~ T
( ( |L j
[nn[nn..][nn..]
```
### C указанием животного
```
user:
cat Если тебе было весело, то это не военное преступление.
bot:
< Если тебе было весело, то это не военное преступление. >
\ /
: v v
\ |\---/|
( o_o )
\_W__/-..----.
___/ ' ' ,""+\
(__...' __\ |'.___.';
(_,...-'''(_,.'__)/'.....+
```

View File

@ -0,0 +1,10 @@
module github.com/fruworg/asciisay-bot
// +heroku goVersion go1.17
go 1.17
require (
github.com/joho/godotenv v1.3.0
github.com/yanzay/tbot/v2 v2.0.1
github.com/yanzay/tbot v1.0.0 // indirect
)

View File

@ -0,0 +1,13 @@
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/yanzay/tbot v1.0.0 h1:pKLHIvdiHRgU5iTfpWlgMTCWyD4vIQtAsOy7LCYMsAo=
github.com/yanzay/tbot v1.0.0/go.mod h1:rS36e4e2P56jkI0bUuZtzjBBIwMIdBBTUHfI4tgG5BM=
github.com/yanzay/tbot/v2 v2.0.1 h1:d/Ecve1XiJqZeEnmA45E3jdQxuXhlZVk7DmdNtNJITg=
github.com/yanzay/tbot/v2 v2.0.1/go.mod h1:q0+8JblBq9tLAnKHdBIZsHwDvMS9TfO6mNfaAk1VrHg=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506 h1:RPrQRi67MUoUPg/3wwL9K9vKVWAB180e2WJgxC02CJE=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506/go.mod h1:x2hAcqPbZzQz79Fzr9xEe7BM73+UsZ3nBucx2u30oSk=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=

View File

@ -0,0 +1,283 @@
package main
import (
"fmt"
"math/rand"
"strings"
"time"
"github.com/yanzay/tbot/v2"
)
var fruw = map[string]string{
"cow": `
\ /
: ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
`, //pig by jv
"pig": `
\ /
: <'--'\>______
\ /. . '' \
('') , @
'-._, /
)-)_/--( >
'''' ''''
`, //cat by sk
"cat": `
\ /
: v v
\ |\---/|
( o_o )
\_W__/-..----.
___/ ' ' ,""+\
(__...' __\ |'.___.';
(_,...-'''(_,.'__)/'.....+
`, //aardvarks
"aardvarks": `
\ /
: _.---._ /\\
\ ./' "--'\//
./ o \
/./\ )______ \__ \
./ / /\ \ | \ \ \ \
/ / \ \ | |\ \ \7
" " " "
`, //bat by jgs
"bat": `
\ /
\ _
/\ \ /\
/ \'._ (\_/) _.'/ \
|.''._'--(o.o)--'_.''.|
\_ / ';=/ " \=;' \ _/
'\__| \___/ |__/'
\(_|_)/
" ' "
`, //beer
"bear": `
\ /
__ __
/ \.-"""-./ \
\ - - /
| o o |
\ .-'''-. /
'-\__Y__/-'
'---'
`, //beaver by jgs
"beaver": `
\ /
\
: .=" "=._.---.
\ ." c 6 Y 6'p
: / , '. w_/
\ : '-. / /
_,..._/ )_-\ \_=.\
'-....-''------)))'=-'"''"
`, //bison by cp97
"bison": `
\ /
:
((_,...,_))
|o o|
\ /
^_^
`, //cock by sk
"cock": `
\ /
\ /""\ ,
< ^ L____/|
#) /' , /
\ '---' /
''";\)'
_/_Y
`, //duck buy hjw
"duck": `
\ / __
<(o )___
( ._> /
'---'
`, //camel by jgs
"camel": `
\ /
: _
\ .--' |
/___^ | .--.
) | / \
/ | /' '.
| '-' / \
\ | |\
\ / \ /\|
\ /'----'\ / "
||| \\ |
((| ((|
||| |||
//_( //_(
`, //deer
"deer": `
\ /
: )) ((
\ // \\
: \\____//\
\ ~/~ ~\/~
( o/ _/o ~
/ / ,|
(~~~)__.-\ |
\'~~ | |
| | |
`, //dog
"dog": `
\ /
\ |\_/| _
: @ @ | ((| |))
\ <> | | |
/\_ \------____| |
| |
____|_ ___| /
/_/_____/____/_______|
`, //dolphin by Morfina
"dolphin": `
\ /
: ,-.
\ / ( '
_.--'! '--._
,' ''.
* : \
_.' O ___ ! '
(_.-^, __..-' ''''--. |
/,' ' _.' /
* .-'' |
(..--^. '
| /
'
`, //elephant by Row
"elephant": `
\ /
/ ___ _,.--.,_
: .-~ ~--"~-. ._ "-.
\ / ./_ Y "-. \
: Y :~ ! Y
/ l | / .|
:_ \O O-, l / |j
()\___) |/ \_/"; !
\._____.-~\ . ~\. ./
Y_ Y_. "vr"~ T
( ( |L j
[nn[nn..][nn..]
`, //fish
"fish": `
\ /
\ /'·.¸
: /¸...¸':·
\ ¸.·' ¸ '·.¸.·')
: © ):'; ¸ {
'·.¸ '· ¸.·'\'·¸)
'\\''\¸.·'
`, //whale by Riitta Rasimus
"whale": `
\ /
:
\
:
\
__:_____ |"\/"|
,' '. \ /
| O \___/ |
~^~^~^~^~^~^~^~^~^~^~^~^~
`, //shark by Shanaka Dias
"shark": `
\ /
:
\
_________ . .
(.. \_ , |\ /|
\ O \ /| \ \/ /
\______ \/ | \ /
vvvv\ \ | / |
\^^^^ == \_/ |
'\_ === \. |
/ /\_ \ / |
|/ \_ \| /
\________/
`, //seahorse by Morfina
"seahorse": `
\ /
:
\
:
\
:
\/)/)
_' oo(_.-.
/'. .---'
/'-./ (
) ; __\
\_.'\ : __|
) _/
( (,.
'-.-'
`}
var rndmap = map[int]string{
0: "cow",
1: "pig",
2: "cat",
3: "bat",
4: "bear",
5: "bison",
6: "cock",
7: "duck",
8: "camel",
9: "deer",
10: "dog",
11: "dolphin",
12: "elephant",
13: "fish",
14: "whale",
15: "shark",
16: "seahorse",
17: "aardvarks",
18: "beaver",
}
var lenmap = len(rndmap)
// Handle the /start command here
func (a *application) startHandler(m *tbot.Message) {
org := ""
for i := 0; i < lenmap; i++ {
org = fmt.Sprintf("%s*%s*", org, rndmap[i])
if i < lenmap-1 {
org = org + ", "
}
}
msg := fmt.Sprintf("\n*Привет!* Присылай сообщение и я его преобразую.\n"+
"\nСо случайным животным:\nЕсли тебе было весело, то это не военное преступление.\n"+
"\nС указанием животного:\n*cat* Если тебе было весело, то это не военное преступление.\n"+
"\nВместо *cat* можно подставить любое другое животное.\nТолько не забудь про пробел, десу.\n"+
"\nЖивотные: %s.\n"+
"\n*Пример ответа:*\n"+"```\n< Если тебе было весело, то это не военное преступление. >%s```", org, fruw["cat"])
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}
// Handle the msg command here
func (a *application) msgHandler(m *tbot.Message) {
msg := ""
arr := strings.Split(m.Text, " ")
animal := strings.ToLower(arr[0])
if fruw[animal] != "" && len(arr) > 1 {
reply := fruw[animal]
text := strings.TrimPrefix(m.Text, arr[0]+" ")
msg = fmt.Sprintf("```\n< %s > %s ```", text, reply)
} else {
rand.Seed(time.Now().UnixNano())
rnd := (rand.Intn(lenmap))
reply := fruw[rndmap[rnd]]
msg = fmt.Sprintf("```\n< %s > %s ```", m.Text, reply)
}
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}

View File

@ -0,0 +1,35 @@
package main
import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/yanzay/tbot/v2"
)
type application struct {
client *tbot.Client
}
var (
app application
bot *tbot.Server
token string
)
func init() {
e := godotenv.Load()
if e != nil {
log.Println(e)
}
token = os.Getenv("TELEGRAM_TOKEN")
}
func main() {
bot = tbot.New(token, tbot.WithWebhook("https://asciisay-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
web: bin/closeweather-bot

View File

@ -0,0 +1,120 @@
### [t.me/closeweatherbot](https://t.me/closeweatherbot)
```
.__ __ .__
____ | | ____ ______ ______ _ __ ____ _____ _/ |_| |__ ___________
_/ ___\| | / _ \/ ___// __ \ \/ \/ // __ \\__ \\ __\ | \_/ __ \_ __ \
\ \___| |_( <_> )___ \\ ___/\ /\ ___/ / __ \| | | Y \ ___/| | \/
\___ >____/\____/____ >\___ >\/\_/ \___ >____ /__| |___| /\___ >__|
\/ \/ \/ \/ \/ \/ \/
```
Бот-синоптик в Телеграме. Магнитные бури, прогноз погоды<br />
и подсказки в выборе одежды. На сегодня и всю неделю.<br />
Сделано с помощью: [ФИАН](https://tesis.lebedev.ru/) + [openweathermap](https://github.com/briandowns/openweathermap) + [redis](https://github.com/go-redis/redis) + [tbot](https://github.com/yanzay/tbot)
### Выбор города
```
user:
Петропавловск-Камчатский
bot:
Город изменён - Петропавловск-Камчатский RU.
```
### Прогноз на сегодня
```
user:
/today
bot:
//Магнитные бури на сегодня, вчера и позавчера
RU Петропавловск-Камчатский Прогноз на сегодня
Сейчас - Лонгслив + лёгкая куртка
Температура: 0.33°
Ощущается как: -6.60°
Скорость ветра: 10.00 м/c
Облачно с прояснениями.
12:00:00 - Лонгслив + лёгкая куртка
Температура: 0.33°
Ощущается: -5.30°
Ветер: 6.57 м/c
Облачно с прояснениями.
15:00:00 - Лонгслив + лёгкая куртка
Температура: -1.16°
Ощущается: -7.30°
Ветер: 6.78 м/c
Облачно с прояснениями.
18:00:00 - Лонгслив + лёгкая куртка
Температура: -3.04°
Ощущается: -9.48°
Ветер: 6.31 м/c
Небольшой снег.
21:00:00 - Лонгслив + лёгкая куртка
Температура: -4.10°
Ощущается: -9.51°
Ветер: 4.24 м/c
Снег.
```
### Прогноз на четыре дня
```
user:
/week
bot:
//Прогноз магнитных бурь на месяц вперёд
RU Петропавловск-Камчатский Прогноз на неделю
> Прогноз на 09-01-2022
09:00:00 - Лонгслив + лёгкая куртка
Температура: -2.86°
Ощущается: -6.75°
Ветер: 2.81 м/c
Небольшой снег.
15:00:00 - Лонгслив + лёгкая куртка
Температура: -2.31°
Ощущается: -6.57°
Ветер: 3.32 м/c
Снег.
> Прогноз на 10-01-2022
09:00:00 - Лёгкая куртка + свитер
Температура: -3.14°
Ощущается: -10.14°
Ветер: 7.41 м/c
Небольшой снег.
15:00:00 - Лёгкая куртка + свитер
Температура: -5.11°
Ощущается: -11.25°
Ветер: 4.91 м/c
Пасмурно.
> Прогноз на 11-01-2022
09:00:00 - Лёгкая куртка + свитер
Температура: -8.71°
Ощущается: -14.54°
Ветер: 3.54 м/c
Облачно с прояснениями.
15:00:00 - Лёгкая куртка + свитер
Температура: -10.32°
Ощущается: -17.31°
Ветер: 4.38 м/c
Ясно.
> Прогноз на 12-01-2022
12:00:00 - Лёгкая куртка + свитер
Температура: -7.68°
Ощущается: -11.65°
Ветер: 2.16 м/c
Небольшой снег.
```

View File

@ -0,0 +1,17 @@
module github.com/fruworg/closeweather-bot
// +heroku goVersion go1.17
go 1.17
require (
github.com/joho/godotenv v1.3.0
github.com/yanzay/tbot/v2 v2.0.1
github.com/PuerkitoBio/goquery v1.8.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/yanzay/tbot v1.0.0 // indirect
github.com/go-redis/redis v6.15.9+incompatible // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 // indirect
golang.org/x/text v0.3.6 // indirect
github.com/briandowns/openweathermap v0.16.0
)

View File

@ -0,0 +1,200 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506 h1:RPrQRi67MUoUPg/3wwL9K9vKVWAB180e2WJgxC02CJE=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506/go.mod h1:x2hAcqPbZzQz79Fzr9xEe7BM73+UsZ3nBucx2u30oSk=
github.com/yanzay/tbot v1.0.0 h1:pKLHIvdiHRgU5iTfpWlgMTCWyD4vIQtAsOy7LCYMsAo=
github.com/yanzay/tbot v1.0.0/go.mod h1:rS36e4e2P56jkI0bUuZtzjBBIwMIdBBTUHfI4tgG5BM=
github.com/yanzay/tbot/v2 v2.0.1 h1:d/Ecve1XiJqZeEnmA45E3jdQxuXhlZVk7DmdNtNJITg=
github.com/yanzay/tbot/v2 v2.0.1/go.mod h1:q0+8JblBq9tLAnKHdBIZsHwDvMS9TfO6mNfaAk1VrHg=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 h1:/6y1LfuqNuQdHAm0jjtPtgRcxIxjVZgm5OTu8/QhZvk=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/briandowns/openweathermap v0.16.0 h1:js8THhUE4nVYbpedSCs0E5vxYzxkkOLtxrOFh9xed8c=
github.com/briandowns/openweathermap v0.16.0/go.mod h1:0GLnknqicWxXnGi1IqoOaZIw+kIe5hkt+YM5WY3j8+0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/yanzay/tbot/v2 v2.2.0/go.mod h1:q0+8JblBq9tLAnKHdBIZsHwDvMS9TfO6mNfaAk1VrHg=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View File

@ -0,0 +1,284 @@
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"strconv"
"strings"
owm "github.com/briandowns/openweathermap"
"github.com/go-redis/redis"
"github.com/yanzay/tbot/v2"
)
var opt, err = redis.ParseURL(os.Getenv("REDIS_URL"))
var client = redis.NewClient(&redis.Options{
Addr: opt.Addr,
Password: opt.Password,
DB: opt.DB,
})
type OWM struct {
City string `json:"city"`
}
func (a *application) startHandler(m *tbot.Message) {
msg := "\n*Привет!* Для начала напиши город в чат.\nДалее введи необходимую *команду*:\n" +
"Команда */today* - прогноз на сегодня.\nКоманда */week* - прогноз на 5 дней."
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}
// Handle the msg command here
func (a *application) msgHandler(m *tbot.Message) {
citycodes := map[string]string{
"абакан": "QYPM",
"алматы": "P8OF",
"анадырь": "SSWT",
"архангельск": "SRLE",
"астана": "QJNY",
"астрахань": "PQM0",
"ашхабад": "OCMV",
"баку": "OQM6",
"барнаул": "QWOZ",
"белгород": "QGL2",
"биробиджан": "Q5T3",
"бишкек": "P5O8",
"благовещенск": "QESN",
"брянск": "QWKV",
"вильнюс": "R4K4",
"владивосток": "P7T0",
"владикавказ": "P6LQ",
"владимир": "RDLD",
"волгоград": "Q4LP",
"вологда": "RVLC",
"воронеж": "QMLA",
"горно-алтайск": "QOP6",
"грозный": "P8LT",
"душанбе": "OFNQ",
"екатеринбург": "RHN2",
"ереван": "OPLQ",
"иваново": "RILF",
"ижевск": "RHMG",
"иркутск": "QQQP",
"йошкар-ола": "RGM0",
"казань": "RBM3",
"калининград": "R4JQ",
"калуга": "R3L1",
"кемерово": "R8P6",
"киев": "QFKK",
"киров": "RSM5",
"кишинёв": "PUKF",
"кострома": "RNLF",
"краснодар": "PIL9",
"красноярск": "RCPR",
"курган": "R9NG",
"курск": "QML1",
"кызыл": "QMPV",
"липецк": "QSLB",
"магадан": "RXUK",
"майкоп": "PGLC",
"махачкала": "P6LY",
"минеральныеводы": "PDLL",
"минск": "R0KB",
"москва": "RAL5",
"мурманск": "TIKR",
"набережные челны": "RAMD",
"назрань": "P7LQ",
"нальчик": "P9LN",
"нижний новгород": "RELO",
"новгород": "RRKM",
"новосибирск": "R6OX",
"омск": "R6O4",
"оренбург": "QNML",
"орёл": "QUL0",
"пенза": "QVLR",
"пермь": "ROMP",
"петрозаводск": "SBKV",
"петропавловск-камчатский": "QUV8",
"псков": "RNKD",
"рига": "RIK0",
"ростов-на-дону": "PVLB",
"рязань": "R4LB",
"салехард": "T3NK",
"самара": "QVM6",
"санкт-петербург": "S0KJ",
"саранск": "R1LS",
"саратов": "QLLU",
"симферополь": "PIKU",
"смоленск": "R5KO",
"сочи": "PALB",
"ставрополь": "PILI",
"станциявосток": "53QX",
"станциямирный": "73PR",
"сыктывкар": "SAM8",
"таллин": "RXK2",
"тамбов": "QSLG",
"ташкент": "OWNS",
"тбилиси": "OYLQ",
"тверь": "REL0",
"тольятти": "QXM4",
"томск": "RFP3",
"тула": "R1L5",
"тюмень": "RJNH",
"улан-удэ": "QNQZ",
"ульяновск": "R2M1",
"уфа": "R4MO",
"хабаровск": "Q3T9",
"ханты-мансийск": "S6NR",
"чебоксары": "RDLY",
"челябинск": "R7N4",
"череповец": "RVL6",
"черкесск": "PDLI",
"чита": "QORH",
"элиста": "PQLP",
"южно-сахалинск": "PUTW",
"якутск": "SCST",
"ярославль": "RMLC"}
a.client.SendChatAction(m.Chat.ID, tbot.ActionTyping)
msg, datecheck, cityname, desc, url, urldate := "", 0, "", "", "", ""
if m.Text == "/week" || m.Text == "/today" {
city, err := client.Get(m.Chat.ID).Result()
if err == redis.Nil {
msg = "Сначала выбери город!\nКоманда /start в помощь."
} else {
w, err := owm.NewForecast("5", "C", "ru", os.Getenv("OWM_API_KEY")) // fahrenheit (imperial) with Russian output
if err != nil {
log.Fatalln(err)
}
city = strings.TrimLeft(city, `{"city":"`)
city = strings.TrimRight(city, `"}`)
w.DailyByName(city, 0)
if val, ok := w.ForecastWeatherJson.(*owm.Forecast5WeatherData); ok {
if len(val.List) != 0 {
if m.Text == "/week" {
cityname = val.City.Country + " " + val.City.Name + " Прогноз на неделю"
} else {
cityname = val.City.Country + " " + val.City.Name + " Прогноз на сегодня"
}
cst := strings.Split(fmt.Sprintf("%s", val.List[0]), " ")
cdt := strings.Split(cst[len(cst)-4], "-")
cdate := fmt.Sprintf("%s-%s-%s", cdt[2], cdt[1], cdt[0])
urldate = fmt.Sprintf("%s%s%s", cdt[0], cdt[1], cdt[2])
for i := 0; i < len(val.List)-1; i++ {
fl := strings.Split(fmt.Sprintf("%.2f", val.List[i:(i+1)]), " ")
st := strings.Split(fmt.Sprintf("%s", val.List[i:(i+1)]), " ")
dt := strings.Split(st[len(st)-4], "-")
date := fmt.Sprintf("%s-%s-%s", dt[2], dt[1], dt[0])
desc = strings.Title(strings.ToLower(st[11]))
if len(st) == 26 {
desc = desc + " " + st[12] + " " + st[13]
}
if len(st) == 25 {
desc = desc + " " + st[12]
}
if m.Text == "/week" && date != cdate {
if ((st[len(st)-3] == "09:00:00" || st[len(st)-3] == "15:00:00") && datecheck < 3) ||
(st[len(st)-3] == "15:00:00" && datecheck == 3)||
(st[len(st)-3] == "12:00:00" && datecheck == 10){
if st[len(st)-3] == "09:00:00" || datecheck == 0 || datecheck == 10 {
datecheck++
msg = msg + "\n\n> Прогноз на " + date
}
if st[len(st)-3] == "15:00:00" && datecheck == 3 {
datecheck = 10
}
msg = msg + fmt.Sprintf("\n\n%s - %s\nТемпература: %s°\nОщущается: %s°\nВетер: %s м/c\n%s.",
st[len(st)-3], fadvice(fl[4]), strings.TrimLeft(fl[1], "{"), fl[4],
strings.TrimLeft(fl[14], "{"), desc)
}
} else if m.Text == "/today" && date == cdate {
msg = msg + fmt.Sprintf("\n\n%s - %s\nТемпература: %s°\nОщущается: %s°\nВетер: %s м/c\n%s.",
st[len(st)-3], fadvice(fl[4]), strings.TrimLeft(fl[1], "{"), fl[4],
strings.TrimLeft(fl[14], "{"), desc)
}
}
if m.Text == "/today" {
w, err := owm.NewCurrent("C", "ru", os.Getenv("OWM_API_KEY")) // fahrenheit (imperial) with Russian output
if err != nil {
log.Fatalln(err)
}
w.CurrentByName(city)
arr := strings.Split(fmt.Sprintf("", w.Weather), " ")
for i := 3; i < len(arr)-1; i++ {
if i == 3 {
desc = strings.Title(strings.ToLower(arr[i]))
} else {
desc = desc + " " + arr[i]
}
}
msg = fmt.Sprintf("%s\n\nСейчас - %s\nТемпература: %.2f°\nОщущается как: %.2f°\nСкорость ветра: %.2f м/c\n%s.",
cityname, fadvice(fmt.Sprintf("%.2f", w.Main.FeelsLike)), w.Main.Temp, w.Main.FeelsLike, w.Wind.Speed, desc) + msg
if citycodes[strings.ToLower(city)] != "" {
urldate = citycodes[strings.ToLower(city)] + "_" + urldate
}
url = "https://tesis.lebedev.ru/upload_test/files/kp_" + urldate + ".png?bg=1"
} else {
msg = cityname + msg
url = "https://tesis.lebedev.ru/upload_test/files/fc_" + urldate + ".png?bg=1"
}
}
} else {
msg = fmt.Sprintf("%v", len(val.List))
}
}
} else {
m.Text = strings.TrimRight(m.Text, " .!")
w, err := owm.NewCurrent("C", "ru", os.Getenv("OWM_API_KEY")) // fahrenheit (imperial) with Russian output
if err != nil {
log.Fatalln(err)
}
w.CurrentByName(m.Text)
if w.Cod != 200 {
msg = "Город не найден!"
} else {
json, err := json.Marshal(OWM{City: m.Text})
if err != nil {
fmt.Println(err)
}
err = client.Set(m.Chat.ID, json, 0).Err()
if err != nil {
fmt.Println(err)
}
msg = "Город изменён - " + w.Name + " " + w.Sys.Country + "."
}
}
if url == "" {
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
} else {
a.client.SendPhoto(m.Chat.ID, url, tbot.OptCaption(msg))
}
}
func fadvice(stemp string) (advice string) {
if temp, err := strconv.ParseFloat(stemp, 32); err == nil {
switch {
case temp <= -50.00:
advice = "Сиди дома"
case temp <= -40.00:
advice = "Одежда для высотных восхождений"
case temp <= -30.00:
advice = "Термобельё + свитер + пуховик + шарф + перчатки"
case temp <= -20.00:
advice = "Термобельё + лонгслив + пуховик"
case temp <= -10.00:
advice = "Лёгкая куртка + свитер"
case temp <= 00.00:
advice = "Лонгслив + лёгкая куртка"
case temp >= 50.00:
advice = "Сиди дома"
case temp >= 40.00:
advice = "Одежда не нужна"
case temp >= 30.00:
advice = "Шорты + футболка"
case temp >= 20.00:
advice = "Лонгслив"
case temp >= 10.00:
advice = "Свитер"
case temp >= 00.00:
advice = "Лонгслив + ветровка"
}
}
return
}

View File

@ -0,0 +1,26 @@
package main
import (
"log"
"os"
"github.com/yanzay/tbot/v2"
)
type application struct {
client *tbot.Client
}
var (
app application
bot *tbot.Server
token string
)
func main() {
bot = tbot.New(os.Getenv("TELEGRAM_TOKEN"), tbot.WithWebhook("https://closeweather-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
web: bin/libretranslate-bot

View File

@ -0,0 +1,30 @@
### [t.me/libretranslatebot](https://t.me/libretranslatebot)
```
.__ ._____. __ .__ __
| | |__\_ |_________ _____/ |_____________ ____ _____| | _____ _/ |_ ____
| | | || __ \_ __ \_/ __ \ __\_ __ \__ \ / \ / ___/ | \__ \\ __\/ __ \
| |_| || \_\ \ | \/\ ___/| | | | \// __ \| | \\___ \| |__/ __ \| | \ ___/
|____/__||___ /__| \___ >__| |__| (____ /___| /____ >____(____ /__| \___ >
\/ \/ \/ \/ \/ \/ \/
```
Бот-переводчик в Телеграме. В арсенале 17 языков.<br />
Поддерживает распознование текста с изображения по URL.<br />
Сделано с помощью: [ocr.space](https://ocr.space) + [libretranslate.de](https://libretranslate.de) + [tbot](https://github.com/yanzay/tbot).
### Обычный перевод
```
user:
enruHello, World!
bot:
Привет, мир!
```
### Перевод с OCR
```
user:
enzhhttps://i.ibb.co/6b9C315/23.jpg
bot:
内罗毕
附录
东南非
```

View File

@ -0,0 +1,16 @@
module github.com/fruworg/libretranslate-bot
// +heroku goVersion go1.17
go 1.17
require (
github.com/joho/godotenv v1.3.0
github.com/yanzay/tbot/v2 v2.0.1
github.com/PuerkitoBio/goquery v1.8.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/yanzay/tbot v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 // indirect
golang.org/x/text v0.3.6 // indirect
github.com/ranghetto/go_ocr_space v0.0.0-20190617120011-980751a8a409 // indirect
)

View File

@ -0,0 +1,140 @@
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/yanzay/tbot v1.0.0 h1:pKLHIvdiHRgU5iTfpWlgMTCWyD4vIQtAsOy7LCYMsAo=
github.com/yanzay/tbot v1.0.0/go.mod h1:rS36e4e2P56jkI0bUuZtzjBBIwMIdBBTUHfI4tgG5BM=
github.com/yanzay/tbot/v2 v2.0.1 h1:d/Ecve1XiJqZeEnmA45E3jdQxuXhlZVk7DmdNtNJITg=
github.com/yanzay/tbot/v2 v2.0.1/go.mod h1:q0+8JblBq9tLAnKHdBIZsHwDvMS9TfO6mNfaAk1VrHg=
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 h1:/6y1LfuqNuQdHAm0jjtPtgRcxIxjVZgm5OTu8/QhZvk=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506 h1:RPrQRi67MUoUPg/3wwL9K9vKVWAB180e2WJgxC02CJE=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506/go.mod h1:x2hAcqPbZzQz79Fzr9xEe7BM73+UsZ3nBucx2u30oSk=
github.com/ranghetto/go_ocr_space v0.0.0-20190617120011-980751a8a409 h1:8oI32HLFTHqKFQ2Z+TQ5Rx5NZ4SYaCMHkibGMwj/jrw=
github.com/ranghetto/go_ocr_space v0.0.0-20190617120011-980751a8a409/go.mod h1:JRk14mjJf4qaBzi+SjeUGYagU672VwaBh0z/1rLFRA4=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=

View File

@ -0,0 +1,124 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"os"
"github.com/yanzay/tbot/v2"
"github.com/PuerkitoBio/goquery"
ocr "github.com/ranghetto/go_ocr_space"
)
// Handle the /start command here
func (a *application) startHandler(m *tbot.Message) {
msg := "\n*Привет!* Присылай сообщение и я его переведу.\n\nДля обычного текста:\n*en**ru*Hello, World!" +
"\nДля текста на фотографии:\n*en**ru*https://website.com/file\n\nГде *en* - это язык текста, " +
"а *ru* - язык перевода.\nДля *OCR* без перевода используй одинаковые языки.\n\nКоды языков:\n*ru* - Русский; " +
"*en* - Английский; *ar* - Арабский; *zh* - Китайский; \n*fr* - Французкий; *de* - Немецкий; *hi* - Индийский; " +
"\n*id* - Индонезийский; *ga* - Ирландский; *it* - Итальянский; \n*ja* - Японский; *ko* - Корейский; " +
"*pl* - Польский; *pt* - Португальский; \n*es* - Испанский; *tr* - Турецкий; *vi* - Вьетнамский."
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}
// Handle the msg command here
func (a *application) msgHandler(m *tbot.Message) {
a.client.SendChatAction(m.Chat.ID, tbot.ActionTyping)
msg := ""
source := ""
target := ""
text := ""
languages := map[string]string{
"ru": "rus",
"en": "eng",
"ar": "ara",
"zh": "chs",
"fr": "fre",
"de": "ger",
"it": "kor",
"ja": "jpn",
"pl": "pol",
"pt": "por",
"tr": "tur",
"hi": "Распознование хинди не поддерживается.",
"id": "Распознование индонезийского не поддерживается.",
"ga": "Распознование ирландского не поддерживается.",
"es": "Распознование испанского не поддерживается.",
"vi": "Распознование вьетнамского не поддерживается.",
}
if len(m.Text) > 4{
source = strings.ToLower(m.Text[:len(m.Text)-(len(m.Text)-2)])
target = m.Text[:len(m.Text)-(len(m.Text)-4)]
target = strings.ToLower(target[len(target)-2:])
text = m.Text[len(m.Text)-(len(m.Text)-4):]
if languages[source] == ""{
msg = "Неправильный код языка текста!\nПосмотри коды командой */start*."
} else if languages[target] == ""{
msg = "Неправильный код языка перевода!\nПосмотри коды командой */start*."
}
}else{
msg = "Слишком короткое сообщение!\nПосмотри на пример командой */start*."}
if msg == "" && len(m.Text) > 12{
ocryes := strings.ToLower(text[:len(text)-(len(text)-8)])
if ocryes[:len(ocryes)-4] == "http" {
res, err := http.Get("https://status.ocr.space/")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode != 200 {
log.Fatalf("status code error: %d %s", res.StatusCode, res.Status)
}
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
log.Fatal(err)
}
doc.Find("span").Each(func(i int, s *goquery.Selection) {
fruw := ""
if i == 0 {
fruw = strings.Trim(s.Text(), " ")
if fruw != "UP" {
msg = "В данный момент сервера OCR недоступны."
}
}
})}
if msg == "" && ocryes[:len(ocryes)-4] == "http"{
//токен + язык
config := ocr.InitConfig(os.Getenv("OCR_TOKEN"), languages[source])
//урл
result, err := config.ParseFromUrl(text)
if err != nil {
fmt.Println(err)
}
//вывод текста
text = fmt.Sprintln(result.JustText())
}
}
if msg == ""{
message := map[string]interface{}{
"q": text,
"source": source,
"target": target,
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Println(err)
}
resp, err := http.Post("https://trans.zillyhuhn.com/translate", "application/json",
bytes.NewBuffer(bytesRepresentation))
if err != nil {
log.Println(err)
}
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
msg = fmt.Sprintln(result)
msg = strings.TrimPrefix(msg, "map[translatedText:")
msg = msg[:len(msg)-2]
}
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}

View File

@ -0,0 +1,26 @@
package main
import (
"log"
"os"
"github.com/yanzay/tbot/v2"
)
type application struct {
client *tbot.Client
}
var (
app application
bot *tbot.Server
token string
)
func main() {
bot = tbot.New(os.Getenv("TELEGRAM_TOKEN"), tbot.WithWebhook("https://libretranslate-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
web: bin/magicdeer-bot

View File

@ -0,0 +1,105 @@
### [t.me/magicdeerbot](https://t.me/magicdeerbot)
```
.__ .___ ___. __
_____ _____ ____ |__| ____ __| _/____ ___________ \_ |__ _____/ |_
/ \\__ \ / ___\| |/ ___\ / __ |/ __ \_/ __ \_ __ \ ______ | __ \ / _ \ __\
| Y Y \/ __ \_/ /_/ > \ \___/ /_/ \ ___/\ ___/| | \/ /_____/ | \_\ ( <_> ) |
|__|_| (____ /\___ /|__|\___ >____ |\___ >\___ >__| |___ /\____/|__|
\/ \//_____/ \/ \/ \/ \/ \/
```
Сакральный олень теперь и в Телеграме. Гороскопы,<br />
выбор из нескольких вариантов и ответы на вопросы.<br />
Сделано с помощью: [ignio.com](https://ignio.com) + [redis](https://github.com/go-redis/redis) + [tbot](https://github.com/yanzay/tbot).
### Выбор знака зодиака
```
user:
Дева.
bot:
< Знак зодиака изменён, Дева. >
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
```
### Гороскоп на сегодня
```
user:
/today
bot:
< Гороскоп на сегодня, Дева:
Сегодняшний день создан для любви. Используйте его с толком. >
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
```
### Гороскоп на завтра
```
user:
/tomorrow
bot:
< Гороскоп на завтра, Дева:
Сегодня вам следует быть осмотрительней, балансируя на тонкой перемычке
между юмором и сарказмом. Последний вам успеха в обществе не принесет. >
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
```
### Выбор варианта
```
user:
Го или Питон или Руби или Баш?
bot:
< Го >
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
```
### Ответ на вопрос
```
user:
Сегодня будет дождь?
bot:
< 100% >
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
```

View File

@ -0,0 +1,16 @@
module github.com/fruworg/magicdeer-bot
// +heroku goVersion go1.17
go 1.17
require (
github.com/joho/godotenv v1.3.0
github.com/yanzay/tbot/v2 v2.0.1
github.com/PuerkitoBio/goquery v1.8.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/yanzay/tbot v1.0.0 // indirect
github.com/go-redis/redis v6.15.9+incompatible // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 // indirect
golang.org/x/text v0.3.6 // indirect
)

140
golang/sacredeer-bot/go.sum Normal file
View File

@ -0,0 +1,140 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506 h1:RPrQRi67MUoUPg/3wwL9K9vKVWAB180e2WJgxC02CJE=
github.com/yanzay/log v0.0.0-20160419144809-87352bb23506/go.mod h1:x2hAcqPbZzQz79Fzr9xEe7BM73+UsZ3nBucx2u30oSk=
github.com/yanzay/tbot v1.0.0 h1:pKLHIvdiHRgU5iTfpWlgMTCWyD4vIQtAsOy7LCYMsAo=
github.com/yanzay/tbot v1.0.0/go.mod h1:rS36e4e2P56jkI0bUuZtzjBBIwMIdBBTUHfI4tgG5BM=
github.com/yanzay/tbot/v2 v2.0.1 h1:d/Ecve1XiJqZeEnmA45E3jdQxuXhlZVk7DmdNtNJITg=
github.com/yanzay/tbot/v2 v2.0.1/go.mod h1:q0+8JblBq9tLAnKHdBIZsHwDvMS9TfO6mNfaAk1VrHg=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 h1:/6y1LfuqNuQdHAm0jjtPtgRcxIxjVZgm5OTu8/QhZvk=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=

View File

@ -0,0 +1,156 @@
package main
import (
"encoding/json"
"fmt"
"log"
"math/rand"
"net/http"
"os"
"strings"
"time"
"github.com/PuerkitoBio/goquery"
"github.com/go-redis/redis"
"github.com/yanzay/tbot/v2"
)
var opt, err = redis.ParseURL(os.Getenv("REDIS_URL"))
var client = redis.NewClient(&redis.Options{
Addr: opt.Addr,
Password: opt.Password,
DB: opt.DB,
})
//deer by asciiart.eu
//flower by eng50232@leonis.nus.sg
var magicDeer = `
\ / . *
* : )) ((
\ // (") \\ ' .
: \\_\)/_//
. \ ~/~ ' ~\~\
( Q/ _/Q ~ o
o / / ,|
' (~~~)__.-\ |
\'~~ | | *
. | | |
`
type Author struct {
Sign string `json:"sign"`
}
// Handle the /start command here
func (a *application) startHandler(m *tbot.Message) {
msg := "Что может *сакральный олень?*\n\nОтветить на вопрос:\nЗадай вопрос и ты получишь ответ." +
"\nНа вопрос ответом должны быть да/нет.\n\nВыбрать из нескольких вариантов:" +
"\nРаздели варианты союзом *или*.\nМинимум - 2 варианта, максимума нет.\nНе забудь про *пробелы*, пример:" +
"\nЛечь спать *или* дочитать мангу?\n" +
"\nПредсказать будущее:\nДля начала выбери свой знак зодиака.\nОтправь его в чат на русском языке." +
"\nДалее введи соответствующую команду:\n*/today* - предсказание на сегодня\n*/tomorrow* - предсказание на завтра" +
//сделаю "\n*/daily* - ежедневные предсказания" +
"\n\nВнимание:\n*Сакрального оленя* нельзя тревожить," +
"\nзадавая тот же вопрос несколько раз.\nТакже нельзя задавать любые\nвопросы связанные с *оленем*.\n" +
"\nВ случае нарушения правил выше\nты не получишь достоверного ответа."
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}
// Handle the msg command here
func (a *application) msgHandler(m *tbot.Message) {
msg := "Ты сделал что-то не так"
signs := map[string]string{
"овен": "aries",
"телец": "taurus",
"близнецы": "gemini",
"рак": "cancer",
"лев": "leo",
"дева": "virgo",
"весы": "libra",
"скорпион": "scorpio",
"стрелец": "sagittarius",
"козерог": "capricorn",
"водолей": "aquarius",
"рыбы": "pisces"}
if signs[strings.ToLower(strings.TrimRight(m.Text, " .!"))] != "" {
json, err := json.Marshal(Author{Sign: m.Text})
if err != nil {
fmt.Println(err)
}
err = client.Set(m.Chat.ID, json, 0).Err()
if err != nil {
fmt.Println(err)
}
msg = fmt.Sprintf("Знак зодиака изменён, %s.", strings.TrimRight(m.Text, " .!"))
} else if m.Text == "/today" || m.Text == "/tomorrow" {
sign, err := client.Get(m.Chat.ID).Result()
if err == redis.Nil {
msg = "Сначала выбери знак зодиака!\nКоманда /start в помощь."
} else {
sign = strings.TrimLeft(sign, `{"sign":"`)
sign = strings.TrimRight(sign, `"}`)
day := "tod"
outday := "на сегодня"
if m.Text != "/today" {
day = "tom"
outday = "на завтра"
}
res, err := http.Get("https://ignio.com/r/daily/" + day + "/" + signs[strings.ToLower(strings.TrimRight(sign, " .!"))] + ".html")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode != 200 {
log.Fatalf("status code error: %d %s", res.StatusCode, res.Status)
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
log.Fatal(err)
}
doc.Find(`div[style="margin: 20px 0;"]`).Each(func(i int, s *goquery.Selection) {
btext := fmt.Sprintf("%s", s.Text())
if m.Text == "/tomorrow"{
replacer := strings.NewReplacer("Сегодня", "Завтра", "сегодня", "завтра")
btext = replacer.Replace(btext)}
msg = fmt.Sprintf("Гороскоп %s, %s: \n%s", outday, sign, strings.TrimSpace(btext))
})}
} else {
answer := map[int]string{
0: "Да",
1: "Нет",
2: "Это не важно",
3: "...",
4: "У тебя есть проблемы серьёзней",
5: "Да, хотя зря",
6: "Никогда",
7: "100%",
8: "1 из 100",
9: "Попробуй ещё раз"}
rand.Seed(time.Now().UnixNano())
arr := strings.Split(m.Text, " или ")
if len(arr) > 1 {
msg = "Ты не оставил мне выбора"
for i := 0; i < len(arr)-1; i++ {
if strings.TrimRight(arr[i], "?") != strings.TrimRight(arr[i+1], "?") {
rnd := rand.Intn(len(arr))
msg = strings.TrimRight(arr[rnd], "?")
continue
}
}
} else {
rnd := rand.Intn(10)
msg = answer[rnd]
}
}
if strings.ToLower(strings.TrimRight(m.Text, " .!")) == "спасибо" {
msg = "Пожалуйста"
}
msg = fmt.Sprintf("```\n< %s > %s```", msg, magicDeer)
a.client.SendChatAction(m.Chat.ID, tbot.ActionTyping)
tsleep := rand.Intn(1000-200) + 200
time.Sleep(time.Duration(tsleep) * time.Millisecond)
a.client.SendMessage(m.Chat.ID, msg, tbot.OptParseModeMarkdown)
}

View File

@ -0,0 +1,26 @@
package main
import (
"log"
"os"
"github.com/yanzay/tbot/v2"
)
type application struct {
client *tbot.Client
}
var (
app application
bot *tbot.Server
token string
)
func main() {
bot = tbot.New(os.Getenv("TELEGRAM_TOKEN"), tbot.WithWebhook("https://magicdeer-bot.herokuapp.com", ":"+os.Getenv("PORT")))
app.client = bot.Client()
bot.HandleMessage("/start", app.startHandler)
bot.HandleMessage(".+", app.msgHandler)
log.Fatal(bot.Start())
}

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,3 @@
# active-directory
Автоматизированные создание и ввод пользователей в домен.

View File

@ -0,0 +1,156 @@
# Разрешаем запуск скрипта и запускаем его
# Set-ExecutionPolicy Unrestricted -force ; cd ~\Desktop\ ; .\ad-users.ps1
Import-Module ActiveDirectory
# Указываем директорию
$dir = "$(pwd)\Users"
new-item -path "$dir" -ItemType Directory -force >$null
# Переменные DC
$dc_first = "demo"
$dc_second = "lab"
# Переменные OU
$ou_main = "DemoOffice"
$ou_users = "Users"
$ou_computers = "Computers"
# Переменные для настройки сети
$mask = "255.255.255.0"
$gw = '192.168.10.1'
$dns = '192.168.10.100'
$eth = 'Ethernet0'
# Переменные PATH
$dc_path = "DC=$dc_first,DC=$dc_second"
$main_path = "OU=$ou_main,DC=$dc_first,DC=$dc_second"
$users_path = "OU=$ou_users,OU=$ou_main,DC=$dc_first,DC=$dc_second"
$computers_path = "OU=$ou_computers,OU=$ou_main,DC=$dc_first,DC=$dc_second"
# Проверка OU
try
{
Get-ADOrganizationalUnit -SearchBase "$main_path" -Filter * >$null
Get-ADOrganizationalUnit -SearchBase "$users_path" -Filter * >$null
Get-ADOrganizationalUnit -SearchBase "$computers_path" -Filter * >$null
}
catch
{
New-ADOrganizationalUnit -Name "$ou_main" -Path $dc_path
New-ADOrganizationalUnit -Name "$ou_users" -Path $main_path
New-ADOrganizationalUnit -Name "$ou_computers" -Path $main_path
}
# Вводим переменные
if ("$args[0]" -eq "[0]"){
$numb = "1"
} else {
$numb = $args[0]
}
$count=1..$numb
$users = @()
Foreach ($i in $count)
{
$Row = "" | Select Username,Admin,IP,PC
$Row.Username = Read-Host "Введите имя пользователя номер $i"
$Row.Admin = Read-Host "Должен ли пользователь $i иметь права администратора? (Y - да, N - нет)"
if ($Row.Admin -eq "y")
{$Row.Admin = "Yes"}
else {$Row.Admin = "No"}
$Row.PC = Read-Host "Введите имя компьютера номер $i"
$Row.IP = Read-Host "Введите IP адрес для пользователя номер $i"
$Users += $Row
}
$pass = Read-Host 'Enter the password'
# Цикл с пользователями
foreach ($user in $users) {
$name = $user.Username
$ip = $user.ip
$pc = $user.pc
$Username = @{
Name = "$name"
GivenName = "$name"
UserPrincipalName = "$name@$dc_first.$dc_second"
Path = $users_path
ChangePasswordAtLogon = $true
AccountPassword = "$pass" | ConvertTo-SecureString -AsPlainText -Force
Enabled = $true
}
# Создание пользователей
New-ADUser @Username
Set-ADUser $name -PasswordNeverExpires:$True
if ($user.Admin -eq "Yes")
{Add-ADGroupMember "Domain admins" $name}
# Создание скрпитов для компьютеров "локально"
$securepassword = '$pass' + " | ConvertTo-SecureString -AsPlainText -Force"
$credential = "New-Object System.Management.Automation.PSCredential -ArgumentList" + ' $name, $securepassword'
$out = '# Разрешаем запуск скрипта и запускаем его
# Set-ExecutionPolicy Unrestricted -force ; cd ~\Desktop\ ;' + " .\$name.ps1" + '
$name = "' + "$name" + '"
' + '$pass = "' + "$pass" + '"
' + '$securepassword = ' + "$securepassword
" + '$credential = ' + "$credential
Disable-NetAdapterBinding -Name '*' -ComponentID ms_tcpip6
netsh interface ip set address name=$eth static $ip $mask $gw
netsh interface ip set dns $eth static $dns " + '>$null' + "
Timeout /T 5
Add-Computer -DomainName $dc_first.$dc_second -NewName $pc -OUPath " + '"' + "$computers_path" + '"' + " -Credential" + ' $credential
$ans = Read-Host "Перезагрузить ПК?"
if ($ans -eq "y")
{Restart-Computer -Force}'
$con="Проводное соединение 1"
$outl = '#!/usr/bin/env bash
if [[ $(whoami) == "root" ]]; then
' + '
ip=' + '"' + $ip + '"' + '
mask=' + '"' + 24 + '"' + '
gw=' + '"' + $gw + '"' + '
dns=' + '"' + $dns + '"' + '
pc=' + '"' + $pc + '"' + '
dc_first=' + '"' + $dc_first + '"' + '
dc_second=' + '"' + $dc_second + '"' + '
con=' + '"' + $con + '"' + '
name=' + '"' + $name + '"' + '
#Установка пакетов
apt install astra-ad-sssd-client -y
#Вводим краткое доменное имя
hostnamectl set-hostname "$pc"
# Задаем адрес шлюза
nmcli con mod "$con" ip4 $ip/$mask gw4 $gw
# Задаем адреса DNS
nmcli con mod "$con" ipv4.dns "$dns"
# Отключаем DHCP, переводим в "ручной" режим настройки
nmcli con mod "$con" ipv4.method manual
nmcli con mod "$con" ipv6.method ignore
nmcli -p con show "$con" | grep ipv4
# Перезапускаем соединение для применения новых настроек
nmcli con down "$con" ; nmcli con up "$con"
#Вход в домен Active Directory
astra-ad-sssd-client -d demo.lab -u Administrator -p ' + "$pass" + ' -y
# sudo
echo "$name ALL=(ALL:ALL) ALL" | sudo EDITOR="tee -a" visudo
#Перезагрузка
read -p "Перезагрузить ПК? " in
if [[ "$in" == "y" ]]; then
sudo reboot
fi
#Выполнено не от рута
else
echo "Запусти скрипт через sudo!"
fi'
# Указываем директорию и записываем данные пользователя
write-output $out | out-file -append -encoding utf8 "$dir\$name.ps1"
# Указываем директорию и записываем данные пользователя
write-output $outl | out-file -append -encoding utf8 "$dir\$name.sh"
((Get-Content "$dir\$name.sh") -join "`n") + "`n" | Set-Content -NoNewline -encoding utf8 "$dir\$name.sh"
}

9
powershell/clock/LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,3 @@
# clock
Добавляет секунды в часы

View File

@ -0,0 +1,9 @@
$wshell = New-Object -ComObject Wscript.Shell
if (Get-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSecondsInSystemClock 2>$null){
Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSecondsInSystemClock
$wshell.Popup("The registry entry was deleted.")
}else{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSecondsInSystemClock -PropertyType DWord -Value 1 >$null
$wshell.Popup("The registry entry was created.")
}
taskkill /f /im explorer.exe >$null; start explorer.exe

View File

@ -0,0 +1,2 @@
# cve-sort

View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
echo "CVE;Вердиткт;Критичность уязвимости;Вектор атаки;Комментарий" > cve-out.csv
MAX_CVE=$(wc -l cve-in | grep -o [0-9]*)
for CVE in $(cat cve-in)
do
let "CURRENT_CVE++"
CURL_CVE=$(curl -s https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=$CVE)
ATTACK_VECTOR=$(echo $CURL_CVE | grep -o '"accessVector":"[^"]*' | egrep -o '[^"]*$')
BASE_SCORE=$(printf "%.0f" $(echo $CURL_CVE | egrep -o '"baseScore":[0-9]?[0-9]\.[0-9]' \
| egrep -o '[0-9]?[0-9]\.[0-9]' | head -1))
DESCRIPTION=$(echo $CURL_CVE | grep -o '"value":"[^"]*' | egrep -o '[^"]*$')
if [[ "$ATTACK_VECTOR" == *"PHYSICAL"* ]]
then
VERDICT="НЕ ОБНОВЛЯТЬ!"
elif [[ "$BASE_SCORE" -le 3 ]]
then
VERDICT="НЕ ОБНОВЛЯТЬ!"
elif [[ "$BASE_SCORE" -gt 7 ]]
then
VERDICT="ОБНОВЛЯТЬ!"
elif [[ "$ATTACK_VECTOR" != *"LOCAL"* ]]
then
VERDICT="ОБНОВЛЯТЬ!"
else
VERDICT="НЕ ОБНОВЛЯТЬ!"
fi
echo "$CVE;$VERDICT;$BASE_SCORE;$ATTACK_VECTOR;$DESCRIPTION" >> cve-out.csv
echo "$CURRENT_CVE/$MAX_CVE - $CVE"
sleep 20
done

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 fruworg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,30 @@
Write-Host '
_______________ _____________.____ ________ ________ ____ __.
\_ _____/\ \/ /\______ \ | \_____ \ \_____ \ | |/ _|
| __)_ \ / | ___/ | / | \ / | \| <
| \ / \ | | | |___/ | \/ | \ | \
/_______ //___/\ \ |____| |_______ \_______ /\_______ /____|__ \
\/ \_/ \/ \/ \/ \/
'
Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook" | Out-Null
$olFolders = "Microsoft.Office.Interop.Outlook.olDefaultFolders" -as [type]
$Outlook = New-Object -ComObject Outlook.Application
$Namespace = $Outlook.GetNameSpace("MAPI")
$Folder = $namespace.Folders("im@fruw.org").Folders("foldername")
$Path = "$(pwd)\exp-look.csv"
$i = $max = $Folder.Items.Count
$Writed = 0
if (!(Test-Path -Path $Path)) {
'Тест1;Тест2' | Out-File $Path -Encoding UTF8
}
for(;$i -gt 0;$i--){
if ($Folder.Items[$i].Unread){
$Writed++
$Folder.Items[$i].Unread = $False
$Percent = 100-($i/$max*100)
Write-Progress -Activity "Работаем!" -Status "Осталось прочитать $i у.е." -PercentComplete $Percent
$MailInfo = $Folder.Items[$i] | Select-Object -Property Body, Subject, ReceivedTime, SenderName, SenderEmailAddress
$MailInfo | Out-File $Path -Append -Encoding UTF8
}}
Read-Host -Prompt " Выполнено! Внесено в таблицу $Writed у.е.
Нажмите Enter для того, чтобы выйти"

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,7 @@
### tm-ssl
Создаёт цепочку сертификатов и устанавливает их автоматически.
```
root
∟ server
∟ client
```

View File

@ -0,0 +1,283 @@
# Скачиваем софт по ссылкам ниже
# https://es.ukrtb.ru/nextcloud/s/xwBAsTqWqT8QyBT/download/OpenSSL.msi
# https://es.ukrtb.ru/nextcloud/s/PoxqfCWkXtrdgw7/download/putty.msi
# https://es.ukrtb.ru/nextcloud/s/ybKx8rpJX8fbZtS/download/WinSCP.exe
# Делаем ручное подключение (Астра)
# plink iwtm@192.168.1.10 -pw xxXX1234
# Запускаем скрипт
# Set-ExecutionPolicy Unrestricted -force; cd ~\Desktop\; .\tm-ssl.ps1
# Павершелл следует запускать от имени администратора
Write-Host "`nПроверка привелегий администратора:"
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Запустите павершелл от имени администратора.`n"
Break
}
else {
Write-Host "Скрипт запущен от имени администратора.`n" -ForegroundColor Green
}
# Остановка скрипта при ошибке
$ErrorActionPreference = "Stop"
# Указываем пути
$path = "C:\Program Files\OpenSSL-Win64\bin"
$hpath = "$(pwd)\tm-ssl"
$wpath = "C:\Program Files (x86)\WinSCP"
$lpath = "$hpath\linux"
$cpath = "$hpath\certs"
$dpath = "tmp"
# Названия сертификатов
$root = "root"
$intermediate = "intermediate"
$server = "iwtm"
$client = "arm"
# Данные для линупса
$cnf = "iw"
if (!($ip = Read-Host "Введите IP IWTM [192.168.1.10]")) { $ip = "192.168.1.10" }
if (!($luser = Read-Host "Введите пользователя IWTM [iwtm]")) { $luser = "iwtm" }
if (!($lpassword = Read-Host "Введите пароль IWTM [xxXX1234]")) { $lpassword = "xxXX1234" }
# Промежуточный = серверный
if (!($servint = Read-Host "`nСделать серверный сертификат промежуточным [y]")) { $servint = "y" }
if ($servint -eq "y"){
$intermediate = $server
}
# Данные для сертификата
if (!($country = Read-Host "`nВведите страну [RU]")) { $country = "RU" }
if (!($state = Read-Host "Введите штат [RB]")) { $state = "RB" }
if (!($city = Read-Host "Введите город [Ufa]")) { $city = "Ufa" }
if (!($corp = Read-Host "Введите организацию [UKRTB]")) { $corp = "UKRTB" }
if (!($unit = Read-Host "Введите отдел [IT]")) { $unit = "IT" }
if (!($hostname = Read-Host "Введите хостнейм [iwtm]")) { $hostname = "iwtm" }
if (!($domain = Read-Host "Введите домен [demo.lab]")) { $domain = "demo.lab" }
if (!($password = Read-Host "Введите пароль .p12 [xxXX1234]")) { $password = "xxXX1234" }
$site = "$hostname.$domain"
# Конфиг опенссл
$config = "
[ ca ]
default_ca = CA_default
[ CA_default ]
certs = ./
serial = serial
database = index
new_certs_dir = ./
certificate = $root.crt
private_key = $root.key
default_days = 36500
default_md = sha256
preserve = no
email_in_dn = no
nameopt = default_ca
certopt = default_ca
policy = policy_match
[ policy_match ]
commonName = supplied
countryName = optional
stateOrProvinceName = optional
organizationName = optional
organizationalUnitName = optional
emailAddress = optional
[ req ]
input_password = $password
prompt = no
distinguished_name = default
default_bits = 2048
default_keyfile = priv.pem
default_md = sha256
req_extensions = v3_req
encyrpt_key = no
x509_extensions = v3_ca
[ default ]
commonName = default
[ v3_ca ]
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
basicConstraints = critical,CA:true
[ v3_intermediate_ca ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical, CA:true, pathlen:0
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
subjectAltName = @alt_names
[ v3_req ]
basicConstraints = CA:FALSE
subjectKeyIdentifier = hash
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = $site
IP.1 = $ip"
# Удаляем файлы, которые могли остаться от прошлого запуска скрипта
cd $path
Remove-Item * -Include *.sh,*.cnf,*.key,*.csr,*.crt,*.p12,*.pem,seria*,inde* -Force
if (Test-Path "$hpath") {
rm -r -fo "$hpath"
}
# Создаём файл с номером и индексом скрипта, конфиг опенссл и скрипт для линукса
out-file -append -encoding utf8 "index"
write-output "01" | out-file -append -encoding ASCII "serial"
write-output $config | out-file -append -encoding utf8 "$cnf.cnf"
# Продолжение скрипта при ошибке
$ErrorActionPreference = "Continue"
# Обработка ошибок
$TempFile = New-TemporaryFile
function Error-Break{
# Если в файлы нет Signature ok + MAC + он не пустой, то if выполняется
if ((!(Select-String -Path "$TempFile" -Pattern 'Signature ok') -and (!(Select-String -Path "$TempFile" -Pattern 'MAC'))) -xor ([String]::IsNullOrWhiteSpace((Get-content $TempFile)))){
# Вывод ошибок
$err = Get-Content -Path $TempFile
Write-Error "$err"
# break
break
}
}
# Имя сертификата
$name = $root
# Создаём корневой ключ
.\openssl genrsa -out "$root.key" 2> $TempFile; Error-Break
# Создаём корневой самоподписанный сертификат
.\openssl req -x509 -new -nodes -key "$root.key" -sha256 -days 1024 -out "$root.crt" -config "$cnf.cnf" -subj "/C=$country/ST=$state/L=$city/O=$corp/OU=$unit/CN=$name/emailAddress=$name@$domain" *> $TempFile; Error-Break
Write-Host "`nКорневой сертификат создан." -ForegroundColor Green
# Имя сертификата
$name = $intermediate
# Создаёи промежуточный ключ
.\openssl genrsa -out "$intermediate.key" *> $TempFile; Error-Break
# Создаём запрос на подпись
.\openssl req -new -sha256 -config "$cnf.cnf" -key "$intermediate.key" -out "$intermediate.csr" *> $TempFile; Error-Break
# Подписываем сертификат корневым
.\openssl ca -config "$cnf.cnf" -extensions v3_intermediate_ca -days 2650 -batch -in "$intermediate.csr" -out "$intermediate.crt" -subj "/C=$country/ST=$state/L=$city/O=$corp/OU=$unit/CN=$name/emailAddress=$name@$domain" *> $TempFile; Error-Break
# Промежуточный =/= серверный + создание серверного сертификата
if ($servint -ne "y"){
Write-Host "Промежуточный сертификат создан." -ForegroundColor Green
# Имя сертификата
$name = $server
# Создаём ключ клиента
.\openssl genrsa -out "$server.key" *> $TempFile; Error-Break
# Создаём запрос на подпись
.\openssl req -new -key "$server.key" -out "$server.csr" -config "$cnf.cnf" *> $TempFile; Error-Break
# Подписываем сертификат промежуточным
.\openssl x509 -req -in "$server.csr" -CA "$intermediate.crt" -CAkey "$intermediate.key" -CAcreateserial -sha256 -days 2650 -days 2650 -set_serial 01 -out "$server.crt" -extensions v3_req -extfile "$cnf.cnf" -subj "/C=$country/ST=$state/L=$city/O=$corp/OU=$unit/CN=$name/emailAddress=$name@$domain" *> $TempFile; Error-Break
}
Write-Host "Серверный сертификат создан." -ForegroundColor Green
# Создание клиентского сертификата
# Имя сертификата
$name = $client
# Создаём ключ клиента
.\openssl genrsa -out "$client.key" *> $TempFile; Error-Break
# Создаём запрос на подпись
.\openssl req -new -key "$client.key" -out "$client.csr" -config "$cnf.cnf" *> $TempFile; Error-Break
# Подписываем сертификат промежуточный
(.\openssl x509 -req -in "$client.csr" -CA "$intermediate.crt" -CAkey "$intermediate.key" -CAcreateserial -sha256 -days 2650 -out "$client.crt" -extensions v3_req -extfile "$cnf.cnf" -subj "/C=$country/ST=$state/L=$city/O=$corp/OU=$unit/CN=$name/emailAddress=$name@$domain") *> $TempFile; Error-Break
Write-Host "Клиентский сертификат создан." -ForegroundColor Green
# Остановка скрипта при ошибке
$ErrorActionPreference = "Stop"
$thumbprint = $(Get-PfxCertificate -FilePath "$client.crt" | select -expand Thumbprint).ToLower()
# Экспортируем промежуточный сертификат и ключ
.\openssl pkcs12 -export -in "$server.crt" -inkey "$server.key" -out "$server.p12" -password pass:"$password"
# Экспортируем для бравузера
.\openssl pkcs12 -export -in "$client.crt" -inkey "$client.key" -out "$client.p12" -password pass:"$password"
# Экспортируем всё
.\openssl pkcs12 -export -in "$server.crt" -inkey "$server.key" -in "$client.crt" -inkey "$client.key" -in "$root.crt" -inkey "$root.key" -out out.p12 -password pass:"$password"
&{
# Создаём директории для сертификатов и линупса
New-Item -path "$cpath" -ItemType Directory -force
New-Item -path "$lpath" -ItemType Directory -force
} >$null
Write-Host "`nДиректории созданы успешно." -ForegroundColor Green
$ssl_client_fingerprint = '$ssl_client_fingerprint'
# Скрипт для линукса
$linux = "#!/usr/bin/env bash
openssl pkcs12 -in /$dpath/$server.p12 -nokeys -out /opt/iw/tm5/etc/certification/$server.crt -password pass:$password
openssl pkcs12 -in /$dpath/$server.p12 -nocerts -nodes -out /opt/iw/tm5/etc/certification/$server.key -password pass:$password
rm /$dpath/$server.p12
cd /etc/nginx/conf.d
cp iwtm.conf -n iwtm.conf.bak || mv iwtm.conf.bak iwtm.conf
sed -i '9s/web-server.pem/$server.crt/' iwtm.conf
sed -i '10s/web-server.key/$server.key/' iwtm.conf
sed -i '12i ssl_verify_client optional_no_ca;' iwtm.conf
sed -i '21i if ( $ssl_client_fingerprint != $thumbprint ) { return 496; }' iwtm.conf
"
write-output $linux | out-file -append -encoding utf8 "$cnf.sh"
# Преобразуем скрипт для линукса в *nix формат
((Get-Content "$cnf.sh") -join "`n") + "`n" | Set-Content -NoNewline "$cnf.sh"
# Перемещаем скрипт для линукса и .p12
Move-Item -path ".\$cnf.sh" -destination "$lpath\$cnf.sh" -force
Move-Item -path ".\$server.p12" -destination "$lpath\$server.p12" -force
# Перемещаем остальное добро
Get-ChildItem -Path ".\*.pfx" -Recurse | Move-Item -Destination "$cpath" -force
Get-ChildItem -Path ".\*.p12" -Recurse | Move-Item -Destination "$cpath" -force
Get-ChildItem -Path ".\*.key" -Recurse | Move-Item -Destination "$cpath" -force
Get-ChildItem -Path ".\*.csr" -Recurse | Move-Item -Destination "$cpath" -force
Get-ChildItem -Path ".\*.crt" -Recurse | Move-Item -Destination "$cpath" -force
# Подчищаем за собой
Remove-Item * -Include *.cnf,*.pem,seria*,inde* -Force
# Устанавливаем сертификаты в шиндоус
&{
Import-Certificate -FilePath "$cpath\$root.crt" -CertStoreLocation Cert:\LocalMachine\Root
if ($servint -eq "y"){
Import-Certificate -FilePath "$cpath\$server.crt" -CertStoreLocation Cert:\LocalMachine\CA
}else{
Import-Certificate -FilePath "$cpath\$intermediate.crt" -CertStoreLocation Cert:\LocalMachine\CA
Import-Certificate -FilePath "$cpath\$server.crt" -CertStoreLocation Cert:\LocalMachine\My
}
Import-Certificate -FilePath "$cpath\$client.crt" -CertStoreLocation Cert:\LocalMachine\My
} >$null
Write-Host "Сертификаты установлены." -ForegroundColor Green
# Перемещаем скрипт и сертификаты в линупс
&{
cd $wpath
.\WinSCP.exe sftp://${luser}:${lpassword}@${ip}/$dpath/ /upload $lpath\$server.p12 $lpath\$cnf.sh /defaults
Read-Host "`nКогда WinSCP успешно передаст файлы, нажмите [ENTER]"
# Запускаем скрипт удалённо
echo y | plink -batch $luser@$ip -pw $lpassword "exit" *> $null
plink -batch $luser@$ip -pw $lpassword "sudo bash /$dpath/$cnf.sh"; Error-Break
# Чистим за собой
plink -batch $luser@$ip -pw $lpassword "sudo rm /$dpath/$cnf.sh"; Error-Break
plink -batch $luser@$ip -pw $lpassword "history -c"; Error-Break
} 2>$null
Write-Host "IWTM сконфигурирован." -ForegroundColor Green
# Записываем данные в DNS
&{Remove-DnsServerResourceRecord -ZoneName $domain -Name $hostname -RRType A -force} 2> $null
Add-DnsServerResourceRecordA -Name $hostname -IPv4Address $ip -ZoneName $domain -TimeToLive 01:00:00
Write-Host "DNS запись создана.`n" -ForegroundColor Green
Write-Warning "Перезагрузи NGINX и установи в бразуер сертификат.`n"

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 fruworg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,64 @@
#Перед началом необходимо выполнить следующие команды:
#Install-module PSExcel
#Get-command -module psexcel
clear
Write-Host "
.__ .__
___ __| | _________ ___ |__|_____
\ \/ / | / ___/\ \/ / ______ | \____ \
> <| |__\___ \ > < /_____/ | | |_> >
/__/\_ \____/____ >/__/\_ \ |__| __/
\/ \/ \/ |__|
"
if ($Args.count -ne 0){
$Value = $Args
} else {
$Value = Read-Host " Введите имена файлов"
Write-Host ""
$Value = $Value -split " "
}
for ($i=0; $i -lt $Value.count; $i++){
$Path = "$(pwd)\" + [string]$Value[$i] + ".xlsx"
try{
$File = Import-XLSX -Path $Path
$Out = $File.IP -match "\d" -replace "ip address "
$Out = $Out -replace " 255\.0\.0\.0", "/8"
$Out = $Out -replace " 255\.128\.0\.0", "/9"
$Out = $Out -replace " 255\.192\.0\.0", "/10"
$Out = $Out -replace " 255\.224\.0\.0", "/11"
$Out = $Out -replace " 255\.240\.0\.0", "/12"
$Out = $Out -replace " 255\.248\.0\.0", "/13"
$Out = $Out -replace " 255\.252\.0\.0", "/14"
$Out = $Out -replace " 255\.254\.0\.0", "/15"
$Out = $Out -replace " 255\.255\.0\.0", "/16"
$Out = $Out -replace " 255\.255\.128", "/17"
$Out = $Out -replace " 255\.255\.192\.0", "/18"
$Out = $Out -replace " 255\.255\.224\.0", "/19"
$Out = $Out -replace " 255\.255\.240\.0", "/20"
$Out = $Out -replace " 255\.255\.252\.0", "/22"
$Out = $Out -replace " 255\.255\.254\.0", "/23"
$Out = $Out -replace " 255\.255\.255\.0", "/24"
$Out = $Out -replace " 255\.255\.255\.128", "/25"
$Out = $Out -replace " 255\.255\.255\.192", "/26"
$Out = $Out -replace " 255\.255\.255\.224", "/27"
$Out = $Out -replace " 255\.255\.255\.240", "/28"
$Out = $Out -replace " 255\.255\.255\.248", "/29"
$Out = $Out -replace " 255\.255\.255\.252", "/30"
$Out | Out-File .\except.txt -Append -Encoding UTF8
cat .\except.txt | select -Unique | sc .\except.txt
$nerr = $nerr + " $Path
"
}
catch{
$err = $err + " $Path
"}
}
if ($nerr -match "[A-z]"){
Write-Host -ForegroundColor Gree " Файлы ниже обработаны:
$nerr"}
if ($err -match "[A-z]"){
Write-Host -ForegroundColor Red " Файлы ниже не найдены:
$err"
}
Read-Host -Prompt " Выполнено! Нажмите Enter"

2
shell/0x0/0x0.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
curl -F"file=@$1" https://0x0.st | xclip -sel clip

21
shell/0x0/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5
shell/0x0/README.md Normal file
View File

@ -0,0 +1,5 @@
### 0x0
Отправляет файл и сохраняет ссылку в буфер обмена.
```
ПКМ -> Открыть с помощью -> 0x0.sh
```

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,3 @@
# astra-linux
Автоматизированная работа с астрой.

View File

@ -0,0 +1,372 @@
#!/usr/bin/env bash
# проверка запуска от имени рута
if [ "$EUID" -ne 0 ]
then echo "Use sudo, dummy."
exit
fi
network_variables () {
# переменные хоста
read -p 'Введите имя этого ПК: ' -i $(hostname -s) -e PC_NAME
read -p 'Введите имя домена: ' -i $(hostname -d) -e DOMAIN
# меняем имя хоста
hostnamectl set-hostname "$PC_NAME"
# переменные сети
read -p 'Введите имя интерфейса: ' -i eth0 -e INTERFACE
read -p 'Введите адрес этого ПК: ' -i $(hostname -i) -e IP
read -p 'Введите маску подсети: ' -i 24 -e SUBNET
read -p 'Введите gateway: ' -i $(echo "$IP" | grep -Eo '([0-9]+\.)+') -e GATEWAY
read -p 'Введите адрес DNS сервера: ' -i $(echo "$IP" | grep -Eo '([0-9]+\.)+') -e DNS
# удаляем все соединения
rm /etc/network/interfaces.d/* 2> /dev/null
nmcli --terse connection show 2> /dev/null | cut -d : -f 1 | \
while read name; do echo nmcli connection delete "$name" 2> /dev/null; done
# поднимаем сеть
echo "auto $INTERFACE" > "/etc/network/interfaces.d/$INTERFACE"
echo "iface $INTERFACE inet static" >> "/etc/network/interfaces.d/$INTERFACE"
echo -e "\taddress $IP" >> "/etc/network/interfaces.d/$INTERFACE"
echo -e "\tnetmask $SUBNET" >> "/etc/network/interfaces.d/$INTERFACE"
echo -e "\tgateway $GATEWAY" >> "/etc/network/interfaces.d/$INTERFACE"
echo "nameserver $DNS" > '/etc/resolv.conf'
systemctl restart networking
# прописываем хостс
echo "127.0.0.1 localhost" > /etc/hosts
echo "$IP $PC_NAME.$DOMAIN $PC_NAME" >> /etc/hosts
}
admin_variables () {
# переменные админа (для входа в домен)
read -p 'Введите логин админимтратора: ' -i Administrator -e ADMIN_LOGIN
read -p 'Введите пароль администратора: ' -i xxXX1234 -e ADMIN_PASSWORD
}
another_variables () {
# переменные другого пк (домен/клиент)
read -p 'Введите имя ПК: ' ANOTHER_PC_NAME
read -p 'Введите адрес ПК: ' ANOTHER_IP
# прописываем хостс
echo "$ANOTHER_IP $ANOTHER_PC_NAME.$DOMAIN $ANOTHER_PC_NAME" >> /etc/hosts
}
check_variables () {
if grep -L "0" <<< "$WHICH_FUNC"; then
read -p "Сеть и хостс настроены? " -i n -e QUESTION
if [[ "$QUESTION" == "n" ]]; then
network_variables
fi
fi
}
admin_rules () {
read -p "Дать пользователю права администратора? " -i y -e QUESTION
if [[ "$QUESTION" == "y" ]]; then
read -p 'Введите имя доменного пользователя: ' USERNAME
pdpl-user -i 63 "$USERNAME"
echo "$USERNAME ALL=(ALL:ALL) ALL" | EDITOR="tee -a" visudo
fi
}
1.6_repos_update () {
# подсказка по дискам
echo "1. Smolensk-1.6.iso"
echo "2. Devel-Smolensk-1.6.iso"
echo "3. Repository-Update.iso"
echo "4. Repository-Update-Devel.iso"
read -p "Вы вставили все диски?"
# CD/DVD-1 [Smolensk-1.6]
while ! ls /dev/sr0 > /dev/null 2>&1; do
read -p "Вставьте Smolensk-1.6.iso"
done
mkdir -p /srv/repo/smolensk/main
mount /dev/sr0 /media/cdrom
cp -a /media/cdrom/* /srv/repo/smolensk/main
umount /media/cdrom
# CD/DVD 2 [Devel-Smolensk-1.6]
while ! ls /dev/sr1 > /dev/null 2>&1; do
read -p "Вставьте Devel-Smolensk-1.6.iso"
done
mkdir -p /srv/repo/smolensk/devel
mount /dev/sr1 /media/cdrom
cp -a /media/cdrom/* /srv/repo/smolensk/devel
umount /media/cdrom
# CD/DVD 3 [20200722SE16]
while ! ls /dev/sr2 > /dev/null 2>&1; do
read -p "Вставьте Repository-Update.iso"
done
mkdir -p /srv/repo/smolensk/update
mount /dev/sr2 /media/cdrom
cp -a /media/cdrom/* /srv/repo/smolensk/update
umount /media/cdrom
# CD/DVD 4 [Repository-Update-Devel]
while ! ls /dev/sr3 > /dev/null 2>&1; do
read -p "Вставьте Repository-Update-Devel.iso"
done
mkdir -p /srv/repo/smolensk/update-dev
mount /dev/sr3 /media/cdrom
cp -a /media/cdrom/* /srv/repo/smolensk/update-dev
umount /media/cdrom
# дополняем источники
echo "deb file:/srv/repo/smolensk/main smolensk main contrib non-free" > /etc/apt/sources.list
echo "deb file:/srv/repo/smolensk/devel smolensk main contrib non-free" >> /etc/apt/sources.list
echo "deb file:/srv/repo/smolensk/update smolensk main contrib non-free" >> /etc/apt/sources.list
echo "deb file:/srv/repo/smolensk/update-dev smolensk main contrib non-free" >> /etc/apt/sources.list
}
1.7_repos_update () {
# сертификаты
apt install apt-transport-https ca-certificates
# дополняем источники
echo "deb https://download.astralinux.ru/astra/stable/1.7_x86-64/repository-main/ 1.7_x86-64 main contrib non-free" > /etc/apt/sources.list
echo "deb https://download.astralinux.ru/astra/stable/1.7_x86-64/repository-update/ 1.7_x86-64 main contrib non-free" >> /etc/apt/sources.list
echo "deb https://download.astralinux.ru/astra/stable/1.7_x86-64/repository-base/ 1.7_x86-64 main contrib non-free" >> /etc/apt/sources.list
echo "deb https://download.astralinux.ru/astra/stable/1.7_x86-64/repository-extended/ 1.7_x86-64 main contrib non-free" >> /etc/apt/sources.list
}
repos_update () {
# проверяем версию Астры
ASTRA_VERISON=$(cat /etc/*-release)
# версия 1.6
if grep -q "1.6" <<< "$ASTRA_VERISON"; then
1.6_repos_update
fi
# версия 1.7
if grep -q "1.7" <<< "$ASTRA_VERISON"; then
1.7_repos_update
fi
# обновление пакетов
apt update -y
apt dist-upgrade -y
apt -f install -y
apt autoremove -y
}
ssh_server () {
# устанавливаем пакет
apt install openssh-server -y
# включаем SSH
systemctl enable --now ssh
}
ssh_client () {
# генерим ключи
ssh-keygen
# логин@пароль
echo "Вводите данные сервера."
admin_variables
# передаюм ключи на удалённый сервер
ssh-copy-id -i ~/.ssh/id_rsa.pub "$ADMIN_LOGIN"@"$ADMIN_PASSWORD"
}
ad_join () {
# устанавливаем пакет
apt install astra-ad-sssd-client -y
# входим в домен
check_variables
admin_variables
astra-ad-sssd-client -d "$(hostname -d)" -u "$ADMIN_LOGIN" -p "$ADMIN_PASSWORD" -y
admin_rules
}
ald_init () {
# устанавливаем пакеты
apt install fly-admin-ald-server ald-server-common smolensk-security-ald -y
# функции
check_variables
echo "Вводите данные клиента."
another_variables
# иницилизируем ald
ald-init init
}
ald_join () {
# устанавливаем пакеты
apt install ald-client-common ald-admin -y
# функции
check_variables
echo "Вводите данные домена."
another_variables
# входим в домен
ald-client join
admin_rules
}
dmcli_install () {
# директория dmcli
rm -rf dmcli/; mkdir dmcli/
# наличие архива
while ! ls *.tar.gz > /dev/null 2>&1; do
read -p "Переместите архив клиента Device Monitor."
done
# распаковка архива
tar -xvf *.tar.gz -C dmcli/
# распаковка пакета
PACKAGE=$(echo dmcli/*.deb)
dpkg-deb -x "$PACKAGE" dmcli/dpkg/
dpkg-deb -e "$PACKAGE" dmcli/dpkg/DEBIAN
# замена файлов (вписывает текущее ядро)
mv dmcli/dpkg/opt/iw/dmagent/lib/modules/*-$(uname -r | grep -P -o 'generic|hardened') \
dmcli/dpkg/opt/iw/dmagent/lib/modules/$(uname -r)
# сборка пакета
rm "$PACKAGE" && dpkg -b dmcli/dpkg "$PACKAGE"
# удаление старых ядер
sudo apt-get remove `dpkg --list 'linux-image*' |grep ^ii | awk '{print $2}'\ | grep -v \`uname -r\``
# установка девайс монитор клиента
read -p 'Введите адрес и порт IWDM: ' -i 192.168.1.20:15101 -e IWDM
dmcli/install.sh $IWDM
}
rutk_server () {
# установка библиотек для сертификатов
apt install libccid pcscd libpcsclite1 pcsc-tools opensc krb5-pkinit libpam-krb5 libengine-pkcs11-openssl1.1 -y
wget https://es.ukrtb.ru/nextcloud/s/HX6fcj5mpBASTeG/download/librtpkcs11ecp_2.3.3.0-1_amd64.deb -O /tmp/librtpkcs11ecp.deb
dpkg -i /tmp/librtpkcs11ecp.deb
# создание сертификатов
mkdir /etc/ssl/CA ; cd "$_"
openssl genrsa -out cakey.pem 2048
openssl req -key cakey.pem -new -x509 -days 3650 -out cacert.pem -subj "/C=RU/ST=RB/L=Ufa/O=UKRTB/OU=IB/CN=astra/emailAddress=astra@demo.lab"
openssl genrsa -out kdckey.pem 2048
openssl req -new -out kdc.req -key kdckey.pem -subj "/C=RU/ST=RB/L=Ufa/O=UKRTB/OU=IB/CN=astra/emailAddress=astra@demo.lab"
wget https://es.ukrtb.ru/git/ukrtb/learn/raw/branch/master/pkinit_extensions
sed -i "s/КЛИЕНТ/$(hostname -s)/" pkinit_extensions
sed -i "s/РЕАЛМ/$(hostname -d)/" pkinit_extensions
openssl x509 -req -in kdc.req -CAkey cakey.pem -CA cacert.pem -out kdc.pem -extfile pkinit_extensions -extensions kdc_cert -CAcreateserial -days 365
cp kdc.pem kdckey.pem cacert.pem /var/lib/krb5kdc/
# конфигурация керберос
sed -i '/kdcdefaults/a \
pkinit_identity = FILE:/var/lib/krb5kdc/kdc.pem,/var/lib/krb5kdc/kdckey.pem \
pkinit_anchors = FILE:/var/lib/krb5kdc/cacert.pem '\
/etc/ald/config-templates/kdc.conf
ald-init commit-config
# перезапуск керберос
systemctl restart krb5-admin-server
systemctl restart krb5-kdc
# проверка наличия рутокена
while ! pkcs11-tool --module /usr/lib/librtpkcs11ecp.so -T > /dev/null 2>&1; do
read -p "Вставьте Рутокен."
done
# форматирование и инициализация токена
pkcs15-init --erase-card -p rutoken_ecp
pkcs15-init --create-pkcs15 --so-pin "87654321" --so-puk ""
pkcs15-init --store-pin --label "User PIN" --auth-id 02 --pin "12345678" --puk "" --so-pin "87654321" --label "Rutoken" --finalize
# генерация закрытых ключей на рутокене
pkcs11-tool --slot 0 --login --pin 12345678 --keypairgen --key-type rsa:2048 --id 42 --label “ukrtb” --module /usr/lib/librtpkcs11ecp.so
# генерация сертификатов
openssl << EOT
engine dynamic -pre SO_PATH:/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so -pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD -pre MODULE_PATH:/usr/lib/librtpkcs11ecp.so
req -engine pkcs11 -new -key 0:42 -keyform engine -out client.req -subj "/C=RU/ST=RB/L=Ufa/O=UKRTB/OU=IB/CN=client/emailAddress=client@demo.lab"
x509 -CAkey cakey.pem -CA cacert.pem -req -in client.req -extensions client_cert -extfile pkinit_extensions -out client.pem -days 365
x509 -in client.pem -out client.cer -inform PEM -outform DER
q
EOT
# перенос сертификатов на Рутокен
pkcs15-init --store-certificate client.cer --auth-id 02 --id 42 --format der
# pkcs15-init --store-certificate cacert.pem --auth-id 02 --id 11 --format pem
}
rutk_client () {
# установка библиотек для сертификатов
apt install libccid pcscd libpcsclite1 pcsc-tools opensc krb5-pkinit libpam-krb5 libengine-pkcs11-openssl1.1 -y
wget https://es.ukrtb.ru/nextcloud/s/HX6fcj5mpBASTeG/download/librtpkcs11ecp_2.3.3.0-1_amd64.deb -O /tmp/librtpkcs11ecp.deb
dpkg -i /tmp/librtpkcs11ecp.deb
# создане директории для корневого сертификата
mkdir /etc/krb5/
# конфигурация керберос
sed -i '/default_realm/a \
pkinit_anchors = FILE:/etc/krb5/cacert.pem \
pkinit_identities = PKCS11:/usr/lib/librtpkcs11ecp.so ' \
/etc/krb5.conf
}
# определение необходимостей
echo "Сеть [0]"
echo "Репозитории [1]"
echo "Сервер SSH [2]"
echo "Беспарольный вход по SSH [3]"
echo "Вход в Active Directory [4]"
echo "Иницилизация Astra Linux Directory [5]"
echo "Вход в Astra Linux Directory [6]"
echo "Device Monitor клиент [7]"
echo "RUTK Сервер [8]"
echo "RUTK Клиент [9]"
read -p 'Выберите интересующие вас функции: [0124] ' WHICH_FUNC
if grep -q "0" <<< "$WHICH_FUNC"; then
network_variables
fi
if grep -q "1" <<< "$WHICH_FUNC"; then
repos_update
fi
if grep -q "2" <<< "$WHICH_FUNC"; then
ssh_server
fi
if grep -q "3" <<< "$WHICH_FUNC"; then
ssh_client
fi
if grep -q "4" <<< "$WHICH_FUNC"; then
ad_join
fi
if grep -q "5" <<< "$WHICH_FUNC"; then
ald_init
fi
if grep -q "6" <<< "$WHICH_FUNC"; then
ald_join
fi
if grep -q "7" <<< "$WHICH_FUNC"; then
dmcli_install
fi
if grep -q "8" <<< "$WHICH_FUNC"; then
rutk_server
fi
if grep -q "9" <<< "$WHICH_FUNC"; then
rutk_client
fi

2
shell/easy-tls/README.md Normal file
View File

@ -0,0 +1,2 @@
# easy-tls

View File

@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -e
if ! whiptail -v >>/dev/null 2>&1; then
if [ "$EUID" -ne 0 ]; then
echo "Запустите скрипт от имени суперпользователя."
exit 0
fi
apt-get -qq update
apt-get -y install whiptail >>/dev/null 2>&1
fi
function error_msg () {
whiptail --backtitle "EASY-TLS" --title "ОШИБКА" --msgbox "$1" 8 50
}
if [ "$EUID" -ne 0 ]; then
error_msg "Запустите скрипт от имени суперпользователя."
exit 0
fi
set +e
function certificate_services {
set -e
if [ -e "certs/$1.cert.pem" ]; then
return 0
fi
SERVICE_DNS_NAME=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте адрес сертификата $1:" 9 50 "$1.$CA_DNS_NAME" 3>&1 1>&2 2>&3)
openssl req -new \
-newkey rsa:2048 -nodes \
-keyout "certs/$1.key.pem" -out "certs/$1.csr" \
-subj "/C=$COUNTRY/ST=$STATE/L=$CITY/O=$COMPANY/OU=$DEPARTMENT/CN=$SERVICE_DNS_NAME" 1>/dev/null 2>>easy-tls.log
openssl x509 -req \
-sha256 -days 365 \
-CAkey "certs/root.key.pem" -CA "certs/root.cert.pem" -CAcreateserial \
-in "certs/$1.csr" -out "certs/$1.cert.pem" 1>/dev/null 2>>easy-tls.log
}
function certificate_ca {
set -e
COUNTRY=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте страну:" 9 50 "RU" 3>&1 1>&2 2>&3)
STATE=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте область:" 9 50 "MO" 3>&1 1>&2 2>&3)
CITY=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте город:" 9 50 "MOSCOW" 3>&1 1>&2 2>&3)
COMPANY=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте компанию:" 9 50 "IWTM" 3>&1 1>&2 2>&3)
DEPARTMENT=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте отдел:" 9 50 "IT" 3>&1 1>&2 2>&3)
CA_DNS_NAME=$(whiptail --backtitle "EASY-TLS" --title "CERTIFICATES" \
--inputbox "\nЗадайте адрес:" 9 50 "demo.lab" 3>&1 1>&2 2>&3)
if ! [ -e "certs" ]; then
mkdir certs
fi
if ! [ -e "certs/root.key.pem" ]; then
openssl req -x509 \
-newkey rsa:2048 -sha256 -days 365 -nodes \
-keyout "certs/root.key.pem" -out "certs/root.cert.pem" \
-subj "/C=$COUNTRY/ST=$STATE/L=$CITY/O=$COMPANY/OU=$DEPARTMENT/CN=$CA_DNS_NAME" 1>/dev/null 2>>easy-tls.log
fi
certificate_services "iwtm"
set +e
}
certificate_ca

232
shell/gitea-update/LICENSE Normal file
View File

@ -0,0 +1,232 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,2 @@
### gitea-update
```curl -s https://fruw.org/gitea-update.sh | sudo bash```

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "Use sudo!"
exit
fi
systemctl stop gitea.service
LAST_GITEA_BINARY=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest \
| grep browser_download_url | cut -d '"' -f 4 | grep $(echo $(uname)-$(dpkg --print-architecture) \
| sed 's/\(.*\)/\L\1/')$) && wget -O /usr/local/bin/gitea $LAST_GITEA_BINARY
systemctl start gitea.service

21
shell/go-git/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

9
shell/go-git/README.md Normal file
View File

@ -0,0 +1,9 @@
### go-git
Создаёт шаблон кода на GO и коммитит его на Гитхаб.
```
repo
∟ go.mod
∟ main.go
∟ README.md
∟ commit-repo.sh
```

58
shell/go-git/go-git.sh Normal file
View File

@ -0,0 +1,58 @@
#!/bin/bash
if [ ! -f username ]; then
echo Введи ник:
read username
echo Введи токен:
read token
echo "$token" > token
echo "$username" > username
else
token=$(cat token)
username=$(cat username)
fi
echo Введи имя репозитория:
read repo
title="
username="$username"
repo="$repo"
token="$token"
"
commit='
gh auth login --with-token < ../token > /dev/null
if (! gh repo view "$repo" 1> /dev/null 2> /dev/null); then
gh repo create "$repo" --public 1> /dev/null
fi
git init 1> /dev/null 2> /dev/null
git add .
git rm --cached commit-"$repo".sh 1> /dev/null
echo Введи имя коммита:
read commit
git commit -m "$commit"
git branch -M main
git push --set-upstream https://"$token"@github.com/"$username"/"$repo".git main
'
main='package main
import (
)
func main() {
}'
mod="
module github.com/"$username"/"$repo"
go 1.17
require (
)
"
mkdir "$repo"
cd "./$repo"
echo "### $repo" > README.md
echo "$main" > main.go
echo "$mod" > mod.go
echo "$title" > commit-"$repo".sh
echo "$commit" >> commit-"$repo".sh
chmod 775 commit-"$repo".sh

View File

@ -0,0 +1,235 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero 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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
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 AGPL, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,2 @@
### lutris-proton-update
```curl -s https://fruw.org/lutris-proton-update.sh | bash```

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
if [ "$EUID" -eq 0 ]
then echo "Dont use sudo!"
exit
fi
LAST_PROTON=$(curl -s https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases/latest \
| grep browser_download_url | cut -d '"' -f 4 | grep tar\.xz)
(echo $LAST_PROTON | grep LoL) && echo "Last Proton for LoL." && exit
(ls ~/.local/share/lutris/runners/wine/ | grep $(echo $LAST_PROTON | grep -o lutris.*64)) \
> /dev/null && echo "No new verisons." && exit
echo "New version available!"
cd /tmp && wget $LAST_PROTON -O proton.tar.xz
tar -xvf proton.tar.xz
mv *lutris* ~/.local/share/lutris/runners/wine/

2
shell/mpv-fmt/README.md Normal file
View File

@ -0,0 +1,2 @@
# mpv-fmt

10
shell/mpv-fmt/mpv-fmt.sh Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# kill -9 $(pgrep mpv)
read -p 'С какой серии начать? ' -i Ep01 -e START_EPISODE
for CURRENT_EPISODE in $(ls | grep mkv)
do
if grep -q "$START_EPISODE" <<< "$CURRENT_EPISODE"; then
mpv --vf=lavfi=[crop=1440:1080:240:0] $CURRENT_EPISODE \
--audio-file=$(sed 's/mkv/mka/g' <<< $CURRENT_EPISODE)
fi
done

21
shell/sicp/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5
shell/sicp/README.md Normal file
View File

@ -0,0 +1,5 @@
### sicp
Отправляет текст из файла и сохраняет ссылку в буфер обмена.
```
ПКМ -> Открыть с помощью -> sicp.sh
```

2
shell/sicp/sicp.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
cat -n "$1" | curl -F "paste=<-" sicp.me | xclip -sel clip

21
shell/vt/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Mitch Conner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

6
shell/vt/README.md Normal file
View File

@ -0,0 +1,6 @@
### vt
Сверяет хэш файла с БД и выводит результат.
```
Малварь не найдена.
Файл - тип файла.
```

25
shell/vt/vt.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
apikey=c2fe3b4dc0b284ff2bd7cd08a361e134bc01c6a19a61536a4e514185fb8c37df
md5=$(md5sum "$1" | sed -r "s/ .+$//")
resp=$(curl --request GET \
--url https://www.virustotal.com/api/v3/files/{"$md5"} \
--header "x-apikey: "$apikey"" 2>/dev/null)
mlwr=$(echo "$resp" | jq '.data .attributes .total_votes .malicious')
numb=$(ls /dev/pts)
gnome-terminal &
sleep .1
numb=$(ls /dev/pts)$(printf "\n$numb")
numb=$(echo "$numb" | sort | uniq -u)
if [[ "$mlwr" == "null" ]]; then
out=$(echo "Хэш не найден!")
elif [[ "$mlwr" == "0" ]]; then
out=$(echo "Малварь не найдена.")
else
body=$(echo "$resp" | jq '.data .attributes .last_analysis_results | .[] | "\(.engine_name) \(.result)"' \
| sed 's/ /: /' | sed 's/"$//' | sed 's/"//' | sed -r '/null$/d')
out=$(printf "%s\n\nАнтивирусы, нашедшие малварь ↑\nВсего найдено малварей: %s\n" \
"$body" "$mlwr")
fi
ih=$(echo "$1 - " | sed -r 's/.+\///')
ib=$(file "$1" | sed -r 's/.+: //' | sed -r 's/,.+$//')
printf "$out\n$ih$ib" > /dev/pts/"$numb"