diff options
| author | makefu <github@syntax-fehler.de> | 2011-09-12 14:32:18 +0200 |
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2011-09-12 14:32:18 +0200 |
| commit | 9f70f9b5b462aa3e150b9708f695edfaf716edd4 (patch) | |
| tree | 5cbebe6cbc0ada2c988d7f14d0bbbc52a68b37c1 | |
| parent | 568fbd7fa5541182bbbc33560863ec9c3ff01d48 (diff) | |
| parent | a07326f6c57a7e8f49b9bef96ded427275a16e2e (diff) | |
Merge branch 'master' into punani_files
134 files changed, 2943 insertions, 260 deletions
@@ -1,10 +1,24 @@ + +# Linux kernel module +modules.order +Module.symvers +.built-in.o.cmd +*.ko.cmd +*.o.cmd +.tmp_versions/ +*.ko +*.mod.c + a.out *.pyc *.o *.a .svn/ +/god/Reaktor/tmp/ /bin/ /node/src /node/out /ovh/soapi/src /ovh/soapi/SOAPpy +/Reaktor/IRC/irclib.py +/Reaktor/public_commands/* diff --git a/.gitmodules b/.gitmodules index cbc61522..3677b710 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "submodules/github/tautologistics/node-htmlparser"] path = submodules/github/tautologistics/node-htmlparser url = https://github.com/tautologistics/node-htmlparser -[submodule "krebsbeam/c-beam"] - path = krebsbeam/c-beam - url = git://dev.c-base.org/c-beam/c-beam.git [submodule "submodules/github/makefu/dpfhack_display"] path = submodules/github/makefu/dpfhack_display url = https://github.com/makefu/dpfhack_pearl diff --git a/DNA/README.md b/DNA/README.md new file mode 100644 index 00000000..9de84746 --- /dev/null +++ b/DNA/README.md @@ -0,0 +1,14 @@ +# Distribution-Neutral Augmentation + +Warning: This component will compromise your system in hard and obscure ways. + +## //DNA/linux + +This module will mutilate your running kernel's sys_call_table so // +resolves to the krebs repository. + +## Quickstart + + make -C //DNA/linux + sudo insmod //DNA/linux/krebs.ko + diff --git a/DNA/linux/LICENSE b/DNA/linux/LICENSE new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/DNA/linux/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 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 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>. diff --git a/DNA/linux/Makefile b/DNA/linux/Makefile new file mode 100644 index 00000000..2ed4c9fb --- /dev/null +++ b/DNA/linux/Makefile @@ -0,0 +1,7 @@ +obj-m += krebs.o + +all: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean diff --git a/DNA/linux/README.md b/DNA/linux/README.md new file mode 100644 index 00000000..0b6885e2 --- /dev/null +++ b/DNA/linux/README.md @@ -0,0 +1,41 @@ +# Putting rickrolling in kernel space + +Kernelroll is a linux kernel module for advanced rickrolling. + +It works by patching the open() system call to open a specified music file +instead of other music files. Currently, it only checks if the file extension +"mp3" is present and calls the original open() with the supplied path +instead. + +WARNING: There is probably a performance penalty and your kernel might crash +at a very inappropriate time and cause data loss! You are responsible for +the code you load into your kernel! + +But most probably, it will be alright! ;) + +# Installation + +You need the address of sys_call_table in your kernel. Use + + $ grep sys_call_table /boot/System.map-3.0.0-1-amd64 + ffffffff81400300 R sys_call_table + +on the respective System.map of your kernel to find out the address + +Now fire up kernelroll.c and add yours: + + void **sys_call_table = (void **)0xffffffff81400300; + +This will probably be simplified in the future, but as sys_call_table isn't +exported anymore in 2.6 kernels, we have to use some tricks. + +Compile with: + + $ make + +Load with: + + $ insmod kernelroll.ko rollfile=/path/to/rickroll.mp3 + +Fire up a music player of your choice, play a song and consider yourself +kernelrolled. ;) diff --git a/DNA/linux/TODO b/DNA/linux/TODO new file mode 100644 index 00000000..fd0d927f --- /dev/null +++ b/DNA/linux/TODO @@ -0,0 +1,16 @@ +#! /bin/sh + +## find all syscalls that have to be patched +h="/lib/modules/$(uname -r)/build/include/linux/syscalls.h" +sed -n 's/.*sys_\([^)]\+\)(.*/\1/p' $h | while read f; do + x="`( man 3p $f || man 3 $f || man $f ) 2>/dev/null`" + echo "` + echo "$x" | grep -q ENAMETOOLONG && echo 1 || echo 0`` + echo "$x" | grep -q EACCES && echo 1 || echo 0`` + ` $f" +done + +# disable interrupts before modifying the sys_call_table +# see: sti tli +# disable other CPUs: suspend-code [the suspend code does all this, too] +# TLB flushen: irgendwo bei der architektur diff --git a/DNA/linux/krebs.c b/DNA/linux/krebs.c new file mode 100644 index 00000000..df319c63 --- /dev/null +++ b/DNA/linux/krebs.c @@ -0,0 +1,192 @@ +/* + * kernelroll - linux kernel module for advanced rickrolling + * Copyright (C) 2011 Franz Pletz <fpletz@fnordicwalking.de> + * + * 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/>. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <asm/unistd.h> +#include <linux/syscalls.h> +#include <asm/amd_nb.h> +#include <linux/highuid.h> + +#define GPF_DISABLE write_cr0(read_cr0() & (~ 0x10000)) +#define GPF_ENABLE write_cr0(read_cr0() | 0x10000) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Franz Pletz"); +MODULE_DESCRIPTION("for teh lulz!"); + +char *rollfile = NULL; +unsigned long **sys_call_table = NULL; +module_param(rollfile, charp, 0000); +MODULE_PARM_DESC(rollfile, "music trolling file"); + +module_param(sys_call_table, ulong, 0000); +MODULE_PARM_DESC(sys_call_table, "address of the system call table"); + +/* currently not working try for finding the sys_call_table ourselves */ +unsigned long **find_sys_call_table(void) +{ + unsigned long **sctable; + unsigned long ptr; + + unsigned long off = 0xc01010e8; // TODO module_param or magic + unsigned long max = 100000000; // TODO module_param or magic + + sctable = NULL; + for (ptr = off; ptr < off + max; ptr += sizeof(void *)) + { + unsigned long *p; + p = (unsigned long *)ptr; + if(p[__NR_close] == (unsigned long) sys_close) + { + sctable = (unsigned long **)p; + return &sctable[0]; + } + } + return NULL; +} + +static char *patch(const char *path) { + const char *prefix = "/krebs"; // TODO module_param or magic + size_t prefix_len = strlen(prefix); + size_t path_len = strlen(path + 1); + char *newpath = kmalloc(prefix_len + path_len + 1, GFP_KERNEL); + memcpy(newpath, prefix, prefix_len); + memcpy(newpath + prefix_len, path + 1, path_len); + newpath[prefix_len + path_len] = '\0'; + return newpath; +} + +static void unpatch(char *path) { + kfree(path); +} + +asmlinkage long (*o_chdir)(const char __user *filename); +asmlinkage long my_chdir(const char __user *path) +{ + int r; + + if (path[0] == '/' && path[1] == '/') { + rollfile = patch(path); + + int len = strlen(rollfile) + 1; + + void *buf = kmalloc(len, GFP_KERNEL); + memcpy(buf, path, len); + printk(KERN_INFO "chdir: patching %s with %s\n", path, rollfile); + memcpy((void *)path, rollfile, len); + r = o_chdir(path); + memcpy((void *)path, buf, len); + kfree(buf); + + unpatch(rollfile); + rollfile = NULL; + } else { + r = o_chdir(path); + } + + return r; +} + +asmlinkage int (*o_open)(const char *path, int oflag, mode_t mode); +asmlinkage int my_open(const char *path, int oflag, mode_t mode) +{ + int r; + + if (path[0] == '/' && path[1] == '/') { + rollfile = patch(path); + + int len = strlen(rollfile) + 1; + + void *buf = kmalloc(len, GFP_KERNEL); + memcpy(buf, path, len); + printk(KERN_INFO "open: patching %s with %s\n", path, rollfile); + memcpy((void *)path, rollfile, len); + r = o_open(path, oflag, mode); + memcpy((void *)path, buf, len); + kfree(buf); + + unpatch(rollfile); + rollfile = NULL; + } else { + r = o_open(path, oflag, mode); + } + + return r; +} + + +void set_addr_rw(unsigned long addr) { + + unsigned int level; + pte_t *pte = lookup_address(addr, &level); + + if(pte->pte &~ _PAGE_RW) pte->pte |= _PAGE_RW; + +} + +void set_addr_ro(unsigned long addr) { + + unsigned int level; + pte_t *pte = lookup_address(addr, &level); + + pte->pte = pte->pte &~_PAGE_RW; + +} + +static int __init init_rickroll(void) +{ + sys_call_table = find_sys_call_table(); // TODO allow module_param + if(sys_call_table == NULL) + { + printk(KERN_ERR "Cannot find the system call address\n"); + return -1; /* do not load */ + } else { + printk(KERN_INFO "System call table found @ %lx\n", (unsigned long)sys_call_table); + } + + set_addr_rw((unsigned long)sys_call_table); + GPF_DISABLE; + + o_open = (void *)sys_call_table[__NR_open]; + sys_call_table[__NR_open] = (void *) my_open; + + o_chdir = (void *)sys_call_table[__NR_chdir]; + sys_call_table[__NR_chdir] = (void *) my_chdir; + + set_addr_ro((unsigned long)sys_call_table); + GPF_ENABLE; + + return 0; +} + +static void __exit exit_rickroll(void) +{ + set_addr_rw((unsigned long)sys_call_table); + GPF_DISABLE; + + sys_call_table[__NR_chdir] = (void *) o_chdir; + sys_call_table[__NR_open] = (void *) o_open; + + set_addr_ro((unsigned long)sys_call_table); + GPF_ENABLE; +} + +module_init(init_rickroll); +module_exit(exit_rickroll); diff --git a/Kübelwagen/Makefile b/Kübelwagen/Makefile index e180d047..9be84e13 100644 --- a/Kübelwagen/Makefile +++ b/Kübelwagen/Makefile @@ -1,7 +1,7 @@ CC := gcc -std=c99 CFLAGS := -D_XOPEN_SOURCE=500 -LIBS := $(shell pkg-config --cflags --libs jack) +LIBS := $(shell pkg-config --cflags --libs jack) -lm .PHONY: all clean diff --git a/Kübelwagen/alarm b/Kübelwagen/alarm new file mode 100755 index 00000000..a117c433 --- /dev/null +++ b/Kübelwagen/alarm @@ -0,0 +1,27 @@ +#! /bin/sh +# +# //Kübelwagen/alarm SLEEPARGS... +# +# where SLEEPARGS are passed to sleep(3) +# +set -euf +cd $(dirname $(readlink -f $0)) +exec >&2 + +make + +jackd -d alsa & +trap "kill -0 $! && kill $!" EXIT INT + +for i in `seq 8000 1000 10000`; do + echo $i 100 +done | ./a.out 1 +echo 'if you heard that sound, then goto sleep..^_^' + +echo sleep "$@" +sleep "$@" + +echo 'wake up!' +while :; do + echo $(echo "($(od -tu -An -N 2 /dev/urandom)%1000)+500"|bc) $(echo "($(od -tu -An -N 2 /dev/urandom)%500)+100"|bc) +done | ./a.out 1 diff --git a/Kübelwagen/alarm.sh b/Kübelwagen/alarm.sh deleted file mode 100644 index 601a18db..00000000 --- a/Kübelwagen/alarm.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -echo 'You are made of stupid!' >&2 -exit 23 - -sleep 5h 19m && while :; do echo $(echo "($(od -tu -An -N 2 /dev/urandom)%1000)+500"|bc) $(echo "($(od -tu -An -N 2 /dev/urandom)%500)+100"|bc) ; done | ./a.out 1 diff --git a/Reaktor/IRC/README.md b/Reaktor/IRC/README.md new file mode 100644 index 00000000..63a0ebd2 --- /dev/null +++ b/Reaktor/IRC/README.md @@ -0,0 +1,49 @@ +# //Reaktor/IRC + +This component implements a remote shell daemon that exposes the +executable files (which may be symlinks) below +`//Reaktor/public_commands/` through IRC. + +## Security + +Access to the IRC server implies full access to all the exposed executable +files. The daemon is executing the commands without dropping privileges. + +## Quickstart + + #? /bin/sh + set -euf + + export nick="$LOGNAME|$HOSTNAME" + export host=irc.freenode.org + export target='#tincspasm' + + exec Reaktor/IRC/index + +## Environment variables + +The following environment variables are processed by `//Reaktor/IRC`: + +### nick + +Use a specific nickname. + +Optional if the node running `//Reaktor/IRC` is part of Retiolum, in +which case it defaults to `Name` in `/etc/tinc/retiolum/tinc.conf`. + +### host and port + +Connect to a specific IRC server. + +Optional if the node running `//Reaktor/IRC` is part of Retiolum, in +which case it defaults to `supernode` and `6667` (well, it always +defaults to these two, but they only make science in Retiolum^_^). + +### target + +Join a specific channel. + +As always, this does the right thing for properly configured hosts: it +uses the default `#retiolum`, which is the only really relevant +channel.^_^ + diff --git a/Reaktor/IRC/bot.py b/Reaktor/IRC/bot.py new file mode 100755 index 00000000..af974f4e --- /dev/null +++ b/Reaktor/IRC/bot.py @@ -0,0 +1,34 @@ +#! /usr/bin/env python2 + +from irclib import IRC, ServerConnectionError, is_channel +from sys import exit +from os import environ as env + +host = str(env.get('host', 'irc.freenode.org')) +port = int(env.get('port', 6667)) +nick = str(env.get('nick', 'crabspasm')) +channel = str(env.get('channel', '#tincspasm')) +print '====> irc://%s@%s:%s/%s' % (nick, host, port, channel) + +irc = IRC() +try: + client = irc.server().connect(host, port, nick) +except ServerConnectionError, error: + print error + exit + +def on_connect(connection, event): + connection.join(channel) + print 'Es passiert...' + +def on_join(connection, event): + connection.privmsg(channel, 'lol') + +def on_disconnect(connection, event): + exit + +client.add_global_handler('welcome', on_connect) +client.add_global_handler('join', on_join) +client.add_global_handler('disconnect', on_disconnect) + +irc.process_forever() diff --git a/Reaktor/IRC/bot2.py b/Reaktor/IRC/bot2.py new file mode 100755 index 00000000..326dd8f5 --- /dev/null +++ b/Reaktor/IRC/bot2.py @@ -0,0 +1,130 @@ +#! /usr/bin/env python +# +# //Reaktor/IRC/bot2.py +# + +from __future__ import print_function +from irclib import SimpleIRCClient, ServerConnectionError, is_channel +from sys import exit +from os import environ as env +import re + +class IRCBot(SimpleIRCClient): + def __init__(self, target): + SimpleIRCClient.__init__(self) + self.target = target + + def on_pubmsg(self, connection, event): + + def PRIVMSG(target, text): + self.connection.privmsg(target, text) + + def ME(target, text): + PRIVMSG(target, 'ACTION ' + text + '') + + def is_executable(x): + import os + return os.path.exists(x) and os.access(x, os.X_OK) + + _nickname = connection.get_nickname() + _source = event.source() + _from = _source.split('!', 1)[0] + _target = event.target() + + try: + _, _handle, _command, _argument, _ = re.split( + '^(\w+|\*):\s*(\w+)(?:\s+(.*))?$', event.arguments()[0]) + except ValueError, error: + if re.search(_nickname, event.arguments()[0]): + PRIVMSG(self.target, 'I\'m so famous') + return # ignore + + if _handle == _nickname or _handle == '*': + + from os.path import realpath, dirname, join + from subprocess import Popen as popen, PIPE + + Reaktor_dir = dirname(realpath(dirname(__file__))) + public_commands = join(Reaktor_dir, 'public_commands') + command = join(public_commands, _command) + + if is_executable(command): + + env = {} + if _argument != None: + env['argument'] = _argument + + try: + p = popen([command], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env) + except OSError, error: + ME(self.target, 'is made of stupid') + print('OSError@%s: %s' % (command, error)) + return + + stdout, stderr = [ x[:len(x)-1] for x in + [ x.split('\n') for x in p.communicate()]] + code = p.returncode + pid = p.pid + + print('command: %s -> %s' % (command, code)) + [print('%s stdout: %s' % (pid, x)) for x in stdout] + [print('%s stderr: %s' % (pid, x)) for x in stderr] + + if code == 0: + [PRIVMSG(self.target, x) for x in stdout] + [PRIVMSG(_source, x) for x in stderr] + else: + ME(self.target, 'mimimi') + + else: + if _handle != '*': + PRIVMSG(self.target, _from + ': you are made of stupid') + + def on_welcome(self, connection, event): + print('I\'m welcome! :D joining to %s now...' % (self.target)) + if is_channel(self.target): + connection.join(self.target) + else: + self.connection.privmsg(self.target, 'lol') + self.connection.quit('Pong timeout: 423 seconds') + + def on_join(self, connection, event): + print('Es passiert in %s' % (self.target)) + + def on_disconnect(self, connection, event): + # TODO reconnect + exit(0) + +# retrieve the value of a [singleton] variable from a tinc.conf(5)-like file +def getconf1(x, path): + from re import findall + pattern = '(?:^|\n)\s*' + x + '\s*=\s*(.*\w)\s*(?:\n|$)' + y = findall(pattern, open(path, 'r').read()) + if len(y) < 1: + raise AttributeError("len(getconf1('%s', '%s') < 1)" % (x, path)) + if len(y) > 1: + y = ' '.join(y) + raise AttributeError("len(getconf1('%s', '%s') > 1)\n ====> %s" + % (x, path, y)) + return y[0] + +def main(): + name = getconf1('Name', '/etc/tinc/retiolum/tinc.conf') + nick = str(env.get('nick', name)) + host = str(env.get('host', 'supernode')) + port = int(env.get('port', 6667)) + target = str(env.get('target', '#retiolum')) + print('====> irc://%s@%s:%s/%s' % (nick, host, port, target)) + + client = IRCBot(target) + try: + from getpass import getuser + client.connect(host, port, nick, username=getuser(), + ircname='//Reaktor running at %s.retiolum' % (name)) + except ServerConnectionError, error: + print(error) + exit(1) + client.start() + +if __name__ == "__main__": + main() diff --git a/Reaktor/IRC/content b/Reaktor/IRC/content new file mode 100644 index 00000000..e0292376 --- /dev/null +++ b/Reaktor/IRC/content @@ -0,0 +1 @@ +python-irclib-0.4.6/ircbot.py diff --git a/Reaktor/IRC/index b/Reaktor/IRC/index new file mode 100755 index 00000000..68b6cf33 --- /dev/null +++ b/Reaktor/IRC/index @@ -0,0 +1,9 @@ +#! /bin/sh +set -xeuf + +# cd //Reaktor +cd $(dirname $(readlink -f $0))/.. + +IRC/install + +exec python IRC/bot2.py "$@" diff --git a/Reaktor/IRC/install b/Reaktor/IRC/install new file mode 100755 index 00000000..d5f7a8c1 --- /dev/null +++ b/Reaktor/IRC/install @@ -0,0 +1,28 @@ +#! /bin/sh +set -xeuf + +# cd //Reaktor/IRC +cd $(dirname $(readlink -f $0)) + +# install irclib.py +{ + PV=0.4.6 + PN=python-irclib + P=$PN-$PV + tarball=$P.tar.gz + URL=http://downloads.sourceforge.net/$PN/$tarball + SHA1SUM=c6271e44293ed51c21af0f44ce106667d3006e6f + + file=irclib.py + + if ! echo "$SHA1SUM $file" | sha1sum -c; then + temp=`mktemp` + trap "rm -f $temp" EXIT INT + + echo $P/$file > $temp + curl -LfsS $URL | tar --strip-components=1 -zxT $temp + fi + echo "$SHA1SUM $file" | sha1sum -c +} + + diff --git a/Reaktor/README.md b/Reaktor/README.md new file mode 100644 index 00000000..05af8ef5 --- /dev/null +++ b/Reaktor/README.md @@ -0,0 +1,29 @@ +# //Reaktor + +## Quickstart + + ## 1. prepare Reaktor + //Reaktor/install + + ## 2. create a dedicated user + useradd Reaktor + + ## 3. marry Reaktor with /sbin/init + + ## 3a. /etc/inittab-like foo + echo 10:2345:respawn:/bin/su Reaktor -c /krebs/Reaktor/index >>/etc/inittab + # or 10:2345:respawn:/usr/bin/sudo -u Reaktor /krebs/Reaktor/index + # if Reaktor's shell is /bin/false or similar + # [check with e.g getent passwd Reaktor] + telinit q + + ## 3b. upstart-like foo + + cat > /etc/init/Reaktor.conf <<EOF + description "Krebs Reaktor" + author "The Ministerium" + stop on runlevel [016] + respawn + exec /usr/bin/sudo -u Reaktor /krebs/Reaktor/index + EOF + start Reaktor diff --git a/Reaktor/commands/caps b/Reaktor/commands/caps new file mode 100755 index 00000000..bc3d7ba2 --- /dev/null +++ b/Reaktor/commands/caps @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd public_commands +echo `ls` diff --git a/Reaktor/commands/hello b/Reaktor/commands/hello new file mode 100755 index 00000000..df3b6bb9 --- /dev/null +++ b/Reaktor/commands/hello @@ -0,0 +1,2 @@ +#! /bin/sh +echo "Hello${argument+, $argument}!" diff --git a/Reaktor/commands/reload b/Reaktor/commands/reload new file mode 100755 index 00000000..2b78b178 --- /dev/null +++ b/Reaktor/commands/reload @@ -0,0 +1,2 @@ +#! /bin/sh +exec pkill -U Reaktor diff --git a/Reaktor/commands/retard b/Reaktor/commands/retard new file mode 100755 index 00000000..c59b4d1c --- /dev/null +++ b/Reaktor/commands/retard @@ -0,0 +1 @@ +#? //retard diff --git a/Reaktor/commands/rev b/Reaktor/commands/rev new file mode 100755 index 00000000..a8681ab9 --- /dev/null +++ b/Reaktor/commands/rev @@ -0,0 +1,2 @@ +#! /bin/sh +git log -1 --format="%h by %an, %ar" diff --git a/Reaktor/commands/uptime b/Reaktor/commands/uptime new file mode 100755 index 00000000..7ff64168 --- /dev/null +++ b/Reaktor/commands/uptime @@ -0,0 +1,8 @@ +#! /bin/sh +# +# //Reactor/commands/uptime - IRC-optimized uptime output +# +uptime | sed ' + s/^\(.*\) up \(.*\) days\?, *\(.*\), *\(.*\) users\?, *load average: \(.*\)$/\1; \2d \3; \4u; \5/;t + s/^\(.*\) up *\(.*\), *\(.*\) users\?, *load average: \(.*\)$/\1; 0d \2; \3u; \4/;t +' diff --git a/Reaktor/index b/Reaktor/index new file mode 100755 index 00000000..ac647ca3 --- /dev/null +++ b/Reaktor/index @@ -0,0 +1,7 @@ +#! /bin/sh +set -euf + +# cd //Reaktor +cd $(dirname $(readlink -f $0)) + +exec IRC/index diff --git a/Reaktor/install b/Reaktor/install new file mode 100755 index 00000000..761bc437 --- /dev/null +++ b/Reaktor/install @@ -0,0 +1,6 @@ +#! /bin/sh +set -euf + +cd $(dirname $(readlink -f $0)) + +exec IRC/install diff --git a/Reaktor/public_commands/caps b/Reaktor/public_commands/caps new file mode 120000 index 00000000..43c0a342 --- /dev/null +++ b/Reaktor/public_commands/caps @@ -0,0 +1 @@ +../commands/caps
\ No newline at end of file diff --git a/Reaktor/public_commands/hello b/Reaktor/public_commands/hello new file mode 120000 index 00000000..4509249b --- /dev/null +++ b/Reaktor/public_commands/hello @@ -0,0 +1 @@ +../commands/hello
\ No newline at end of file diff --git a/Reaktor/public_commands/reload b/Reaktor/public_commands/reload new file mode 120000 index 00000000..9a337850 --- /dev/null +++ b/Reaktor/public_commands/reload @@ -0,0 +1 @@ +../commands/reload
\ No newline at end of file diff --git a/Reaktor/public_commands/retard b/Reaktor/public_commands/retard new file mode 120000 index 00000000..29ae4b01 --- /dev/null +++ b/Reaktor/public_commands/retard @@ -0,0 +1 @@ +../commands/retard
\ No newline at end of file diff --git a/Reaktor/public_commands/rev b/Reaktor/public_commands/rev new file mode 120000 index 00000000..f5433412 --- /dev/null +++ b/Reaktor/public_commands/rev @@ -0,0 +1 @@ +../commands/rev
\ No newline at end of file diff --git a/Reaktor/public_commands/uptime b/Reaktor/public_commands/uptime new file mode 120000 index 00000000..ffe5fbd7 --- /dev/null +++ b/Reaktor/public_commands/uptime @@ -0,0 +1 @@ +../commands/uptime
\ No newline at end of file diff --git a/Werkzeug/Makefile b/Werkzeug/Makefile new file mode 100644 index 00000000..57b983df --- /dev/null +++ b/Werkzeug/Makefile @@ -0,0 +1,2 @@ +install: + ln -snf $$PWD/bin/git-clone-into ../bin/ diff --git a/Refactory/bin/git-clone-into b/Werkzeug/bin/git-clone-into index 67e820e6..67e820e6 100755 --- a/Refactory/bin/git-clone-into +++ b/Werkzeug/bin/git-clone-into diff --git a/Refactory/bin/git-eternal-move b/Werkzeug/bin/git-eternal-move index 50361e7b..50361e7b 100755 --- a/Refactory/bin/git-eternal-move +++ b/Werkzeug/bin/git-eternal-move diff --git a/census/arping.py b/census/arping.py index 3245f1ee..3cffa6be 100755 --- a/census/arping.py +++ b/census/arping.py @@ -15,7 +15,7 @@ try: """Arping function takes IP Address or Network, returns nested mac/ip list""" try: conf.verb=0 - ans,unans=arping(iprange,iface=iface,timeout=1,retry=3) + ans,unans=arping(iprange,iface=iface,timeout=0.4,retry=1) collection = [] for snd, rcv in ans: diff --git a/census/arping_users.py b/census/arping_users.py index f0df4924..f4f356bf 100755 --- a/census/arping_users.py +++ b/census/arping_users.py @@ -13,6 +13,7 @@ my_names = {} ret = {} quiet=False +names = {} if len(sys.argv) > 1 and sys.argv[1] == 'q': quiet=True def get_own_addr(): @@ -22,7 +23,6 @@ def get_own_addr(): r'\1 \2',data).split() def load_names(mac_file): - names = {} f = open(mac_file) for l in f: mac,name = l.split(' ',1) @@ -39,33 +39,35 @@ def init(): my_addr = get_own_addr() my_names = load_names(MAC_NAMES) +def arping_helper(dic): + log.debug("trying arpingy(%s)" %dic) + return arpingy(**dic) + def main(): init() print_config() - exit(0) - def arping_helper(dic): - return arpingy(**dic) - -for first in range(1,4): - for second in range(256): - data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) + for first in range(1,4): + for second in range(256): + data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) try: - p = Pool(20) + log.info("creating new Pool") + p = Pool(30) ret = filter(lambda x:x , p.map(arping_helper, data)) - myip,mymac = get_own_addr() - ret.append([mymac,myip]) + log.info("killing it") p.terminate() + except Exception as e: print 'you fail '+str(e) - - + myip,mymac = get_own_addr() + ret.append([mymac,myip]) for p in ret: if not quiet: print p[0] + " => " + p[1] if p[1] in names: print names[p[1]]+ " is online" + if __name__ == "__main__": log.debug("starting arping_users") main() diff --git a/cholerab/AGENDA.cccamp11 b/cholerab/AGENDA index 7bdf02a3..d2c1ae1f 100644 --- a/cholerab/AGENDA.cccamp11 +++ b/cholerab/AGENDA @@ -16,8 +16,6 @@ - make-based installer for voice-symlinks - ttycnser - - server component - - JSON-RPC [spec and implementation] - client component - ttycnser (makefu) DONE - Python Notification (makefu) @@ -99,3 +97,16 @@ - cping, cpong - recursiv make + + - exedirs + + - //-integration + - libc? + - sh? + + - //Schnabeltasse + + - wgrep + + - generated code must be created outside of the //-hierarchy, so killing + a local repository and recloning it is easier diff --git a/cholerab/IRC-RPC b/cholerab/IRC-RPC new file mode 100644 index 00000000..a5350534 --- /dev/null +++ b/cholerab/IRC-RPC @@ -0,0 +1,32 @@ +# Krebs IRC RPC + + on :<from> PRIVMSG <target> :<handle>: <command> <argument> + + if <handle> ∈ { nickname, "ALL" } + if <command> is a public command + + path = $__public_command_directory/<command> + argv = [] + envp = { from: <from>, argument: <argument> } + + <code> = execve(path, argv, envp) → <stdout>, <stderr> + + if <code> = 0 + if <target> is channel + PRIVMSG <target> :<from>: <stdout> + PRIVMSG <from> :<stderr> + else + ; TODO assert <target> = <from> + PRIVMSG <from> :<stdout> + PRIVMSG <from> :Error: <stderr> + else + + send all <.*> to the Ministerium + + if <target> is channel + PRIVMSG <target> :<from>: <command> is broken ATM + else + PRIVMSG <target> :Error: <command> is broken ATM + + else + PRIVMSG <target> :<from>: you are made of stupid diff --git a/cholerab/Reaktor/IRC-RPC b/cholerab/Reaktor/IRC-RPC new file mode 100644 index 00000000..a5350534 --- /dev/null +++ b/cholerab/Reaktor/IRC-RPC @@ -0,0 +1,32 @@ +# Krebs IRC RPC + + on :<from> PRIVMSG <target> :<handle>: <command> <argument> + + if <handle> ∈ { nickname, "ALL" } + if <command> is a public command + + path = $__public_command_directory/<command> + argv = [] + envp = { from: <from>, argument: <argument> } + + <code> = execve(path, argv, envp) → <stdout>, <stderr> + + if <code> = 0 + if <target> is channel + PRIVMSG <target> :<from>: <stdout> + PRIVMSG <from> :<stderr> + else + ; TODO assert <target> = <from> + PRIVMSG <from> :<stdout> + PRIVMSG <from> :Error: <stderr> + else + + send all <.*> to the Ministerium + + if <target> is channel + PRIVMSG <target> :<from>: <command> is broken ATM + else + PRIVMSG <target> :Error: <command> is broken ATM + + else + PRIVMSG <target> :<from>: you are made of stupid diff --git a/cholerab/Reaktor/priviliged_functions b/cholerab/Reaktor/priviliged_functions new file mode 100644 index 00000000..a673267e --- /dev/null +++ b/cholerab/Reaktor/priviliged_functions @@ -0,0 +1,24 @@ +Use Case 1: Request update on Host +================================= + +< user> bot: update +< bot> /whois user +< bot> /msg user [CHALLENGE] +< user> /msg bot [CHALLENGE-RESPONSE] +< bot> updating... +< bot> now on rev XXXXX + +Command Flow +---------------- +The bot has a locally stored list of [trusted] hosts along with their public +key, preferably from the tinc/retiolum directory. + +The bot encrypts a 1K Byte long message with the public key of the host +retrieved by the /whois command. + +This challenge is sent to the user requesting the command via private message. +The user then decrpyts the message with its own private key and sends the +decrpyted message to the bot. + +The bot then executes the requested command if the challenge is answered +correctly diff --git a/cholerab/news/Candidate b/cholerab/news/Candidate index 8abc0b00..1b52abe4 100644 --- a/cholerab/news/Candidate +++ b/cholerab/news/Candidate @@ -46,4 +46,14 @@ gewaehrleisten sollen verwendet werden. [1.1] : https://github.com/krebscode/painload/tree/master/retiolum/bin/get-tinc-dir -## 2. KNUT - Die Krebs Notification Utility Toolchain +## 2. Krebs MPD + http stream + +KM momo hat sich heute (01.09.2011) gegen die streams gewehrt und auf der filebitch einen mpd Server eingerichtet. +Der MPD streamt jetzt via http(vorbis) auf http://filebitch.shack:8000. +Eine Integration in //streams ist bereits vorgenommen. +Der MPD lauert auf filebitch.shack:6600 auf MPD Clients die ihn bedienen. +Ein Webinterface ist noch nicht geplant. + +Die Musiksammlung kann in incoming/Musik auf der Filebitch erweitert werden. + +## 3. KNUT - Die Krebs Notification Utility Toolchain diff --git a/cholerab/shirts/bestellliste b/cholerab/shirts/bestellliste index f1f423e1..a6c63b9d 100644 --- a/cholerab/shirts/bestellliste +++ b/cholerab/shirts/bestellliste @@ -1,11 +1,11 @@ # S G∃ Feedback tv 2 M jj Superdick aufgetragenes Gummifetisch Logo; Farbe: genial - 1 S j- + 1 S jj ulrich 1 M ?j gut felix 2 M jj super qualitaet, sogar nach dem waschen kein bisschen ausgebleicht 1 S jj Lassulus 2 M jj -Pfleidi 1 L -j +Pfleidi 1 L jj Tensai 1 L jj Momo 1 2 jj Der Siebdruck sieht echt gut aus, kein bisschen verschmiert. hadez 1 L jj @@ -13,11 +13,11 @@ hadez 1 L jj Phil 1 S jj Lukas 1 M ?j Jan 1 2 jj /* bezahlt an makefu */ Zitrone waere leckerer gewesen -Ronny 1 M jj /* bezahlt an pfleidi */ +Ronny 1 M jj Marc 1 L -- -Lotho 1 X -- -Sascha 1 X -- -Moritz 1 M -- +Lotho 1 X jj +Sascha 1 X -j +Moritz 1 M jj RIPE 1 X -- kh 1 L jj gute Verarbeitung, guter Gesamteindruck, passt wie angegossen miefda 1 L jj diff --git a/cholerab/thesauron b/cholerab/thesauron index 07e274f5..2c329db8 100644 --- a/cholerab/thesauron +++ b/cholerab/thesauron @@ -3,9 +3,31 @@ Cholerab n. Zusammenarbeit niemals gut, einfach und ohne Schmerzen funktioniert. - Teamwork-Plattform für Krebscode. +KD;RP abbr. (pronounciation: kah-derp) +- Short for Krebs Darknet / Retiolum Prefix. + Nahziel n. - Ziel mit höchst möglicher Priorität. Nahzielerfahrung n. - das Erlebnis der (endgültigen) Nichterreichung eines Nahziels (obwohl nur noch wenig ((quasi-) infinitesimal viel) nötig gewesen wäre). + +Retiolum n. +- The official darknet of Krebs which utilizes the Retiolum Prefix to + address individual nodes. + +Retiolum Prefix n. +- The universally accepted IPv6-prefix, 42::/16. Anyone can has a + /128-subnet and, if require, anything larger. + +Retiolum Realtime Map n. +- The network map of the public visible part of Retiolum. + +RRM [abbr.] +- Short for Retiolum Retiolum Map. + +Sanatorium n. +- The Krebs Control and Command Center. +- An Retiolum-based IRC-channel where all Reaktor-enabled nodes gather + and lurk for relevant input. diff --git a/doc/cookbook/reducer.sh b/doc/cookbook/reducer.sh index fa3d4e3d..648047fb 100755 --- a/doc/cookbook/reducer.sh +++ b/doc/cookbook/reducer.sh @@ -1,7 +1,7 @@ #! /bin/sh # TODO tolower tr '[:upper:]' '[:lower:]' | -sed -r ' - s/\<dosen?//g +sed ' + s/\<dosen\?//g s/mark//g ' diff --git a/filebitch/TODO b/filebitch/TODO new file mode 100644 index 00000000..aa2af36a --- /dev/null +++ b/filebitch/TODO @@ -0,0 +1,2 @@ +Buid a blacklist so some IPs(e.g. monitoring servers) don't trigger a beep + diff --git a/filebitch/connect_narf.pl b/filebitch/connect_narf.pl index 8e984150..7c713d3b 100755 --- a/filebitch/connect_narf.pl +++ b/filebitch/connect_narf.pl @@ -10,9 +10,10 @@ $ip = $ARGV[0]; #I'm very sorry for this regex, but i only wanted it to get _real_ IPv4 Adresses of the log file, not any kind of timestamp bullshit $ip =~ s/\b(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\b//g; +if($ip ne "10.42.0.107"){ #getting some guys sitting next to the Server pissed :) -system("morse -l 42 -f 2000 $ip"); -system("morse -l 42 -f 3000 \"connected\""); - + system("morse -l 42 -f 2000 $ip"); + system("morse -l 42 -f 3000 \"connected\""); +} # Uncomment the beep below to play the enterprise connect sound # system("beep -l 42 -f 2000 -D 42 -n -l 42 -f 3337"); diff --git a/god/Reaktor/index b/god/Reaktor/index new file mode 100755 index 00000000..a7840bb2 --- /dev/null +++ b/god/Reaktor/index @@ -0,0 +1,39 @@ +#! /bin/sh +# +# //god/Reaktor - listen to UDP events and forward them to IRC +# +# export host passwd printto to configure jsb-udp +# +set -euf +cd $(readlink -f $(dirname $0)) + +listener=$(readlink -f lib/listener.py) + +jsb_version=0.7.1.2 +distdir=jsb-$jsb_version.tar.gz + +host=${host-91.206.142.247} +passwd=${passwd-h4x0r} +printto=${printto-#tincspasm} + +if ! test -x tmp/jsb-$jsb_version; then + mkdir -p tmp + cd tmp + curl -f http://jsonbot.googlecode.com/files/jsb-$jsb_version.tar.gz | tar zx + cd jsb-$jsb_version + bin/jsb-udp -s </dev/null + cd ../.. +fi +cd tmp/jsb-$jsb_version + +# TODO only if it is not already configured properly +cache="`cat config/udp-send`" +echo "$cache" | +sed ' + s/^host *=.*/host="'$host'"/ + s/^passwd *=.*/passwd="'$passwd'"/ + s/^printto *=.*/printto="'$printto'"/ +' > config/udp-send + +# TODO output modules: stderr, jsb-udp, remount-ro, ... +PYTHONUNBUFFERED=y $listener | tee /dev/stderr | bin/jsb-udp diff --git a/god/Reaktor/lib/listener.py b/god/Reaktor/lib/listener.py new file mode 100755 index 00000000..9708d9bc --- /dev/null +++ b/god/Reaktor/lib/listener.py @@ -0,0 +1,50 @@ +#! /usr/bin/env python2 +# coding=UTF-8 + +location = 'shackspace' +host = '0.0.0.0' +port = 2342 + +map = { + 'shackspace': { + 'device': { + 0: 'Licht0, Zickenzone; Fenster', + 1: 'Licht1, Sofaecke; Fenster', + 2: 'Licht2, Zickenzone; Ghetto', + 3: 'Licht3, Sofaecke; Ghetto', + 4: 'Licht4, Richtung Getränkelager', + 5: 'Licht5, Porschekonsole', + 6: 'Licht6, Tomatenecke', + 7: 'Licht7, Ghetto', + 10: 'Hauptschalter' + }, + 'state': { + 0: 'aus', + 1: 'an', + 2: 'aus in T-10s' + }, + '->': 'ist' + } +} + +import socket +from string import join +from struct import unpack + +# create udp socket +mysocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + +# allow send/recieve from broacast address +mysocket.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1) + +# allow the socket to be re-used +mysocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) +mysocket.bind((host, port)) + +map = map[location] + +while True: + did, sid = unpack('BB', mysocket.recv(2)) + device, state = map['device'][did], map['state'][sid] + arrow = map['->'] + print join([device, arrow, state], ' ') @@ -1,20 +1,117 @@ #!/bin/bash -case "$1" in - (--help) echo "Toggle the lights";; - (*) - LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` - TOGGLE=`echo $2 | sed -n '/^[0-1]/p'` +# +#SYNOPSIS +# //god/licht [options] [0/1] +#OPTIONS +# all - toggles all lights +# links - toggles all lights on the left hand side while looking towards the Auditorium +# rechts - toggles all lights on the right hand side while looking towards the Auditorium +# kuschel - toggles the lights in the pwnie corner +# software - toggles the software corner +# tische - toggles the lights on the window side of the long table +# porsche - toggles the lights on the window side where the porsche cockpit is +# ghetto - toggles the lights in the hallway +# 0-7 - toggles individual lights + +toggle() { + LAMPE=`echo "$1" | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` + TOGGLE=`echo "$2" | sed -n '/^[0-1]/p'` if ! [ "$LAMPE" -a "$TOGGLE" ];then echo "you are made of stupid" exit 1 fi - STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" + STRING="\\xA5\\x5A\\x$LAMPE\\x$TOGGLE" if [ $# != 2 ] then - echo -ne "Usage: licht <lampe> <0/1>" + echo "Usage: licht <lampe> <0/1>" else echo "Toggle light $LAMPE ($TOGGLE)" - echo -ne "$STRING" | nc -u -w1 licht.shack 1337 + printf "$STRING" | nc -u -w1 licht.shack 1337 fi - ;; +} + +toggle_all() { + for i in `seq 0 7` + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +kuschel(){ + for i in 0 2 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +software(){ + for i in 1 3 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +tische(){ + for i in 4 6 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +ghetto(){ + printf "\\xA5\\x5A\\x7\\x$TOGGLE" | nc -u -w1 licht.shack 1337 +} + +porsche(){ + printf "\\xA5\\x5A\\x5\\x$TOGGLE" | nc -u -w1 licht.shack 1337 +} + +case "$1" in + --help) + echo "Toggle the lights" + echo "Usage: lich <lampe> <0/1>" + ;; + all) + TOGGLE=$2 + toggle_all + ;; + kuschel) + TOGGLE=$2 + kuschel + ;; + software) + TOGGLE=$2 + software + ;; + links) + TOGGLE=$2 + kuschel + software + ;; + rechts) + TOGGLE=$2 + tische + porsche + ghetto + ;; + tische) + TOGGLE=$2 + tische + ;; + porsche) + TOGGLE=$2 + porsche + ;; + ghetto) + TOGGLE=$2 + ghetto + ;; + *) + toggle "$@" + ;; esac + diff --git a/god/overlord/announce.mp3 b/god/overlord/announce.mp3 Binary files differnew file mode 100644 index 00000000..23bca769 --- /dev/null +++ b/god/overlord/announce.mp3 diff --git a/god/overlord/index b/god/overlord/index new file mode 100755 index 00000000..27506ccd --- /dev/null +++ b/god/overlord/index @@ -0,0 +1,27 @@ +#! /bin/sh +set -euf + +# cd // +cd $(dirname $(readlink -f $0))/../.. + +max=100 +step=10 +min=0 + +# fade-out streams +for i in `seq $max -$step $min`; do + amixer -q -c 0 -D hw:0 sset Front $i% + sleep 0.1 +done +streams/streams stop + +amixer -q -c 0 -D hw:0 sset Front $max% +mplayer god/overlord/announce.mp3 >/dev/null +espeak -v de -s 120 -a 900 "$*" + +# fade-in streams +streams/streams start +for i in `seq $min $step $max`; do + sleep 0.1 + amixer -q -c 0 -D hw:0 sset Front $i% +done diff --git a/gold/Makefile b/gold/Makefile index ff553def..97ddcf71 100644 --- a/gold/Makefile +++ b/gold/Makefile @@ -1,3 +1,5 @@ install: ln -snf $$PWD/mtgox/ticker_text.sh ../bin/mtgox_ticker ln -snf $$PWD/scex/ticker_text.sh ../bin/scex_ticker + ln -snf $$PWD/mooncoin/ticker_text.sh ../bin/mooncoin_ticker + ln -snf $$PWD/bitcoinslc/stats_text.sh ../bin/bitcoinslc_stats diff --git a/gold/bitcoinslc/bitcoinslc.stats b/gold/bitcoinslc/bitcoinslc.stats new file mode 100755 index 00000000..8547dbcc --- /dev/null +++ b/gold/bitcoinslc/bitcoinslc.stats @@ -0,0 +1,4 @@ +#! /bin/sh +# get mtgox ticker data +set -euf +curl -ksS https://www.bitcoins.lc/stats.json diff --git a/gold/bitcoinslc/bitcoinslc.stats.render b/gold/bitcoinslc/bitcoinslc.stats.render new file mode 100755 index 00000000..7ab26a02 --- /dev/null +++ b/gold/bitcoinslc/bitcoinslc.stats.render @@ -0,0 +1,7 @@ +#!/usr/bin/python + +import json,sys + +result = json.load(sys.stdin) + +print "Block: " + str(result["current_block"]) + " Difficulty: " + str(result["difficulty"]) diff --git a/gold/bitcoinslc/stats_text.sh b/gold/bitcoinslc/stats_text.sh new file mode 100755 index 00000000..2d146c86 --- /dev/null +++ b/gold/bitcoinslc/stats_text.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./bitcoinslc.stats | ./bitcoinslc.stats.render diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control index de5a0fa4..ba1c35da 100755 --- a/gold/mining/bin/archlinux-cruise-control +++ b/gold/mining/bin/archlinux-cruise-control @@ -4,7 +4,7 @@ export EDITOR=vim echo "!! ARCHLINUX Cruise Control Mining installer !!" echo "** adding main network profile" cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main -echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main +echo 'POST_UP="cache=\"\$(cat /etc/resolv.conf)\"; echo \"\$cache\" | sed \"1i nameserver 8.8.8.8\" > /etc/resolv.conf"' >> /etc/network.d/main echo "** adding worker account" grep -q worker /etc/passwd || adduser worker gpasswd -a worker wheel @@ -25,7 +25,9 @@ echo "syntax on" > /home/worker/.vimrc echo "syntax on" > /root/.vimrc echo "** installing tinc" [ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc -sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers +cache="`cat /etc/sudoers`" +echo "$cache" | +sed 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' > /etc/sudoers echo "** Installing ATI drivers" [ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook @@ -33,8 +35,11 @@ echo "** Installing ATI drivers" echo "** installing X" pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim echo "** editing slim configuration" -sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf -sed -i 's/.*auto_login.*/auto_login yes/' /etc/slim.conf +cache="`cat /etc/slim.conf`" +echo "$cache" | sed ' + s/.*default_user.*/default_user worker/ + s/.*auto_login.*/auto_login yes/ +' > /etc/slim.conf echo "** Installing mining tools and overclocking stuff" [ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!" diff --git a/gold/mining/bin/cleanup_tmp b/gold/mining/bin/cleanup_tmp index e1395b19..ce72d906 100755 --- a/gold/mining/bin/cleanup_tmp +++ b/gold/mining/bin/cleanup_tmp @@ -1,4 +1,4 @@ #! /bin/sh -ls -lAtr /tmp/ | sed -rn ' - /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} +ls -lAtr /tmp/ | sed -n ' + /\.so$/{$!{s/.* \([A-Za-z0-9\]\+\.so\)$/rm -v \/tmp\/\1/p}} ' | sudo sh diff --git a/gold/mining/bin/ensure-wlan0 b/gold/mining/bin/ensure-wlan0 index fa92c4f5..2ede2e8f 100755 --- a/gold/mining/bin/ensure-wlan0 +++ b/gold/mining/bin/ensure-wlan0 @@ -6,10 +6,17 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exit 23 # go to hell fi +locate_bin() { + type -p "$1" || find / | sed -n '/.*bin\/'"$1"'$/{p;q}' | grep . +} + has_internet() { curl -sS google.com >/dev/null } +wpa_supplicant="`locate_bin wpa_supplicant`" +wpa_cli="`locate_bin wpa_cli`" + if test "${force-false}" = true || ! has_internet; then ## get rid of the fuckers @@ -20,8 +27,8 @@ if test "${force-false}" = true || ! has_internet; then beep -l 50 -f 2000; pkill wpa beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* - beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & - while ! wpa_cli status | grep -q wpa_state=COMPLETED; do + beep -l 50 -f 2000; $wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf || $wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf & + while ! $wpa_cli status | grep -q wpa_state=COMPLETED; do beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 sleep 1 done @@ -38,4 +45,4 @@ else (--quiet) : ;; (*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;; esac -fi +fi 2>&1 | tee /var/log/ensure-wlan0 diff --git a/gold/mooncoin/ticker b/gold/mooncoin/ticker new file mode 100755 index 00000000..1be3ed7f --- /dev/null +++ b/gold/mooncoin/ticker @@ -0,0 +1,2 @@ +#! /bin/sh +exec curl -ksS https://moonco.in/exchange/api/ticker/solidcoin diff --git a/gold/mooncoin/ticker_text.sh b/gold/mooncoin/ticker_text.sh new file mode 100755 index 00000000..fbaff55b --- /dev/null +++ b/gold/mooncoin/ticker_text.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./ticker | ../json/render/ticker diff --git a/gold/scoreboard/.gitignore b/gold/scoreboard/.gitignore new file mode 100644 index 00000000..657e895d --- /dev/null +++ b/gold/scoreboard/.gitignore @@ -0,0 +1,3 @@ +/plot/ +/profile +/archive/ diff --git a/gold/scoreboard/README b/gold/scoreboard/README new file mode 100644 index 00000000..8e59ab03 --- /dev/null +++ b/gold/scoreboard/README @@ -0,0 +1,29 @@ +Scoreboard +========== +a non-interactive gold logger/plotter + +scoreboard contains a number of modules which do a number of things: +ati_temper: log temperature data of an ati_temper enabled host : + see //gold/miner/bin/ati_temper +solidcoin : graph solidcoin informations +bitcoin : s.a. + +//gold/scoreboard/profile contains all the important paths and variables +which are sourced by the modules. In a new installation this file needs +to be customized. + +//gold/scoreboard/util/schedule_logger is the scheduler for generating +the graphs every 5 minutes. + + +Install +====== +* install lighttpd +* configure the profile template file accordingly +* [currently] do: + cd modules/available/ ati_temper; $EDITOR gather # change the host + * add the host key file to keys/ +* [currently] run: + modules/available/{ati_temper,bitcoin,solidcoin,static}/init +* run: + util/schedule_logger diff --git a/gold/scoreboard/modules/active/.placeholder b/gold/scoreboard/modules/active/.placeholder new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/gold/scoreboard/modules/active/.placeholder diff --git a/gold/scoreboard/modules/available/ati_temper/gather b/gold/scoreboard/modules/available/ati_temper/gather new file mode 100755 index 00000000..15f0b4f2 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/gather @@ -0,0 +1,14 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile + +# machine to check for +MACHINE=chinaman +MACHINE_KEY=$MDIR/keys/$MACHINE +LF=${MACHINE}_ati_temper +mkdir -p $ADIR +mkdir -p $LDIR + +# write into live directory and archive +[ ! -e $MACHINE_KEY ] && echo "No Key for $MACHINE" && exit 1 +echo "$(date +%Y-%m-%dT%H:%M:%S) $(ssh -i $MACHINE_KEY worker@$MACHINE '~/bin/ati_temper')" | tee $LDIR/$LF >> $ADIR/$LF diff --git a/gold/scoreboard/modules/available/ati_temper/index b/gold/scoreboard/modules/available/ati_temper/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/ati_temper/init b/gold/scoreboard/modules/available/ati_temper/init new file mode 100755 index 00000000..af99bfbb --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/init @@ -0,0 +1,28 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +MACHINE=chinaman +ln -s $HERE/index $HERE/../../active/${MACHINE}_ati_temper +mkdir -p $PDIR +cat > $PDIR/$MACHINE.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 +set xdata time +set autoscale +set grid +set title "$MACHINE Temperature" +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +set xlabel "Day" +plot "$ADIR/${MACHINE}_ati_temper" using 1:2 smooth bezier title "gpu0" with lines , \ +"$ADIR/${MACHINE}_ati_temper" using 1:3 smooth bezier title "gpu1" with lines , \ +"$ADIR/${MACHINE}_ati_temper" using 1:4 smooth bezier title "cpu0" with lines , \ +"$ADIR/${MACHINE}_ati_temper" using 1:5 smooth bezier title "rack" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e "s/set title.*/set title \"${MACHINE} 24 hours Temperature\"/" \ + -e "s/${MACHINE}_ati_temper/${MACHINE}_last_day/g" \ + $PDIR/${MACHINE}.conf >$PDIR/${MACHINE}_last_day.conf + diff --git a/gold/scoreboard/modules/available/ati_temper/plot b/gold/scoreboard/modules/available/ati_temper/plot new file mode 100755 index 00000000..06f20c24 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/plot @@ -0,0 +1,10 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/chinaman.conf> $GDIR/chinaman_overall.png +tail -n288 $ADIR/chinaman_ati_temper > $ADIR/chinaman_last_day +gnuplot $PDIR/chinaman_last_day.conf > $GDIR/chinaman_24h.png diff --git a/gold/scoreboard/modules/available/bitcoin/gather b/gold/scoreboard/modules/available/bitcoin/gather new file mode 100755 index 00000000..22410f7b --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/gather @@ -0,0 +1,13 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +LF=bitcoin +mkdir -p $ADIR +mkdir -p $LDIR + + +# write into live directory and archive +#$BITCOIND_PATH getinfo | python $HERE/render | tee $LDIR/$LF >> $ADIR/$LF +echo `date +"%Y-%m-%dT%H:%M:%S"` `$KREBSDIR/bin/bitcoinslc_stats` | sed -e 's/Difficulty: //' -e 's/Block: //' | tee $LDIR/_${LF}>> $ADIR/${LF} + +echo `date +"%Y-%m-%dT%H:%M:%S"` `$KREBSDIR/bin/mtgox_ticker` | sed -e 's/High: //' -e 's/Low: //' -e 's/Last: //' | tee $LDIR/ticker_${LF}>> $ADIR/ticker_${LF} diff --git a/gold/scoreboard/modules/available/bitcoin/index b/gold/scoreboard/modules/available/bitcoin/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/bitcoin/init b/gold/scoreboard/modules/available/bitcoin/init new file mode 100755 index 00000000..97b60402 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/init @@ -0,0 +1,48 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +ln -s $HERE/index $HERE/../../active/bitcoin +cat > $PDIR/bitcoin.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 #size 640, 240 +set style function lines +#set size ratio 0.5 +#set origin 0.0,0.5 +set multiplot title "Bitcoin" +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Blocks" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$ADIR/bitcoin" using 1:2 smooth bezier title "Blocks" with lines + +set title "Difficulty" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$ADIR/bitcoin" using 1:3 title "Difficulty" with lines + +#set title "MtGox Pricing" +set notitle +set tmargin 2 +set size 1,0.5 +set origin 0.0,0.5 +set key left top +plot "$ADIR/ticker_bitcoin" using 1:2 smooth bezier title "High" with lines , \ + "$ADIR/ticker_bitcoin" using 1:3 smooth bezier title "Low" with lines , \ + "$ADIR/ticker_bitcoin" using 1:4 smooth bezier title "Last" with lines + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/title \"Bitcoin\"/title "Bitcoin Last Day"/' \ + -e "s/bitcoin/bitcoin_last_day/g" \ + $PDIR/bitcoin.conf >$PDIR/bitcoin_last_day.conf diff --git a/gold/scoreboard/modules/available/bitcoin/plot b/gold/scoreboard/modules/available/bitcoin/plot new file mode 100755 index 00000000..209f662c --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/plot @@ -0,0 +1,11 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/bitcoin.conf> $GDIR/bitcoin.png +tail -n288 $ADIR/bitcoin > $ADIR/bitcoin_last_day +tail -n288 $ADIR/ticker_bitcoin > $ADIR/ticker_bitcoin_last_day +gnuplot $PDIR/bitcoin_last_day.conf > $GDIR/bitcoin_24h.png diff --git a/gold/scoreboard/modules/available/bitcoin/render b/gold/scoreboard/modules/available/bitcoin/render new file mode 100644 index 00000000..7ef432ac --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/render @@ -0,0 +1,10 @@ +#!/usr/bin/python +import json,urllib,datetime,sys +today = datetime.datetime.now() + +result = json.load(sys.stdin) +print today.strftime("%Y-%m-%dT%H:%M:%S"), +print '%s' % result["blocks"], +print '%s' % result["difficulty"], +print '%s' % result["keypoololdest"], +#print '%s' % result["keypoolsize"] diff --git a/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats b/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats new file mode 100755 index 00000000..599ef9ff --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats @@ -0,0 +1,11 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime +url="http://bitcoinpool.com/pooljson.php" +f = open('/home/makefu/log/bitcoinpool_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), +for k,v in result.iteritems(): + print >>f ,'%s' % v, +print >>f diff --git a/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live new file mode 100755 index 00000000..9fcbc6af --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live @@ -0,0 +1,8 @@ +#!/bin/sh +LF=`basename $0` +token=`curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' http://www.bitcoins.lc -c cookiejar 2>/dev/null | grep -E '_csrf_token' | tail -n 1 | sed -n 's/.*value="\([0-9a-f]*\)".*/\1/p'` + +curl --keepalive -v -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' -e http://www.bitcoins.lc/ -d "_csrf_token=$token" -d "action=login" -d "email=$BITCOINSLC_MAIL" -d "password=$BITCOINSLC_PASS" -d "login=Proceed" -b cookiejar -c cookiejar https://www.bitcoins.lc/ -k 2>/dev/null +#<p><p><strong>Your current total hashrate</strong><br>765.94 Mhash/s</p></p> +mkdir -p $LDIR +echo $(date +%Y-%m-%dT%H:%M:%S) `curl -b cookiejar -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' https://www.bitcoins.lc/stats --keepalive 2>/dev/null| sed -n 's/.*Your current total hashrate<\/strong><br>\([0-9.]*\).*/\1/p'` > $ADIR/chinaman_$LF diff --git a/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats new file mode 100755 index 00000000..29508486 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats @@ -0,0 +1,18 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime,sys +url="https://www.bitcoins.lc/stats.json" +f = open(sys.env['ADIR']+'/bitcoinslc_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), +# hash_rate current_block active_workers total_workers total_users round_shares valid_round_shares total_shares +print >>f , ("%s" % result['hash_rate'] ), +print >>f , ("%s" % result['current_block'] ), +print >>f , ("%s" % result['active_workers'] ), +print >>f , ("%s" % result['total_workers'] ), +print >>f , ("%s" % result['total_users'] ), +print >>f , ("%s" % result['round_shares'] ), +print >>f , ("%s" % result['valid_round_shares'] ), +print >>f , ("%s" % result['total_shares'] ), +print >>f diff --git a/gold/scoreboard/modules/available/btcguild/btcguild_stats b/gold/scoreboard/modules/available/btcguild/btcguild_stats new file mode 100755 index 00000000..58d72f75 --- /dev/null +++ b/gold/scoreboard/modules/available/btcguild/btcguild_stats @@ -0,0 +1,22 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime +url="http://www.btcguild.com/pool_stats.php" +f = open('/home/makefu/log/btcguild_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +try: + print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), + # uk_speed round_time round_shares active_workers useast_speed uscentral_speed uswest_speed hash_rate nl_speed + print >>f , ("%s" % '0' ).replace('.',''), + print >>f , ("%s" % result['round_time'] ).replace('.',''), + print >>f , ("%s" % result['round_shares'] ).replace('.',''), + print >>f , ("%s" % result['active_workers'] ).replace('.',''), + print >>f , ("%s" % result['useast_speed'] ).replace('.',''), + print >>f , ("%s" % result['uscentral_speed'] ).replace('.',''), + print >>f , ("%s" % result['uswest_speed'] ).replace('.',''), + print >>f , ("%s" % result['hash_rate'] ).replace('.',''), + print >>f , ("%s" % 0 ).replace('.',''), + print >>f +except: + pass diff --git a/gold/scoreboard/modules/available/btcguild/btcguild_stats_self b/gold/scoreboard/modules/available/btcguild/btcguild_stats_self new file mode 100755 index 00000000..9cb65590 --- /dev/null +++ b/gold/scoreboard/modules/available/btcguild/btcguild_stats_self @@ -0,0 +1,15 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime,sys +url="http://www.btcguild.com/api.php?api_key="+sys.env['BTCGUILD_APIKEY'] +f = open('/home/makefu/log/btcguild_stats_self',mode='a') +today = datetime.datetime.now() + +#result = simplejson.load(urllib.urlopen(url)) +#print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), + +# TODO do the right thing with the data (aka this loop is wrong, fixme +#for k,v in result.iteritems(): +# data = '%s' % v +# data = data.replace('.','') +# print >>f ,data, +#print >>f diff --git a/gold/scoreboard/modules/available/create_gnuplot b/gold/scoreboard/modules/available/create_gnuplot new file mode 100755 index 00000000..95a6d170 --- /dev/null +++ b/gold/scoreboard/modules/available/create_gnuplot @@ -0,0 +1,196 @@ +#!/bin/sh +#set -x +umask 000 +MDIR=/home/makefu/log +DDIR=/srv/http/tmp +mkdir -p $DDIR/graphs +cat > $DDIR/.htaccess << EOF +order allow,deny +allow from all +EOF + +# +# chinaman +# +cat > $MDIR/plot/chinaman.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 +set xdata time +set autoscale +set grid +set title "Chinaman Temperature" +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +set xlabel "Day" +plot "$MDIR/chinaman_ati_temper" using 1:2 smooth bezier title "gpu0" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:3 smooth bezier title "gpu1" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:4 smooth bezier title "cpu0" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:5 smooth bezier title "rack" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/set title.*/set title "Chinaman 24 hours Temperature"/' \ + -e 's/chinaman_ati_temper/chinaman_last_day/g' \ + $MDIR/plot/chinaman.conf >$MDIR/plot/chinaman_last_day.conf + +cat $MDIR/plot/chinaman.conf | gnuplot > $DDIR/graphs/chinaman_overall.png +tail -n288 $MDIR/chinaman_ati_temper > $MDIR/chinaman_last_day +cat $MDIR/plot/chinaman_last_day.conf | gnuplot > $DDIR/graphs/chinaman_24h.png +rm $MDIR/chinaman_last_day + +# +#bitcoinpool +# +cat > $MDIR/plot/bitcoinpool.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Efficieny" +set size 0.5,0.5 +set origin 0.0,0.5 +plot "$MDIR/bitcoinpool_stats" using 1:2 smooth bezier title "Efficieny" with lines + +set title "round shares" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$MDIR/bitcoinpool_stats" using 1:3 smooth bezier title "round shares" with lines + + +set title "Active Users" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$MDIR/bitcoinpool_stats" using 1:5 smooth bezier title "active users" with lines +set title "Hashrate" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/bitcoinpool_stats" using 1:7 smooth bezier title "hashrate" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/bitcoinpool_stats/bitcoinpool_last_day/g' \ + $MDIR/plot/bitcoinpool.conf >$MDIR/plot/bitcoinpool_last_day.conf + +cat $MDIR/plot/bitcoinpool.conf | gnuplot > $DDIR/graphs/bitcoinpool.png +tail -n288 $MDIR/bitcoinpool_stats > $MDIR/bitcoinpool_last_day +cat $MDIR/plot/bitcoinpool_last_day.conf | gnuplot > $DDIR/graphs/bitcoinpool_24h.png +rm $MDIR/bitcoinpool_last_day + +# uk_speed round_time round_shares active_workers useast_speed uscentral_speed uswest_speed hash_rate nl_speed +cat > $MDIR/plot/btcguild.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + + +set title "round shares" +set size 0.5,0.5 +set origin 0.0,0.0 +set yrange [0:3000000] +plot "$MDIR/btcguild_stats" using 1:4 smooth bezier title "round shares" with lines + + +set title "Active Users" +set size 0.5,0.5 +set origin 0.5,0.0 +set autoscale +plot "$MDIR/btcguild_stats" using 1:5 smooth bezier title "active users" with lines + +set title "Hashrate" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/btcguild_stats" using 1:9 smooth bezier title "hashrate" with lines + +set title "Hash count" +set size 0.5,0.5 +set origin 0.0,0.5 +bw=300000 +set autoscale +bin(x,width)=width*floor(x/width) +#plot "$MDIR/btcguild_stats" using (bin(\$4,bw)):(1.0) smooth frequency title "time taken" with steps + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/btcguild_stats/btcguild_last_day/g' \ + $MDIR/plot/btcguild.conf >$MDIR/plot/btcguild_last_day.conf + +gnuplot $MDIR/plot/btcguild.conf > $DDIR/graphs/btcguild.png +tail -n288 $MDIR/btcguild_stats > $MDIR/btcguild_last_day +gnuplot $MDIR/plot/btcguild_last_day.conf > $DDIR/graphs/btcguild_24h.png +rm $MDIR/btcguild_last_day + +# +#bitcoinslc +# +cat > $MDIR/plot/bitcoinslc.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" +# hash_rate current_block active_workers total_workers total_users round_shares valid_round_shares total_shares + +set title "Hash Rate" +set size 0.5,0.5 +set origin 0.0,0.5 +plot "$MDIR/bitcoinslc_stats" using 1:2 smooth bezier title "Hash Rate" with lines + +set title "active workers" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$MDIR/bitcoinslc_stats" using 1:4 smooth bezier title "workers" with lines + + +set title "Round Shares" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$MDIR/bitcoinslc_stats" using 1:7 smooth bezier title "round shares" with lines +set title "Total Shares" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/bitcoinslc_stats" using 1:7 smooth bezier title "shares" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/bitcoinslc_stats/bitcoinslc_last_day/g' \ + $MDIR/plot/bitcoinslc.conf >$MDIR/plot/bitcoinslc_last_day.conf + +cat $MDIR/plot/bitcoinslc.conf | gnuplot > $DDIR/graphs/bitcoinslc.png +tail -n288 $MDIR/bitcoinslc_stats > $MDIR/bitcoinslc_last_day +cat $MDIR/plot/bitcoinslc_last_day.conf | gnuplot > $DDIR/graphs/bitcoinslc_24h.png +rm $MDIR/bitcoinslc_last_day diff --git a/gold/scoreboard/modules/available/solidcoin/gather b/gold/scoreboard/modules/available/solidcoin/gather new file mode 100755 index 00000000..8b54bbb8 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/gather @@ -0,0 +1,12 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +LF=solidcoin +mkdir -p $ADIR +mkdir -p $LDIR + + +# write into live directory and archive +$SOLIDCOIND_PATH sc_getinfo | python $HERE/render | tee $LDIR/$LF >> $ADIR/$LF + +echo `date +"%Y-%m-%dT%H:%M:%S"` `$KREBSDIR/bin/mooncoin_ticker` | sed -e 's/High: //' -e 's/Low: //' -e 's/Last: //' | tee $LDIR/ticker_${LF}>> $ADIR/ticker_${LF} diff --git a/gold/scoreboard/modules/available/solidcoin/index b/gold/scoreboard/modules/available/solidcoin/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/solidcoin/init b/gold/scoreboard/modules/available/solidcoin/init new file mode 100755 index 00000000..b44a1b6b --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/init @@ -0,0 +1,48 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +ln -s $HERE/index $HERE/../../active/solidcoin +cat > $PDIR/solidcoin.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 #size 640, 240 +set style function lines +#set size ratio 0.5 +#set origin 0.0,0.5 +set multiplot title "Solidcoin" +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Blocks" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$ADIR/solidcoin" using 1:2 smooth bezier title "Blocks" with lines + +set title "Difficulty" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$ADIR/solidcoin" using 1:3 title "Difficulty" with lines + +#set title "Pricing" +set notitle +set tmargin 2 +set size 1,0.5 +set origin 0.0,0.5 +set key left top +plot "$ADIR/ticker_solidcoin" using 1:2 smooth bezier title "High" with lines , \ + "$ADIR/ticker_solidcoin" using 1:3 smooth bezier title "Low" with lines , \ + "$ADIR/ticker_solidcoin" using 1:4 smooth bezier title "Last" with lines + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/title \"Solidcoin\"/title "Solidcoin Last Day"/' \ + -e "s/solidcoin/solidcoin_last_day/g" \ + $PDIR/solidcoin.conf >$PDIR/solidcoin_last_day.conf diff --git a/gold/scoreboard/modules/available/solidcoin/plot b/gold/scoreboard/modules/available/solidcoin/plot new file mode 100755 index 00000000..d1feae88 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/plot @@ -0,0 +1,11 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/solidcoin.conf> $GDIR/solidcoin.png +tail -n288 $ADIR/solidcoin > $ADIR/solidcoin_last_day +tail -n288 $ADIR/ticker_solidcoin > $ADIR/ticker_solidcoin_last_day +gnuplot $PDIR/solidcoin_last_day.conf > $GDIR/solidcoin_24h.png diff --git a/gold/scoreboard/modules/available/solidcoin/render b/gold/scoreboard/modules/available/solidcoin/render new file mode 100644 index 00000000..19545b21 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/render @@ -0,0 +1,10 @@ +#!/usr/bin/python +import json,urllib,datetime,sys +today = datetime.datetime.now() + +result = json.load(sys.stdin) +print today.strftime("%Y-%m-%dT%H:%M:%S"), +print '%s' % result["blocks"], +print '%s' % result["difficulty"], +print '%s' % result["keypoololdest"], +print '%s' % result["keypoolsize"] diff --git a/gold/scoreboard/modules/available/static/init b/gold/scoreboard/modules/available/static/init new file mode 100755 index 00000000..a7dc8859 --- /dev/null +++ b/gold/scoreboard/modules/available/static/init @@ -0,0 +1,32 @@ +#!/bin/sh +# TODO use active modules to find out which to build +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +cat <<EOF >$GDIR/index.html +<html> + <head> + <title>Stats</title> + </head> + <body> + <center> + <div style="background-color: lightgrey;"> + <b><a href=http://bitcoin.sipa.be/index.html>Hashrate stats</a> + <a href=http://bitcoinx.com/profit/index.php>Mining Calculator</a> + </b> + </div> + <h1>Chinaman</h1> + <img src="chinaman_overall.png"> <img src="chinaman_24h.png"><br/> + <h1>Solidcoin</h1> + <img src="solidcoin.png"> <img src="solidcoin_24h.png"><br/> + <h1>Bitcoin</h1> + <img src="bitcoin.png"> <img src="bitcoin_24h.png"><br/> + <!--<h1>BTCGuild</h1> + <img src="btcguild.png"> <img src="btcguild_24h.png"><br/> + <h1>Bitcoinpool</h1> + <img src="bitcoinpool.png"> <img src="bitcoinpool_24h.png"><br/> + <h1>Bitcoins.lc</h1> + <img src="bitcoinslc.png"> <img src="bitcoinslc_24h.png"><br/> --!> + </center> + </body> +</html> +EOF diff --git a/gold/scoreboard/profile b/gold/scoreboard/profile new file mode 100644 index 00000000..ccd7c2b5 --- /dev/null +++ b/gold/scoreboard/profile @@ -0,0 +1,26 @@ +# the webpage directory +WDIR=/srv/http/tmp +LDIR=$WDIR/live +GDIR=$WDIR/graphs/gold + +# the root directory +KREBSDIR=/krebs +MDIR=$KREBSDIR/gold/scoreboard + +# folder where plot configs are written into +PDIR=$MDIR/plot +# the archive directory +ADIR=$MDIR/archive + +TEMPDIR=/tmp + +# bitcoinslc login/password +BITCOINSLC_MAIL= +BITCOINSLC_PASS= + +# binaries +SOLIDCOIND_PATH=/root/bin/solidcoind +BITCOIND_PATH=/root/bin/bitcoind + +# BTCGUILD +BTCGUILD_APIKEY= diff --git a/gold/scoreboard/util/run-folder b/gold/scoreboard/util/run-folder new file mode 100755 index 00000000..ae5c96ac --- /dev/null +++ b/gold/scoreboard/util/run-folder @@ -0,0 +1,6 @@ +#!/bin/sh +ls -1 $1 | while read script; do + echo "Running $script" + $1/$script & +done + diff --git a/gold/scoreboard/util/schedule_logger b/gold/scoreboard/util/schedule_logger new file mode 100755 index 00000000..6d071ba9 --- /dev/null +++ b/gold/scoreboard/util/schedule_logger @@ -0,0 +1,13 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../profile +RUN_PARTS=$HERE/run-folder +echo "adding getlogs to crontab" + +crontab -l 2>/dev/null | grep -v "$MDIR/modules/active" > $TEMPDIR/currcron +echo "*/5 * * * * /bin/date >>$TEMPDIR/debug_log && $RUN_PARTS $MDIR/modules/active >>$TEMPDIR/btc_logger_debug_log 2>&1" >> $TEMPDIR/currcron + +cat $TEMPDIR/currcron + +crontab $TEMPDIR/currcron +rm $TEMPDIR/currcron diff --git a/host/dist/arch/getsize b/host/dist/arch/getsize index d099c9e2..a2ef8f95 100755 --- a/host/dist/arch/getsize +++ b/host/dist/arch/getsize @@ -1,13 +1,13 @@ #! /bin/sh set -euf -sed -rn ' +sed -n ' /^Name/{ - s/^Name *: *(.*)$/\1/ + s/^Name *: *\(.*\)$/\1/ T h } /^Installed Size/{ - s/^Installed Size *: *(.*)$/ \1/ + s/^Installed Size *: *\(.*\)$/ \1/ T H x diff --git a/infest/Makefile b/infest/Makefile index ec5836a3..b96e1d7c 100644 --- a/infest/Makefile +++ b/infest/Makefile @@ -1,18 +1,2 @@ - -ifndef patch_file -patch_file := /etc/Verkrebsung.patch -endif - -ifndef patch_flags -patch_flags := -endif - -.PHONY: infest dry-run -infest: $(patch_file) - unset POSIXLY_CORRECT; patch $(patch_flags) -fNp0 < $< - -$(patch_file): bin/make-patch - $< >$@ - -dry-run: - make patch_file=/tmp/krebs-infest-dry-run.patch patch_flags=--dry-run +%: + @echo '[31;1;5mwhatever you try: you are made of stupid![m' >&2 diff --git a/infest/bin/make-patch b/infest/bin/make-patch deleted file mode 100755 index 1051c1aa..00000000 --- a/infest/bin/make-patch +++ /dev/null @@ -1,59 +0,0 @@ -#! /bin/sh - -t="`mktemp`" -p="`mktemp`" -trap "test -e $t && rm $t; test -e $p && rm $p" EXIT INT - -f=/etc/passwd -cat $f >$t -#sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $t -sed -ri '/^krebs/d' $t -echo "krebs:x:0:0::$HOME:/bin/bash" >>$t -diff -Naur $f $t >>$p - -f=/etc/shadow -cat $f >$t -sed -ri '/^krebs/d' $t -grep root $f | sed 's/^root/krebs/' >> $t -diff -Naur $f $t >>$p - -f=/etc/group -cat $f >$t -#sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $t -sed -ri '/^krebs/d' $t -echo 'krebs:x:0:' >>$t -diff -Naur $f $t >>$p - -f=/etc/fstab -cat $f >$t -if ! grep -q 'none[ \t]*/tmp' $t; then - echo 'none /tmp tmpfs defaults,size=50M 0 0' >>$t -fi -if ! grep -q 'none[ \t]*/var/log' $t; then - echo 'none /var/log tmpfs defaults,size=50M 0 0' >>$t -fi -diff -Naur $f $t >>$p - -readlink=`readlink -f $0` -dirname=`dirname $readlink` -echo [32m$dirname/../skel[m >&2 -ls -l $dirname/../skel -if cd $dirname/../skel; then - if cd etc; then - find . -mindepth 1 -maxdepth 1 -exec diff -Naur /etc/\{\} \{\} \; >>$p - cd .. - sed -i ' - s:^+++ \./:+++ /etc/: - ' $p - fi - if cd home; then - find . -type f -exec diff -Naur $HOME/\{\} \{\} \; >>$p - cd .. - sed -i ' - s:^+++ \./:+++ '$HOME'/: - ' $p - fi - cd .. -fi - -cat $p diff --git a/infest/skel/etc/profile b/infest/skel/etc/profile index 2812c86c..6c0dc852 100755 --- a/infest/skel/etc/profile +++ b/infest/skel/etc/profile @@ -2,6 +2,8 @@ export EDITOR=vi +# from original debian /etc/profile +PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" set -u alias bc='bc -q' alias df='df -h' diff --git a/json/sh/json.sh b/json/sh/json.sh index 2a64d371..79f8529a 100755 --- a/json/sh/json.sh +++ b/json/sh/json.sh @@ -6,23 +6,23 @@ set -euf # XXX json_key is something like PWD^^ normalize_json() { - sed -rn ' + sed -n ' 1s/^/cat<<EOF\n/ # TODO handle escaped double quotes - s/"[^"]+"/"$(echo -n & | base64)"/g + s/"[^"]\+"/"$(echo -n & | base64)"/g $s/$/\nEOF/ p ' | sh | tr -d '[:space:]' } json_to_sh() { - sed -rn ' + sed -n ' s/,/;/g s/\[/begin_json_array;/g; s/\]/end_json_array;/g s/\{/begin_json_object;/g; s/\}/end_json_object;/g - s/("[^"]+"):/json_set_key \1;/g - s/;("[^"]+")/;json_set string \1;/g - s/;([0-9.]+)/;json_set number `echo -n \1 | base64`;/g + s/\("[^"]\+"\):/json_set_key \1;/g + s/;\("[^"]\+"\)/;json_set string \1;/g + s/;\([0-9.]\+\)/;json_set number `echo -n \1 | base64`;/g s/;;/;/g s/;/\n/g p @@ -37,7 +37,7 @@ end_json_object() { pop_key # TODO check if is %%%MAKEJSONOBJ%%% #echo obj: $1 `set | sed -rn "s/^(${json_key}_[a-zA-Z]+)_VALUE=(.*)/\1/p"` >&2 #json_set object "`set | sed -rn "s/^(${json_key}_[a-zA-Z]+)_VALUE=(.*)/\1/p"`" - json_set object "`set | sed -rn "s/^(${json_key}_[a-zA-Z]+)=(.*)/\1/p"`" + json_set object "`set | sed -n "s/^\(${json_key}_[a-zA-Z]\+\)=\(.*\)/\1/p"`" } begin_json_array() { :; } end_json_array() { :; } diff --git a/krebsbeam/c-beam b/krebsbeam/c-beam deleted file mode 160000 -Subproject 0072bf8f0cd3a6d0fe022c15c8957373cebef29 diff --git a/meinsack/index b/meinsack/index new file mode 100755 index 00000000..7046d78c --- /dev/null +++ b/meinsack/index @@ -0,0 +1,85 @@ +#! /bin/sh +# +# //meinsack +# +# export plz +# export str +# export anr +# export ort +# +set -euf +cd $(dirname $(readlink -f $0))/.. # cd // + +plz=${plz+"&plz=$plz"} +str=${str+"&str=$str"} +anr=${anr+"&anr=$anr"} + +url="http://www.sita-deutschland.de/sita/ywbase_Abfallkalender_Stuttgart.nsf/frmSelect?ReadForm$plz$str$anr" + +# echo $url + +html="$(curl -fsS "$url" | iconv -f latin1 -t utf8)" + +if echo "$html" | fgrep -q 'Ihre Eingabe war nicht eindeutig'; then + { + echo "Error: multiple locations found" + echo "$html" | + query/jquery/index 'table.tab:nth-child(2n) .bordertop > .text' | + sed ' + s/[[:space:]]\+/ /g + s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space + ' | + while read plz && + read str && + read ort && + read bes1 && + read bes2 && + read anr; do + str=$(echo "$str"|sed 's/<[^>]*>//g') + echo "export anr=$anr if you meant \"$ort\"" + done | sort | uniq + } >&2 + exit 2 +elif test $(echo "$html" | grep -c 'Abfallkalender für') -gt 1 && + test -z "${ort-}"; then + { + echo "Error: multiple locations found" + echo "$html" | + query/jquery/index '.tab span.text,.subheadline' | + sed -n ' + s/[[:space:]]\+/ /g + s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space + s/^Abfallkalender.*[^0-9]\([0-9]\+\)[^(]*(\(.*\))/export ort=\2/p + ' | sort | uniq + } >&2 + exit 3 +else + result="$(echo "$html" | + query/jquery/index '.tab span.text,.subheadline' | { + if test -n "${ort-}"; then + sed -n " + /($ort)/,/^Abfallkalender/{p;b} + /($ort)/,\${p;b} + " + else + cat + fi + } | { + grep -v Abfallkalender | + sed ' + s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space + s/^[A-Z][a-z]\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\3-\2-\1/ + s/^[0-9].*/ "&T00:00:00.000Z"/ + $!s/$/,/ + 1s/^/[\n/ + $s/$/\n]/ + ' + })" + if ! echo "$result" | grep .; then + { + echo "Error: your query had no effect" + echo "url=\"$url\"" + } >&2 + exit 4 + fi +fi diff --git a/meta/bin/update b/meta/bin/update new file mode 100755 index 00000000..9b2289ad --- /dev/null +++ b/meta/bin/update @@ -0,0 +1,15 @@ +#! /bin/sh +set -euf + +cd $(dirname $(readlink -f $0))/../.. +id=`ls -lnd . | awk '{print$3}'` + +if test "${nosudo-false}" != true -a `id -u` != $id; then + echo "we're going sudo..." >&2 + exec sudo -u "#$id" "$0" "$@" + exit 23 # go to hell +fi + +echo "// is $PWD owned by $id" + +git pull diff --git a/meta/install b/meta/install new file mode 100755 index 00000000..07096b34 --- /dev/null +++ b/meta/install @@ -0,0 +1,25 @@ +#! /bin/sh +set -euf + +cd $(dirname $(readlink -f $0)) + +id=`ls -ld . | awk '{print$3}'` +update=$PWD/bin/update + +echo "#" +echo "# to install metastatic automatization facility do following:" +echo "#" +echo +echo " [32mln -vsn $update /update[m" +echo +if test -e /update; then + echo "# but beware: you already have an /update like this:" + ls -l /update +fi +echo "# then check if you can execute following with your current user:" +echo +echo " [32m/update[m" +echo +echo "# if not then add that user to your sudoers... maybe something" +echo "# like this could work: [32m`id -un` ALL=($id) NOPASSWD:/update[m" +echo "#[35m^D[m" diff --git a/node/Makefile b/node/Makefile index 0b7775ed..cbfa1e4a 100644 --- a/node/Makefile +++ b/node/Makefile @@ -1,46 +1,8 @@ -ifndef version - version := $(shell \ - curl -sS http://nodejs.org/ | \ - ../util/bin/hrefs | \ - sed -rn 's:.*node-(v[0-9.]+)\.tar\.gz:\1:p' | \ - sort | \ - tail -n 1) -endif - -export CPPFLAGS := -Wno-unused-but-set-variable - -.PHONY: all build install +.PHONY: all install all: @echo "You are made of stupid!"; exit 23 -build: out/node-$(version) - -install: out/node-$(version) - ln -vsnf ../node/$</bin/node ../bin/node - -out/node-%: src/node-% - cd $< && ./configure --prefix=$(PWD)/$@ - make -C $< - make -C $< install - -../bin/node: out/ - -src/node-git: src - cd src && \ - git clone https://github.com/joyent/node node-git - -src/node-%: src/node-%.tar.gz - cd src && tar xf node-$*.tar.gz - -.PRECIOUS: src/node-%.tar.gz -src/node-%.tar.gz: /usr/bin/curl src - { curl -o $@ http://nodejs.org/dist/node-$*.tar.gz && gzip -t $@; } || \ - { curl -o $@ http://nodejs.org/dist/$*/node-$*.tar.gz && gzip -t $@; } - -/usr/bin/curl: - apt-get install --yes curl - -src: - mkdir -v -p $@ +install: + ./install diff --git a/node/install b/node/install new file mode 100755 index 00000000..1284a73a --- /dev/null +++ b/node/install @@ -0,0 +1,79 @@ +#! /bin/sh +# +# //node/install +# +# export version=X.Y.Z to install a specific version +# otherwise the latest upstream version will be determined and used +# +# export force=true to install even though it already seems to be installed +# +# export clean=true to first wipe any generated files +# +set -xeuf + +# cd //node +cd $(readlink -f $(dirname $0)) + +# PATH prepend //node/tools //util/bin +export PATH="$PWD/tools:$PWD/../util/bin${PATH+:$PATH}" + +if test "${force-false}" = true; then + : # skip check if it is already installed +else + if test -e ../bin/node; then + : '[32m//bin/node[m # is already installed' + exit + fi +fi + +if test "${clean-false}" = true; then + rm -fR src out +fi + +test -d src || mkdir -v src +cd src + +version=${version-`latest-version`} + +target=node-v$version + +distfile=$target.tar.gz + +download() { + curl -C - -so $distfile http://nodejs.org/dist/v$version/$distfile || + curl -C - -so $distfile http://nodejs.org/dist/$distfile || : +} +is_downloaded() { + gzip -t $distfile 2>/dev/null +} +if ! is_downloaded; then + download + if ! is_downloaded; then + rm -f $distfile + download + fi + if ! is_downloaded; then + rm -f $distfile + echo failed to download distfile + exit 1 + fi +fi + +if ! zcat $distfile | tar -x --keep-newer-files 2>/dev/null; then + rm -fR $target + zcat $distfile | tar -x +fi + +cd .. + +prefix=out/$target +mkdir -p $prefix +prefix=`readlink -f $prefix` + +cd src/$target +./configure --prefix=$prefix +CPPFLAGS=-Wno-unused-but-set-variable make +make install +cd ../.. + +ln -snf ../node/out/$target/bin/node ../bin/node diff --git a/node/tools/latest-version b/node/tools/latest-version new file mode 100755 index 00000000..b99276d5 --- /dev/null +++ b/node/tools/latest-version @@ -0,0 +1,19 @@ +#! /bin/sh +# +# //node/tools/latest-version - retrieve the latest node version from the IN +# +set -euf + +# cd //node +cd $(readlink -f $(dirname $0)/..) + +# PATH prepend //util/bin +export PATH="$PWD/../util/bin${PATH+:$PATH}" + +# TODO punani install executable: curl + +curl -fsS http://nodejs.org/ | + hrefs | + sed -n 's:.*node-v\([0-9.]\+\)\.tar\.gz:\1:p' | + sort | + tail -n 1 diff --git a/noise/modules/ein_mal_eins b/noise/modules/ein_mal_eins index fb385b31..e21612a5 100755 --- a/noise/modules/ein_mal_eins +++ b/noise/modules/ein_mal_eins @@ -1,7 +1,7 @@ #! /bin/bash R() { - echo "`od -t d -N 1 /dev/urandom | sed -rn '1s/^[0-9]+ +//p'` % $@" | bc + echo "`od -t d -N 1 /dev/urandom | sed -n '1s/^[0-9]\+ \+//p'` % $@" | bc } diff --git a/noise/modules/help b/noise/modules/help index bc4c2931..0763f3a0 100755 --- a/noise/modules/help +++ b/noise/modules/help @@ -7,10 +7,10 @@ case "$1" in done 2>/dev/null done ## print all documented built-in commands - sed -rn 's:^noise_([a-z]+)\(\) \{ # (.+)?$:\1 \2:p' "$NOISE" - } | sort | uniq | sed -rn ' + sed -n 's:^noise_\([a-z]\+\)() { # \(.\+\)\?$:\1 \2:p' "$NOISE" + } | sort | uniq | sed -n ' $s/$/[m/ - s:^([a-z]+) (.+):[35mtype [32m/\1[35m to \2:p' ;; + s:^\([a-z]\+\) \(.\+\):[35mtype [32m/\1[35m to \2:p' ;; (*) ## call for directory in `echo "$NOISE_PATH" | tr : \ ` ; do diff --git a/noise/modules/mpc b/noise/modules/mpc index 0ab72058..20abf19b 100755 --- a/noise/modules/mpc +++ b/noise/modules/mpc @@ -10,5 +10,5 @@ case "$1" in ##echo test-module called with following arguments: "$@" ## send command for re-evaluation: ##echo /espeak test >$NOISE_linefeed - MPD_HOST=mpd.shack mpc $@ + MPD_HOST=filebitch.shack mpc $@ esac diff --git a/noise/modules/overlord b/noise/modules/overlord new file mode 100755 index 00000000..ded8627a --- /dev/null +++ b/noise/modules/overlord @@ -0,0 +1,14 @@ +#! /bin/sh +set -euf + +# cd // +cd $(dirname $(readlink -f $0))/../.. + +case "${1---help}" in + --help) + echo "Make an announcement! Usage: /overlord <text>" + ;; + *) + exec god/overlord/index "$@" + ;; +esac diff --git a/noise/modules/play b/noise/modules/play index 749b450a..180c1e0c 100755 --- a/noise/modules/play +++ b/noise/modules/play @@ -7,8 +7,8 @@ case "$1" in ffs='wav mp3 ogg asf flac' if test -z "$*" ; then - ls $HOME/noise/samples | sed -r ' - s:\.('"`echo "$ffs" | tr \ \|`"')$: [30m\1[m: + ls $HOME/noise/samples | sed ' + s:\.\('"`echo "$ffs" | tr \ \|`"'\)$: [30m\1[m: s:^:/play : s:.*:[32m&[m: ' @@ -28,7 +28,7 @@ Keine Audiodatei mit dem Namen gefunden... am besten gleich uploaden: - scp NAME shack@shack.shack:noise/samples/ + scp NAME shack@shack.shack:$HOME/noise/samples/ folgende Dateiendungen werden erkannt: $ffs[m EOF diff --git a/noise/modules/temp b/noise/modules/temp index 2f1dfcef..a11c3720 100755 --- a/noise/modules/temp +++ b/noise/modules/temp @@ -1,33 +1,32 @@ #! /bin/bash +temper=/krebs/temper/temper + main() { - case "$1" in + case "${1--K}" in (--help) echo "report temperature in K, °C, °R, or °F." + exit ;; - (-C|--celsius) - espeak_inside `inside_temp 'x - 273.15'` Grad Zelsius - espeak_outside `outside_temp 'x - 273.15'` Grad Zelsius - ;; - (-F|--fahrenheit) - espeak_inside `inside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - espeak_outside `outside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - ;; - (-R|--rankine) - espeak_inside `inside_temp 'x * 9/5'` Grad Renkin - espeak_outside `outside_temp 'x * 9/5'` Grad Renkin - ;; - (-K|--kelvin|*) - espeak_inside `inside_temp` Kelvin - espeak_outside `outside_temp` Kelvin + (-C|--celsius) unit='Grad Zelsius' ; formula='x - 273.15' ;; + (-F|--fahrenheit) unit='Grad Fahrenheit'; formula='x * 9/5 - 459.67' ;; + (-R|--rankine) unit='Grad Renkin' ; formula='x * 9/5' ;; + (-K|--kelvin) unit='Kelvin' ; formula='x' ;; + (*) + echo 'Error 1: you are made of stupid!' + exit 23 ;; esac + if test -f $temper -a -x $temper; then + espeak_inside `inside_temp "$formula"` $unit + fi + espeak_outside `outside_temp "$formula"` $unit } ## temp [<formula with temperature as x>] ## Echo temperature in K. If formula is given then return that result instead. inside_temp() { - echo "scale=2; x=`/krebs/temper/temper` + 273.15; ${1-x}" | bc + echo "scale=2; x=`$temper` + 273.15; ${1-x}" | bc } outside_temp() { @@ -36,13 +35,8 @@ outside_temp() { ` + 273.15; ${1-x}" | bc } -espeak_inside() { - echo Die Krebs-tempera-tur beträgt $@ | to_espeak -} - -espeak_outside() { - echo Die Außen-tempera-tur beträgt $@ | to_espeak -} +espeak_inside() { echo Die Krebs-tempera-tur beträgt $@ | to_espeak; } +espeak_outside() { echo Die Außen-tempera-tur beträgt $@ | to_espeak; } to_espeak() { sed ' diff --git a/noise/noise b/noise/noise index bd6b17c8..615277a6 100755 --- a/noise/noise +++ b/noise/noise @@ -7,8 +7,8 @@ noise_set() { # set a variable esac case $# in (0) ## print all noise variables - env | sed -rn ' - s/^noise_([[:alnum:]_]+)=(.*)$/[35;4m\1[;35m = [32m\2[m/p + env | sed -n ' + s/^noise_\([[:alnum:]_]\+\)=\(.*\)$/[35;4m\1[;35m = [32m\2[m/p ' | sort ;; (1) ## print value the specified variable @@ -31,7 +31,9 @@ noise_set() { # set a variable fi ## write variable to $env if grep -q "^$1=" "$env" ; then - sed -ri "s'^($1)=(.*)\$'\1=\'$2\''" $env + cache="`cat $env`" + echo "$cache" | + sed "s'^\($1\)=\(.*\)\$'\1=\'$2\''" > $env else echo "$1='$2'" >>$env fi @@ -47,7 +49,9 @@ noise_unset() { # unset a variable case $# in (1) ## unset "noise_$1" - sed -ni "/^$1=/!p" $env + cache="`cat $env`" + echo "$cache" | + sed -n "/^$1=/!p" > $env ;; (*) fail "broken commandline: $@" @@ -90,13 +94,13 @@ touch $env ## ## readline() { - { read REPLY && echo "$REPLY" ; } | sed -rn " + { read REPLY && echo "$REPLY" ; } | sed -n " s/[']//g s/~%/\n/g - s/([^\\])([#<>])/\1\\\\\2/g - s:^/([a-z_]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t - s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t - s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t + s/\([^\\]\)\([#<>]\)/\1\\\\\2/g + s:^/\([a-z_]\+\)\([[:space:]]\+\(.*\)\)\?$:command=\1; args='\3';:p;t + s@^\([[:alnum:]_/+-]\+\):[[:space:]]*\(.*\)@command=lang; args='\1 \2';@p;t + s@^\![[:space:]]*\(.*\)@command=play; args='\1';@p;t s:.*:command='$noise_default_command'; args='&';:p;t " } @@ -137,8 +141,8 @@ commit ` [m [33;1mJoin the 23.shack-dev-team, we've got ` sloccount $dirname/* | - sed -rn ' - s/.*\(SLOC\)[[:space:]]*=[[:space:]]*([0-9]+)$/\1/p + sed -n ' + s/.*(SLOC)[[:space:]]*=[[:space:]]*\([0-9]\+\)$/\1/p '` SLOC, ` { ls $dirname/modules/ diff --git a/oncology/dpfhack_display b/oncology/dpfhack_display deleted file mode 120000 index 9666b7bc..00000000 --- a/oncology/dpfhack_display +++ /dev/null @@ -1 +0,0 @@ -../submodules/github/makefu/dpfhack_display
\ No newline at end of file diff --git a/query/jquery/index b/query/jquery/index new file mode 100755 index 00000000..3c49dac9 --- /dev/null +++ b/query/jquery/index @@ -0,0 +1,19 @@ +#! /bin/sh +set -euf + +# cd // +cd $(dirname $(readlink -f $0))/../.. + +for x in \ + github/tmpvar \ + github/mikeal \ + github/NV \ + github/tautologistics \ +; do + export NODE_PATH="$(readlink -f submodules/$x)${NODE_PATH+:$NODE_PATH}" +done + +# ensure query is ready +#git submodule update --init + +exec node submodules/github/visionmedia/query "$@" diff --git a/query/realpath/install b/query/realpath/install new file mode 100755 index 00000000..74671c81 --- /dev/null +++ b/query/realpath/install @@ -0,0 +1,41 @@ +#! /bin/sh +set -euf + +cd `dirname $0` + +target=../../bin/realpath + +findexe() { + OLDIFS="$IFS" + IFS=: + for d in $PATH; do + f="$d/$1" + if test -f "$f" -a -x "$f"; then + echo $f + IFS="$OLDIFS" + return + fi + done + IFS="$OLDIFS" + ! : +} + +if exe="`findexe readlink`" && $exe -f install | grep -q /install$; then + ! test -e $target || rm $target + cat > $target <<EOF +#! /bin/sh -euf +exec $exe -f "\${1-\$file_name}" +EOF + chmod +x $target + echo '//query/realpath: install readlink' >&2 + exit +fi + +if type ruby 1>/dev/null 2>/dev/null; then + ln -snf ../query/realpath/src/realpath.rb $target + echo '//query/realpath: install realpath.rb' >&2 + exit +fi + +echo 'Error 2: your system is made of stupid!' +exit 23 diff --git a/query/realpath/src/realpath.rb b/query/realpath/src/realpath.rb new file mode 100755 index 00000000..8e19785b --- /dev/null +++ b/query/realpath/src/realpath.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby + +begin + $stdout.print File.realpath(ARGV[0]) + $stdout.print "\n" +rescue Exception => err + $stderr.print err + $stderr.print "\n" + exit 1 +end diff --git a/retiolum/Makefile b/retiolum/Makefile index 407d8c60..c80a6faa 100644 --- a/retiolum/Makefile +++ b/retiolum/Makefile @@ -8,9 +8,10 @@ links: for x in $(EXES); do ln -vsnf ../retiolum/bin/$$x ../bin; done hosts: - bin/update-retiolum-hosts + bin/update-retiolum-hosts || true install: update + @#punani -Ei tinc python @# will not run automatically scripts/tinc_setup/install.sh scripts/autostart/create-startup.sh @@ -18,10 +19,10 @@ install: update update: hosts @echo creating Magic bin/update_tinc_hosts "create magic" || true - @echo adding hosts + @echo adding hosts bin/update_tinc_hosts restart arch-install: update install arch-autostart autohosts arch-autostart: - make -C scripts/autostart arch + make -C scripts/autostart arch || true diff --git a/retiolum/bin/check-free-retiolum-v4 b/retiolum/bin/check-free-retiolum-v4 index e9c6b3ce..3f0dbdf8 100755 --- a/retiolum/bin/check-free-retiolum-v4 +++ b/retiolum/bin/check-free-retiolum-v4 @@ -1,5 +1,4 @@ #! /bin/sh -set -x netname=retiolum myipv4=${1-10.7.7.-1} v4num=${myipv4##*.} @@ -10,12 +9,12 @@ then cd /etc/tinc/$netname/hosts printf "Check if ip is still free: " for i in `ls -1`; do - if grep $myipv4 $i &>/dev/null ;then + if grep -q -e $myipv4\$ $i ;then echo "Host IP already taken by $i! " exit 1 fi done - printf "Passed" + printf "Passed\n" else printf "you are made of stupid. bailing out\n" exit 1 diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts index 6939f52c..bd0c77dc 100755 --- a/retiolum/bin/hosts +++ b/retiolum/bin/hosts @@ -6,6 +6,8 @@ netname=${1-retiolum} cd /etc/tinc/$netname/hosts for i in `ls`; do - sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i + sed -n ' + s|^ *Subnet *= *\([^ /]*\)\(/[0-9]*\)\? *$|\1\t'$i' '$i'.'$netname'|p + ' $i done | sort diff --git a/retiolum/bin/ipv6 b/retiolum/bin/ipv6 index 65a1eaa1..34c6de71 100755 --- a/retiolum/bin/ipv6 +++ b/retiolum/bin/ipv6 @@ -13,7 +13,7 @@ if test `id -u` != 0; then fi file=/etc/tinc/retiolum/hosts/`hostname` -addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file` +addr=`sed -n 's|^Subnet *= *\(42:[0-9A-Fa-f:]*/128\)|\1|p' $file` route=42::/16 start() { diff --git a/retiolum/bin/update-retiolum-hosts b/retiolum/bin/update-retiolum-hosts index 7b2fa0e5..1fecfe15 100755 --- a/retiolum/bin/update-retiolum-hosts +++ b/retiolum/bin/update-retiolum-hosts @@ -7,6 +7,9 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exit 23 # go to hell fi +# cd //retiolum +cd $(dirname $(readlink -f $0))/.. + mkdir -v -p /etc/tinc/retiolum/hosts cp -v -r hosts/* /etc/tinc/retiolum/hosts pkill -HUP tincd diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts index fe0785e3..86a28992 100755 --- a/retiolum/bin/update_tinc_hosts +++ b/retiolum/bin/update_tinc_hosts @@ -29,9 +29,13 @@ case "${*-I am made of stupid}" in ;; ('create magic') $0 has magic || $0 print magic >> $hosts < /dev/null + $0 start ;; ('destroy magic') - $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts + if $0 has magic; then + cache="`cat $hosts`" + echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts + fi ;; ('has magic') grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts diff --git a/retiolum/hosts/also b/retiolum/hosts/also index 14001d7a..4d118f31 100644 --- a/retiolum/hosts/also +++ b/retiolum/hosts/also @@ -1,4 +1,5 @@ Subnet = 42:9c90:a590:e88a:52cf:126f:b710:1a9c/128 +Subnet = 10.7.7.23 -----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEAsnF1eyd/R4qXMGo8UEZ98hnJK+6ZEKUubgdzEwAuSxK40B6nX8Ry Euy3v3s0ps/GMdE52gUbFB+bhM99hHiKW+7zcxnoMJ69a9yK6VG0Im+7ib0WTliZ diff --git a/retiolum/hosts/iiso b/retiolum/hosts/iiso new file mode 100644 index 00000000..ca7b3004 --- /dev/null +++ b/retiolum/hosts/iiso @@ -0,0 +1,10 @@ +Subnet = 42:b2cd:6c75:d528:e736:ec4e:fc39:8bdc/128 +Subnet = 10.7.7.218 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAvsjBR0FUkjiNNLhz3AArosLqEiLZY7O8L6LorfUplD/IjG9P7XXx +ry4gbKEH57GPn11IOPP1AKQcz7SfW7EwvUS8U1IZgkQq8BuuD3oGBQxOqwnOwzVN ++XKSZjUfmT/Uf81PHfWE52BfbitI+SBTi0m9cIuhgyYRAjD7We97ogkWDogBXKvC +p1YYH44wcLte7lzWmId9hNOJtTu4KnCVgtXi/DYVLvuofrEk28DhhRSFiun4dkN6 +qMl8ZWOILOhUVSZN+cx/dslCwoog1FuEj7TyuhJFj8yoWIdI4xUGugzmV6npzTvU +bLkcVfuQQYlIV9D7YYPyEFB11U6mifZ5uwIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/hosts/sir_krebs_a_lot b/retiolum/hosts/sir_krebs_a_lot new file mode 100644 index 00000000..14e9d242 --- /dev/null +++ b/retiolum/hosts/sir_krebs_a_lot @@ -0,0 +1,11 @@ +Address = 84.23.79.81 +Subnet = 10.7.7.100 +Subnet = 42:48bd:f4cd:b2f1:ff6b:865c:d041:def6/128 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAzkVF0BSWUEqzdUidLTa6qL4wlNSb8gaxyZperzoAj65d5l25SCqc +jjqvREcE6p+jM4t1STXoohnNvexubNXW3PVo5Zpew+BsaGjVvow0LkqCJ9k96Rrk +JzU5lAVH6om3/QYws/Ot0zq1Z/+Xw/0+9JpVKhEipMWLpLgjAvWdvzSW6aBIHVN1 +3E85fkTE5f0azct+XNSNzUebdyIy8wu/EexGmFI9bN+ewIvqjZJdvxP+Ank55MsE +8P7K9TKwVXw440MGqqoQaOhdaT75TL+2nsAfWYcrNnE3YehMOmCMp9oY+RAvsIkK +iAYyF5l7ZTi/7KGHNsG7rr0cbytiz2nS6wIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/scripts/adv_graphgen/Makefile b/retiolum/scripts/adv_graphgen/Makefile new file mode 100644 index 00000000..fafac84e --- /dev/null +++ b/retiolum/scripts/adv_graphgen/Makefile @@ -0,0 +1,4 @@ +install: + #punani install graphviz + echo "add this line to your tinc.conf if you dare:" + echo 'GraphDumpFile = |/krebs/retiolum/scripts/adv_graphgen /srv/http/tmp/graphs/' diff --git a/retiolum/scripts/adv_graphgen/parse.py b/retiolum/scripts/adv_graphgen/parse.py index 0744b262..0bcf42a0 100755 --- a/retiolum/scripts/adv_graphgen/parse.py +++ b/retiolum/scripts/adv_graphgen/parse.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python # -*- coding: utf8 -*- import sys @@ -47,6 +47,7 @@ def write_node(k,v): edges are weightet with the informations inside the nodes provided by tinc """ + node = " "+k+"[label=\"" node += k+"\\l" node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" @@ -57,7 +58,7 @@ def write_node(k,v): node +="\"" if v['external-ip'] == "MYSELF": node += ",fillcolor=steelblue1" - node +=",group="+v['external-ip'].replace(".","")+"" + node +=",group=\""+v['external-ip'].replace(".","")+"\"" node += "]" print node diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh index 38281fba..1dc43bf4 100755 --- a/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -1,17 +1,20 @@ +#!/bin/sh +HERE=$(dirname `readlink -f $0`) +TMP=/tmp GRAPH_SETTER1=dot GRAPH_SETTER2=circo GRAPH_SETTER3='neato -Goverlap=prism ' GRAPH_SETTER4=sfdp -LOG_FILE=/var/log/everything.log +LOG_FILE=/var/log/syslog OPENER=/bin/true sudo pkill -USR2 tincd sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\ - ./parse.py > retiolum.dot + $HERE/parse.py > $TMP/retiolum.dot -$GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot -$GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot -$GRAPH_SETTER3 -Tpng -o $1retiolum_3.png retiolum.dot -$GRAPH_SETTER4 -Tpng -o $1retiolum_4.png retiolum.dot -$OPENER retiolum_1.png &>/dev/null -rm retiolum.dot +$GRAPH_SETTER1 -Tpng -o $1/retiolum_1.png $TMP/retiolum.dot +$GRAPH_SETTER2 -Tpng -o $1/retiolum_2.png $TMP/retiolum.dot +$GRAPH_SETTER3 -Tpng -o $1/retiolum_3.png $TMP/retiolum.dot +$GRAPH_SETTER4 -Tpng -o $1/retiolum_4.png $TMP/retiolum.dot +$OPENER $HERE/retiolum_1.png &>/dev/null +rm $TMP/retiolum.dot diff --git a/retiolum/scripts/tinc_setup/tinc-up b/retiolum/scripts/tinc_setup/tinc-up index ae7c68e6..9a557787 100755 --- a/retiolum/scripts/tinc_setup/tinc-up +++ b/retiolum/scripts/tinc_setup/tinc-up @@ -4,15 +4,15 @@ dirname="`dirname "$0"`" conf=$dirname/tinc.conf -name=`sed -rn 's|^ *Name *= *([^ ]*) *$|\1|p' $conf` +name=`sed -n 's|^ *Name *= *\([^ ]*\) *$|\1|p' $conf` host=$dirname/hosts/$name route4=10.7.7.0/24 -addr4=`sed -rn 's|^ *Subnet *= *(10\.[^ ]*) *$|\1|p' $host` +addr4=`sed -n 's|^ *Subnet *= *\(10\.[^ ]*\) *$|\1|p' $host` route6=42::/16 -addr6=`sed -rn 's|^ *Subnet *= *(42:[^ ]*) *$|\1|p' $host` +addr6=`sed -n 's|^ *Subnet *= *\(42:[^ ]*\) *$|\1|p' $host` ifconfig $INTERFACE up $addr4 route add -net $route4 dev $INTERFACE diff --git a/retiolum/scripts/tinc_setup/write_channel.py b/retiolum/scripts/tinc_setup/write_channel.py index a11d4605..ee28674f 100644 --- a/retiolum/scripts/tinc_setup/write_channel.py +++ b/retiolum/scripts/tinc_setup/write_channel.py @@ -12,6 +12,7 @@ FILE="/etc/tinc/retiolum/hosts/"+myname PORT=6667 NICK= myname+"_"+str(random.randint(23,666)) +print "Connecting..." sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect((HOST,PORT)) print NICK diff --git a/shack/Eselkalk/index.js b/shack/Eselkalk/index.js new file mode 100644 index 00000000..f64e0605 --- /dev/null +++ b/shack/Eselkalk/index.js @@ -0,0 +1,57 @@ +// +// node //shack/Eselkalk DATE +// +// where DATE ∈ [YYYY[-MM]], defaulting to the current YYYY-MM +// + +range = process.argv[2] || + JSON.parse(JSON.stringify(new Date())).slice(0, '....-..'.length) + +function dates(date) { + var year = date.getFullYear() + var month = date.getMonth() + + var i = new Date([year, (month < 9 ? '0' : '') + (month + 1)].join('-')) + + var days = [] + var next_day = 4; + for ( + ; i.getMonth() === month + ; i = new Date(+i + 24 * 60 * 60 * 1000)) { + if (i.getDay() === next_day) { + next_day = next_day === 3 ? 4 : 3 + if (next_day === 3) { + var next_4day = new Date(+i + 7 * 24 * 60 * 60 * 1000) + if (next_4day.getMonth() !== month) { + i = new Date(+i - 24 * 60 * 60 * 1000) + next_4day = 4 + } + } + days.push(new Date(+i + (20 * 60 + i.getTimezoneOffset()) * 60 * 1000)) + while (i.getDay() !== 0) { + i = new Date(+i + 24 * 60 * 60 * 1000) + } + } + } + + return days +} + + +result = [] + +// TODO if (/^....-..-..$/.test(range)) { ... } +if (/^....-..$/.test(range)) { + result = dates(new Date(range)) +} +else if (/^....$/.test(range)) { + ['01','02','03','04','05','06','07','08','09','10','11','12' + ].forEach(function (i) { + result = result.concat(dates(new Date([range, i].join('-')))) + }) +} +else { + throw new Error('You are made of stupid! ' + range) +} + +console.log(JSON.stringify(result, null, 2)) diff --git a/shack/meinsack/index b/shack/meinsack/index new file mode 100755 index 00000000..7d7147b2 --- /dev/null +++ b/shack/meinsack/index @@ -0,0 +1,8 @@ +#! /bin/sh +set -euf +cd $(dirname $(readlink -f $0))/../.. # cd // + +export plz=70327 +export str=Ulmer +export ort=Wangen +exec meinsack/index diff --git a/streams/stream.db b/streams/stream.db index 5efeb9ea..47ccf7b5 100644 --- a/streams/stream.db +++ b/streams/stream.db @@ -6,3 +6,4 @@ http://somafm.com/illstreet.pls illstreet http://localhost:8000/stream.ogg icecast http://stream2.jungletrain.net:8000 jungletrain http://playlist.tormentedradio.com/tormentedradio.pls tormented +http://filebitch.shack:8000 mpd diff --git a/streams/streams b/streams/streams index 60a4bfc2..80c654ad 100755 --- a/streams/streams +++ b/streams/streams @@ -1,4 +1,8 @@ #! /bin/bash +set -euf + +stream_file=/tmp/krebs.stream.current + HERE=$(dirname $(readlink -f $0)) URLS=`cat $HERE/stream.db` CURRENT_STREAM="no stream" #will be set when calling `status` @@ -22,7 +26,12 @@ function start() { if echo "$URLS" | while read URL NAME; do if [ "$NAME" = "$REQ" ];then - tmux new-session -s streams -n streams -d "while sleep 1;do mplayer $URL;done" + tmux new-session -s streams -n streams -d " + while sleep 1; do + echo $NAME > $stream_file + mplayer $URL + done + " echo "** $REQ started" exit 1 fi @@ -97,7 +106,7 @@ Examples: case "$1" in start) - start $2 + start ${2-"`test -f $stream_file && cat $stream_file`"} ;; stop) stop diff --git a/util/bin/anonbox.net b/util/bin/anonbox.net index d038cd0a..3b648afb 100755 --- a/util/bin/anonbox.net +++ b/util/bin/anonbox.net @@ -13,12 +13,12 @@ GET() { ## retrieve data eval "$(${GET-GET} | - sed -rn ' -s^<dd><p>([[:alnum:]@.]+)</p></dd>$\ + sed -n ' +s^<dd><p>\([[:alnum:]@.]\+\)</p></dd>$\ email="\1" ; p -s^<dd><p><a href="([^"\\]+)">.*</a></p></dd>$\ +s^<dd><p><a href="\([^"\\]\+\)">.*</a></p></dd>$\ uri="\1/" ; p -s^<dd><p>([0-9]+)/([0-9]+)/([0-9]+) ([0-9]+):([0-9]+) ([ap]).m.</p></dd>$\ +s^<dd><p>\([0-9]\+\)/\([0-9]\+\)/\([0-9]\+\) \([0-9]\+\):\([0-9]\+\) \([ap]\).m.</p></dd>$\ Y=20\3 ; \ m=\1 ; \ d=\2 ; \ diff --git a/util/bin/dict.leo.org b/util/bin/dict.leo.org new file mode 100755 index 00000000..03f16b96 --- /dev/null +++ b/util/bin/dict.leo.org @@ -0,0 +1,87 @@ +#! /bin/sh +#### dict.leo.org version 2.0 beta 1 +set -euf + +cache_dir=/tmp/dict.leo.org/ +file="$cache_dir$*" + +url="http://dict.leo.org/?$*" + +# TODO check sanity of filename + +if test -d "$cache_dir" ; then + test -e "$file" || { curl --silent "$url" | tee "$file" ; } +else + curl --silent "$url" +fi | +sed 's/>\( *.\)/>\n\1/g' | sed -n ' + s/[[:space:]]/ /g + /<!-- # Werbung # -->/,/<\/td>/b + /<!-- ============================================== -->/,/^<\/td>/b + /<!-- # Trailer # -->/,/^ <\/table>/b + /<table id="subnavigation" class="border">/,/<\/table>/b + /<div id="divMoreInfo" class="popup">/,/^ <\/table>/b + + ## show link in rendered version + s/^<a href="\(.*searchLocRelinked.*\)">$/&mehr: \1/ + s/^mehr >>// + + s/<[Bb][Rr] *\/>/,/g + + p + b + :c;# comment + s/-->/\\-\\-\\>/g + s/<!--/\\<\\!\\-\\-/g + s/.*/<!--(&)-->/ + p +' \ +| w3m -cols 1024 -T text/html -dump | sed ' + s/[[:space:]]\+/ /g + s/ ,/,/g + s/^ //;s/ $// + s/[┌┬┐└┴┘├┼┤─]//g + s/ *│ */|/g + s/\[ \]// + s/\[Speichern\] der ausgewa:hlten Wo:rter im Trainer// + s/^||//;s/|| \?$// +' | sed -n ' + /^\[EN-> DE\]/,$b + s/^mehr: /+ / + s/^ENGLISCH||DEUTSCH \?/= Englisch -> Deutsch/ + s/^|\([0-9]\+\) \(Treffer\)|$/= \1 \2/ + s/^\([^|]\+\)||\([^|]\+\)$/- \1|\2/ + + s/^[^=+#-][^|]\+$/## &/ + + p +' | sed -n ' + /^$/b + s/ \([?!]\)/\1/g + s/\([[(]\) /\1/g;s/ \([]\)]\)/\1/g + + s/ ([0-9]\+ of [0-9]\+) \?//;# TODO + + #s/^##.*Grundform.*/\n#&/ + /^## .*Grundform.*/,/^##\( .*\)\?/{ + /##/{/Grundform/!p} + b + } + + /^## Informationen /,$b;# TODO + #/^## Beispiele/,$b;# TODO + #/^## Wendungen/,$b;# TODO + /^+/b;# TODO + #/^=/b;# TODO + + p +' | sed ' + ## + s/|\(.*\)/\n [32m\1[m/g + s/^#.*/\n[33m&[m/ + + s/##.*Treffer $/\n[1;33m#&[m/ +' | less -R +echo + +#### end of file. diff --git a/util/bin/my-global-ipv4-addr b/util/bin/my-global-ipv4-addr index 305d3f80..71608a8a 100755 --- a/util/bin/my-global-ipv4-addr +++ b/util/bin/my-global-ipv4-addr @@ -8,7 +8,8 @@ if test $# = 1; then has() { type "$1" 1>/dev/null 2>/dev/null; } parse() { - sed -rn 's/.*((1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])).*/\1/p' | grep . + sed -n 's/.*\(\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\).*/\1/p' | + grep . } get () { # TODO get random valid user agent diff --git a/util/bin/naturalvoices.att b/util/bin/naturalvoices.att index 9a944d8b..07fb6e17 100755 --- a/util/bin/naturalvoices.att +++ b/util/bin/naturalvoices.att @@ -24,8 +24,8 @@ done (cd "$pwd/../.." && git submodule update --init) { - for arg; do echo "$arg"; done | sed -rn ' - s/^--(.*=.*)/\1/p;t + for arg; do echo "$arg"; done | sed -n ' + s/^--\(.*=.*\)/\1/p;t s/.*/text="${text+$text }&"/p;t ' cat<<EOF diff --git a/util/bin/translate.google b/util/bin/translate.google index 1a1be6b6..45da6463 100755 --- a/util/bin/translate.google +++ b/util/bin/translate.google @@ -19,8 +19,8 @@ done (cd "$pwd/../.." && git submodule update --init) { - for arg; do echo "$arg"; done | sed -rn ' - s/^--(.*=.*)/\1/p;t + for arg; do echo "$arg"; done | sed -n ' + s/^--\(.*=.*\)/\1/p;t s/.*/text="${text+$text }&"/p;t ' cat<<EOF |
