pax_global_header00006660000000000000000000000064134711630370014517gustar00rootroot0000000000000052 comment=abe1a2080aae7c331fb5365fb7bd552d4e693317 consonance-0.1.3/000077500000000000000000000000001347116303700136465ustar00rootroot00000000000000consonance-0.1.3/.gitignore000066400000000000000000000000751347116303700156400ustar00rootroot00000000000000*.pyc *.class todo *.egg-info tp dist build .idea .tox *.iml consonance-0.1.3/LICENSE000066400000000000000000001044621347116303700146620ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {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 . 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: {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . consonance-0.1.3/README.md000066400000000000000000000104671347116303700151350ustar00rootroot00000000000000# Consonance Consonance implements WhatsApp's handshake process which makes use of Noise Pipes with Curve25519, AES-GCM, and SHA256 from Noise Protocol. ## META-INF ``` consonance version: 0.1.3 released: 2019-05-22 requires: - python>=2.5,<=3.7 - dissononce >= 0.34.3 - transitions - protobuf >= 3.6.0 - python-axolotl-curve25519 ``` ## Installation From source: ``` python setup.py install ``` Using Pip: ``` pip install consonance ``` ## Usage ### Configuration Before performing a handshake, you have to define your configuration as a WhatsApp client. This can be done by passing the configuration parameters to an instance of ```ClientConfig```. Normally this configuration includes details about the device WhatsApp is running on. Those device details are to be passed to ClientConfig's ```useragent``` parameters through an instance of ```consonance.config.useragent.UserAgentConfig```. In order to facilitate usage, templates for ```UserAgentConfig``` with some pre-set parameters exist under ```consonance/config/templates```. ```python from consonance.config.client import ClientConfig from consonance.config.templates.useragent_samsung_s9p import SamsungS9PUserAgentConfig import uuid client_config = ClientConfig( username=999999999, # username/phone number passive=True, # passive connection, you will not send any data after handshake, only receive useragent=SamsungS9PUserAgentConfig( app_version="2.19.51", # WhatsApp app version to pose as phone_id=str(uuid.uuid4()) # uuid that was used to register the aforementioned username ), pushname="consonance" # display name for push notifications ) ``` In addition to ```ClientConfig``` one must possess a KeyPair that'll be used in the handshake process and for authenticating yourself to WhatsApp. This KeyPair was produced and used during registration and therefore the same one has to be used here for a successful authentication. For testing purposes you could always generate a fresh KeyPair, in which case the handshake process would go through but authentication fails. ```python from consonance.structs.keypair import KeyPair import base64 keypair = KeyPair.generate() # or keypair used at registration, deserialized from concat. of private_bytes and public_bytes keypair = KeyPair.from_bytes( base64.b64decode(b"YJa8Vd9pG0KV2tDYi5V+DMOtSvCEFzRGCzOlGZkvBHzJvBE5C3oC2Fruniw0GBGo7HHgR4TjvjI3C9AihStsVg==") ) ``` ### Connect and Authenticate With your ```ClientConfig``` and ```KeyPair``` you can now attempt a login to WhatsApp. The example below will demonstrate a [XX](https://noiseprotocol.org/noise.html#interactive-handshake-patterns-fundamental) handshake since we are not specifying WhatsApp's static public key: ```python from consonance.protocol import WANoiseProtocol from consonance.streams.segmented.wa import WASegmentedStream from consonance.streams.arbitrary.arbitrary_socket import SocketArbitraryStream import socket wa_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) wa_socket.connect(("e1.whatsapp.net", 443)) # send WA header indicating protocol version wa_socket.send(b"WA\x02\x01") # use WASegmentedStream for sending/receiving in frames wa_socket_stream = WASegmentedStream(SocketArbitraryStream(wa_socket)) # initialize WANoiseProtocol 2.1 wa_noiseprotocol = WANoiseProtocol(2, 1) # start the protocol, this should perform a XX handshake since # we are not passing the remote static public key if wa_noiseprotocol.start(wa_socket_stream, client_config, keypair): print("Handshake completed, checking authentication...") # we are now in transport phase, first incoming data # will indicate whether we are authenticated first_transport_data = wa_noiseprotocol.receive() assert first_transport_data == 172 ``` - See [examples/walogin_handshake_xx.py](examples/walogin_handshake_xx.py) for the full ```XX``` handshake example. - See [examples/walogin_handshake_ik.py](examples/walogin_handshake_ik.py) for a ```IK``` handshake example. - See [examples/walogin_handshake_xxfallback.py](examples/walogin_handshake_xxfallback.py) for a ```XXfallback``` handshake example. - See [Interactive handshake patterns](https://noiseprotocol.org/noise.html#interactive-handshake-patterns-fundamental) and [Noise Pipes](https://noiseprotocol.org/noise.html#noise-pipes) from Noise for information about the handshake types used here. consonance-0.1.3/consonance/000077500000000000000000000000001347116303700157745ustar00rootroot00000000000000consonance-0.1.3/consonance/__init__.py000066400000000000000000000006241347116303700201070ustar00rootroot00000000000000import logging __version__ = "0.1.3" __author__ = "Tarek Galal" logger = logging.getLogger(__name__) # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter('%(levelname).1s %(asctime)s %(name)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) consonance-0.1.3/consonance/certman/000077500000000000000000000000001347116303700174255ustar00rootroot00000000000000consonance-0.1.3/consonance/certman/__init__.py000066400000000000000000000000001347116303700215240ustar00rootroot00000000000000consonance-0.1.3/consonance/certman/certman.py000066400000000000000000000040561347116303700214350ustar00rootroot00000000000000from dissononce.dh.x25519.x25519 import PublicKey from ..proto import wa20_pb2 import axolotl_curve25519 as curve import logging import time logger = logging.getLogger(__name__) class CertMan(object): def __init__(self): self._pubkeys = { "WhatsAppLongTerm1": bytearray( [20, 35, 117, 87, 77, 10, 88, 113, 102, 170, 231, 30, 190, 81, 100, 55, 196, 162, 139, 115, 227, 105, 92, 108, 225, 247, 249, 84, 93, 168, 238, 107]) } def is_valid(self, rs, certificate_data): """ :param rs: :type rs: PublicKey :param certificate_data: :type certificate_data: bytes :return: :rtype: """ cert = wa20_pb2.NoiseCertificate() cert.ParseFromString(certificate_data) cert_details = wa20_pb2.NoiseCertificate.Details() cert_details.ParseFromString(cert.details) logger.debug( "NoiseCertificate(signature=[%d bytes], serial=%d, issuer='%s', expires=%d, subject='%s', ""key=[%d bytes])" % ( len(cert.signature), cert_details.serial, cert_details.issuer, cert_details.expires, cert_details.subject, len(cert_details.key) ) ) if cert_details.issuer not in self._pubkeys: logger.error("noise certificate issued by unknown source: issuer=%s" % cert_details.issuer) return False if curve.verifySignature(bytes(self._pubkeys[cert_details.issuer]), cert.details, cert.signature) != 0: logger.error("invalid signature on noise ceritificate; issuer=%s" % cert_details.issuer) return False if cert_details.key != rs.data: logger.error("noise certificate key does not match proposed server static key; issuer=%s" % cert_details.issuer) return False if cert_details.HasField("expires") and cert_details.expires < int(time.time()): logger.error("noise certificate expired; issuer=%s" % cert_details.issuer) return False return True consonance-0.1.3/consonance/config/000077500000000000000000000000001347116303700172415ustar00rootroot00000000000000consonance-0.1.3/consonance/config/__init__.py000066400000000000000000000000001347116303700213400ustar00rootroot00000000000000consonance-0.1.3/consonance/config/appversion.py000066400000000000000000000015561347116303700220100ustar00rootroot00000000000000class AppVersionConfig(object): STR_TEMPLATE = """AppVersionConfig( primary={primary}, secondary={secondary}, tertiary={tertiary} )""" def __init__(self, version): """ :param version: :type version: str """ dissected = version.split('.') assert len(dissected) > 2, "version must be in format x.y.z" self._primary, self._secondary, self._tertiary = map(lambda v:int(v), dissected) def __str__(self): return self.STR_TEMPLATE.format( primary=self.primary, secondary=self.secondary, tertiary=self.tertiary ) @property def primary(self): return self._primary @property def secondary(self): return self._secondary @property def tertiary(self): return self._tertiary consonance-0.1.3/consonance/config/client.py000066400000000000000000000030111347116303700210640ustar00rootroot00000000000000from .useragent import UserAgentConfig class ClientConfig(object): STR_TEMPLATE = """ClientConfig( username={username}, passive={passive}, useragent={useragent}, pushname={pushname}, short_connect={short_connect} )""" def __init__(self, username, passive, useragent, pushname, short_connect=True, ): """ :param username: :type username: int :param passive: :type passive: bool :param useragent: :type useragent: UserAgentConfig :param pushname: :type pushname: str :param short_connect: :type short_connect: bool """ self._username = username self._passive = passive self._useragent = useragent self._pushname = pushname self._short_connect = short_connect def __str__(self): return self.STR_TEMPLATE.format( username=self.username, passive=self.passive, useragent=self.useragent, pushname=self.pushname, short_connect=self.short_connect ) @property def username(self): return self._username @property def passive(self): return self._passive @property def useragent(self): return self._useragent @property def pushname(self): return self._pushname @property def short_connect(self): return self._short_connect consonance-0.1.3/consonance/config/templates/000077500000000000000000000000001347116303700212375ustar00rootroot00000000000000consonance-0.1.3/consonance/config/templates/__init__.py000066400000000000000000000000001347116303700233360ustar00rootroot00000000000000consonance-0.1.3/consonance/config/templates/useragent_samsung_s9p.py000066400000000000000000000021361347116303700261400ustar00rootroot00000000000000from ..useragent import UserAgentConfig class SamsungS9PUserAgentConfig(UserAgentConfig): DEFAULT_LOCALE_LANG = 'en' DEFAULT_LOCALE_COUNTRY = 'US' DEFAULT_MCC = '000' DEFAULT_MNC = '000' OS_VERSION = "8.0.0" OS_BUILD_NUMBER = "star2ltexx-user 8.0.0 R16NW G965FXXU1ARCC release-keys" MANUFACTURER = "samsung" DEVICE = "star2lte" def __init__(self, app_version, phone_id, mcc=None, mnc=None, locale_lang=None, locale_country=None): super(SamsungS9PUserAgentConfig, self).__init__( platform=UserAgentConfig.PLATFORM_ANDROID, app_version=app_version, mcc=mcc or self.DEFAULT_MCC, mnc=mnc or self.DEFAULT_MNC, os_version=self.OS_VERSION, manufacturer=self.MANUFACTURER, device=self.DEVICE, os_build_number=self.OS_BUILD_NUMBER, phone_id=phone_id, locale_lang=locale_lang or self.DEFAULT_LOCALE_LANG, locale_country=locale_country or self.DEFAULT_LOCALE_COUNTRY ) consonance-0.1.3/consonance/config/templates/useragent_vbox.py000066400000000000000000000021031347116303700246400ustar00rootroot00000000000000from ..useragent import UserAgentConfig class VBoxUserAgentConfig(UserAgentConfig): DEFAULT_LOCALE_LANG = 'en' DEFAULT_LOCALE_COUNTRY = 'US' DEFAULT_MCC = '000' DEFAULT_MNC = '000' OS_VERSION = "5.0" OS_BUILD_NUMBER = "vbox86p-userdebug 5.0 LRX21M 233 test-keys" MANUFACTURER = "unknown" DEVICE = "vbox86p" def __init__(self, app_version, phone_id, mcc=None, mnc=None, locale_lang=None, locale_country=None): super(VBoxUserAgentConfig, self).__init__( platform=UserAgentConfig.PLATFORM_ANDROID, app_version=app_version, mcc=mcc or self.DEFAULT_MCC, mnc=mnc or self.DEFAULT_MNC, os_version=self.OS_VERSION, manufacturer=self.MANUFACTURER, device=self.DEVICE, os_build_number=self.OS_BUILD_NUMBER, phone_id=phone_id, locale_lang=locale_lang or self.DEFAULT_LOCALE_LANG, locale_country=locale_country or self.DEFAULT_LOCALE_COUNTRY ) consonance-0.1.3/consonance/config/useragent.py000066400000000000000000000063151347116303700216150ustar00rootroot00000000000000from .appversion import AppVersionConfig class UserAgentConfig(object): PLATFORM_ANDROID = 0 PLATFORM_IOS = 1 PLATFORM_WINDOWS_PHONE = 2 PLATFORM_PYTHON_CLIENT = 7 STR_TEMPLATE = """UserAgentConfig( platform={platform}, app_version={app_version}, mcc={mcc}, mnc={mnc}, os_version={os_version}, manufacturer={manufacturer}, device={device}, os_build_number={os_build_number}, phone_id={phone_id}, locale_lang={locale_lang}, locale_country={locale_country} )""" def __init__(self, platform, app_version, mcc, mnc, os_version, manufacturer, device, os_build_number, phone_id, locale_lang, locale_country ): """ :param platform: :type platform: int :param app_version: :type app_version: AppVersionConfig | str :param mcc: :type mcc: str :param mnc: :type mnc: str :param os_version: :type os_version: str :param manufacturer: :type manufacturer: str :param device: :type device: str :param os_build_number: :type os_build_number: :param phone_id: :type phone_id: :param locale_lang: :type locale_lang: str :param locale_country: :type locale_country: str """ if type(app_version) is str: app_version = AppVersionConfig(app_version) self._platform = platform self._app_version = app_version self._mcc = mcc self._mnc = mnc self._os_version = os_version self._manufacturer = manufacturer self._device = device self._os_build_number = os_build_number self._phone_id = phone_id self._locale_lang = locale_lang self._locale_country = locale_country def __str__(self): return self.STR_TEMPLATE.format( platform=self.platform, app_version=self.app_version, mcc=self.mcc, mnc=self.mnc, os_version=self.os_version, manufacturer=self.manufacturer, device=self.device, os_build_number=self.os_build_number, phone_id=self.phone_id, locale_lang=self.locale_lang, locale_country=self.locale_country ) @property def platform(self): return self._platform @property def app_version(self): return self._app_version @property def mcc(self): return self._mcc @property def mnc(self): return self._mnc @property def os_version(self): return self._os_version @property def manufacturer(self): return self._manufacturer @property def device(self): return self._device @property def os_build_number(self): return self._os_build_number @property def phone_id(self): return self._phone_id @property def locale_lang(self): return self._locale_lang @property def locale_country(self): return self._locale_country consonance-0.1.3/consonance/dissononce_extras/000077500000000000000000000000001347116303700215265ustar00rootroot00000000000000consonance-0.1.3/consonance/dissononce_extras/__init__.py000066400000000000000000000000001347116303700236250ustar00rootroot00000000000000consonance-0.1.3/consonance/dissononce_extras/processing/000077500000000000000000000000001347116303700237025ustar00rootroot00000000000000consonance-0.1.3/consonance/dissononce_extras/processing/__init__.py000066400000000000000000000000001347116303700260010ustar00rootroot00000000000000consonance-0.1.3/consonance/dissononce_extras/processing/symmetricstate_wa.py000066400000000000000000000007461347116303700300270ustar00rootroot00000000000000from dissononce.processing.impl.symmetricstate import SymmetricState class WASymmetricState(SymmetricState): """WA does not mix_hash if cipherstate does not yet have a key, therefore this custom WASymmetricState has to be used instead of default one.""" def encrypt_and_hash(self, plaintext): ciphertext = self._cipherstate.encrypt_with_ad(self._h, plaintext) if self._cipherstate.has_key(): self.mix_hash(ciphertext) return ciphertext consonance-0.1.3/consonance/exceptions/000077500000000000000000000000001347116303700201555ustar00rootroot00000000000000consonance-0.1.3/consonance/exceptions/__init__.py000066400000000000000000000000001347116303700222540ustar00rootroot00000000000000consonance-0.1.3/consonance/exceptions/handshake_failed_exception.py000066400000000000000000000000641347116303700260370ustar00rootroot00000000000000class HandshakeFailedException(Exception): pass consonance-0.1.3/consonance/exceptions/new_rs_exception.py000066400000000000000000000006131347116303700241020ustar00rootroot00000000000000from ..proto.wa20_pb2 import HandshakeMessage class NewRemoteStaticException(Exception): def __init__(self, server_hello): """ :param server_hello: :type server_hello: HandshakeMessage.ServerHello """ self._server_hello = server_hello # type: HandshakeMessage.ServerHello @property def server_hello(self): return self._server_hello consonance-0.1.3/consonance/handshake.py000066400000000000000000000270211347116303700202760ustar00rootroot00000000000000import random from dissononce.processing.impl.handshakestate import HandshakeState from dissononce.extras.processing.handshakestate_guarded import GuardedHandshakeState from dissononce.extras.processing.handshakestate_switchable import SwitchableHandshakeState from dissononce.processing.handshakepatterns.handshakepattern import HandshakePattern from dissononce.processing.handshakepatterns.interactive.IK import IKHandshakePattern from dissononce.processing.handshakepatterns.interactive.XX import XXHandshakePattern from dissononce.processing.modifiers.fallback import FallbackPatternModifier from dissononce.processing.impl.cipherstate import CipherState from dissononce.cipher.aesgcm import AESGCMCipher from dissononce.hash.sha256 import SHA256Hash from dissononce.dh.keypair import KeyPair from dissononce.dh.x25519.public import PublicKey from dissononce.dh.private import PrivateKey from dissononce.dh.x25519.x25519 import X25519DH from dissononce.extras.dh.dangerous.dh_nogen import NoGenDH from dissononce.exceptions.decrypt import DecryptFailedException from google.protobuf.message import DecodeError from .dissononce_extras.processing.symmetricstate_wa import WASymmetricState from .proto import wa20_pb2 from .streams.segmented.segmented import SegmentedStream from .certman.certman import CertMan from .exceptions.new_rs_exception import NewRemoteStaticException from .config.client import ClientConfig from .structs.publickey import PublicKey from .util.byte import ByteUtil from.exceptions.handshake_failed_exception import HandshakeFailedException import logging logger = logging.getLogger(__name__) class WAHandshake(object): def __init__(self, version_major, version_minor): self._prologue = b"WA" + bytearray([version_major, version_minor]) self._handshakestate = None # type: HandshakeState | None def perform(self, client_config, stream, s, rs=None, e=None): """ :param client_config: :type client_config: :param stream: :type stream: :param s: :type s: consonance.structs.keypair.KeyPair :param rs: :type rs: consonance.structs.publickey.PublicKey | None :type e: consonance.structs.keypair.KeyPair | None :return: :rtype: """ logger.debug("perform(client_config=%s, stream=%s, s=%s, rs=%s, e=%s)" % ( client_config, stream, s, rs, e )) dh = X25519DH() if e is not None: dh = NoGenDH(dh, PrivateKey(e.private.data)) self._handshakestate = SwitchableHandshakeState( GuardedHandshakeState( HandshakeState( WASymmetricState( CipherState( AESGCMCipher() ), SHA256Hash() ), dh ) ) ) # type: SwitchableHandshakeState dissononce_s = KeyPair( PublicKey(s.public.data), PrivateKey(s.private.data) ) dissononce_rs = PublicKey(rs.data) if rs else None client_payload = self._create_full_payload(client_config) logger.debug("Create client_payload=%s" % client_payload) try: if rs is not None: try: cipherstatepair = self._start_handshake_ik(stream, client_payload, dissononce_s, dissononce_rs) except NewRemoteStaticException as ex: cipherstatepair = self._switch_handshake_xxfallback(stream, dissononce_s, client_payload, ex.server_hello) else: cipherstatepair = self._start_handshake_xx(stream, client_payload, dissononce_s) return cipherstatepair except DecryptFailedException as e: logger.exception(e) raise HandshakeFailedException(e) except DecodeError as e: logger.exception(e) raise HandshakeFailedException(e) @property def rs(self): return PublicKey(self._handshakestate.rs.data) if self._handshakestate.rs else None def _start_handshake_xx(self, stream, client_payload, s): """ :param stream: :type stream: SegmentedStream :param client_payload: :type client_payload: :param s: :type s: KeyPair :return: :rtype: """ self._handshakestate.initialize( handshake_pattern=XXHandshakePattern(), initiator=True, prologue=self._prologue, s=s ) ephemeral_public = bytearray() self._handshakestate.write_message(b'', ephemeral_public) handshakemessage = wa20_pb2.HandshakeMessage() client_hello = wa20_pb2.HandshakeMessage.ClientHello() client_hello.ephemeral = bytes(ephemeral_public) handshakemessage.client_hello.MergeFrom(client_hello) stream.write_segment(handshakemessage.SerializeToString()) incoming_handshakemessage = wa20_pb2.HandshakeMessage() incoming_handshakemessage.ParseFromString(stream.read_segment()) if not incoming_handshakemessage.HasField("server_hello"): raise ValueError("Handshake message does not contain server hello!") server_hello = incoming_handshakemessage.server_hello payload_buffer = bytearray() self._handshakestate.read_message( server_hello.ephemeral + server_hello.static + server_hello.payload, payload_buffer ) certman = CertMan() if certman.is_valid(self._handshakestate.rs, bytes(payload_buffer)): logger.debug("cert is valid") else: logger.error("cert is not valid") message_buffer = bytearray() cipherpair = self._handshakestate.write_message(client_payload.SerializeToString(), message_buffer) static, payload = ByteUtil.split(bytes(message_buffer), 48, len(message_buffer) - 48) client_finish = wa20_pb2.HandshakeMessage.ClientFinish() client_finish.static = static client_finish.payload = payload outgoing_handshakemessage = wa20_pb2.HandshakeMessage() outgoing_handshakemessage.client_finish.MergeFrom(client_finish) stream.write_segment(outgoing_handshakemessage.SerializeToString()) return cipherpair def _start_handshake_ik(self, stream, client_payload, s, rs): """ :param stream: :type stream: SegmentedStream :param s: :type s: KeyPair :param rs: :type rs: PublicKey :return: :rtype: """ self._handshakestate.initialize( handshake_pattern=IKHandshakePattern(), initiator=True, prologue=self._prologue, s=s, rs=rs ) message_buffer = bytearray() self._handshakestate.write_message(client_payload.SerializeToString(), message_buffer) ephemeral_public, static_public, payload = ByteUtil.split(bytes(message_buffer), 32, 48, len(message_buffer) - 32 + 48) handshakemessage = wa20_pb2.HandshakeMessage() client_hello = wa20_pb2.HandshakeMessage.ClientHello() client_hello.ephemeral = ephemeral_public client_hello.static = static_public client_hello.payload = payload handshakemessage.client_hello.MergeFrom(client_hello) stream.write_segment(handshakemessage.SerializeToString()) incoming_handshakemessage = wa20_pb2.HandshakeMessage() incoming_handshakemessage.ParseFromString(stream.read_segment()) if not incoming_handshakemessage.HasField("server_hello"): raise HandshakeFailedException("Handshake message does not contain server hello!") server_hello = incoming_handshakemessage.server_hello if server_hello.HasField("static"): raise NewRemoteStaticException(server_hello) payload_buffer = bytearray() return self._handshakestate.read_message( server_hello.ephemeral + server_hello.static + server_hello.payload, payload_buffer ) def _switch_handshake_xxfallback(self, stream, s, client_payload, server_hello): """ :param handshake_pattern: :type handshake_pattern: HandshakePattern :param stream: :type stream: SegmentedStream :param s: :type s: KeyPair :param e: :type e: KeyPair :param client_payload: :type client_payload: :param server_hello: :type server_hello: :return: :rtype: tuple(CipherState,CipherState) """ self._handshakestate.switch( handshake_pattern=FallbackPatternModifier().modify(XXHandshakePattern()), initiator=True, prologue=self._prologue, s=s ) payload_buffer = bytearray() self._handshakestate.read_message(server_hello.ephemeral + server_hello.static + server_hello.payload, payload_buffer) certman = CertMan() if certman.is_valid(self._handshakestate.rs, bytes(payload_buffer)): logger.debug("cert is valid") else: logger.error("cert is not valid") message_buffer = bytearray() cipherpair = self._handshakestate.write_message(client_payload.SerializeToString(), message_buffer) static, payload = ByteUtil.split(bytes(message_buffer), 48, len(message_buffer) - 48) client_finish = wa20_pb2.HandshakeMessage.ClientFinish() client_finish.static = static client_finish.payload = payload outgoing_handshakemessage = wa20_pb2.HandshakeMessage() outgoing_handshakemessage.client_finish.MergeFrom(client_finish) stream.write_segment(outgoing_handshakemessage.SerializeToString()) return cipherpair def _create_full_payload(self, client_config): """ :param client_config: :type client_config: ClientConfig :return: :rtype: wa20_pb2.ClientPayload """ client_payload = wa20_pb2.ClientPayload() user_agent = wa20_pb2.ClientPayload.UserAgent() user_agent_app_version = wa20_pb2.ClientPayload.UserAgent.AppVersion() user_agent.platform = client_config.useragent.platform user_agent.mcc = client_config.useragent.mcc user_agent.mnc = client_config.useragent.mnc user_agent.os_version = client_config.useragent.os_version user_agent.manufacturer = client_config.useragent.manufacturer user_agent.device = client_config.useragent.device user_agent.os_build_number = client_config.useragent.os_build_number user_agent.phone_id = client_config.useragent.phone_id user_agent.locale_language_iso_639_1 = client_config.useragent.locale_lang user_agent.locale_country_iso_3166_1_alpha_2 = client_config.useragent.locale_country user_agent_app_version.primary = client_config.useragent.app_version.primary user_agent_app_version.secondary = client_config.useragent.app_version.secondary user_agent_app_version.tertiary = client_config.useragent.app_version.tertiary user_agent.app_version.MergeFrom(user_agent_app_version) client_payload.username = client_config.username client_payload.passive = client_config.passive client_payload.push_name = client_config.pushname max_int = (2**32) / 2 client_payload.session_id = random.randint(-max_int, max_int-1) client_payload.short_connect = client_config.short_connect client_payload.connect_type = 1 client_payload.user_agent.MergeFrom(user_agent) return client_payload consonance-0.1.3/consonance/proto/000077500000000000000000000000001347116303700171375ustar00rootroot00000000000000consonance-0.1.3/consonance/proto/__init__.py000066400000000000000000000000001347116303700212360ustar00rootroot00000000000000consonance-0.1.3/consonance/proto/wa20_pb2.py000066400000000000000000001405411347116303700210320ustar00rootroot00000000000000# Generated by the protocol buffer compiler. DO NOT EDIT! # source: wa20.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='wa20.proto', package='', syntax='proto2', serialized_options=None, serialized_pb=_b('\n\nwa20.proto\"\x97\x11\n\rClientPayload\x12\x10\n\x08username\x18\x01 \x01(\x04\x12\x0f\n\x07passive\x18\x03 \x01(\x08\x12\x35\n\x0f\x63lient_features\x18\x04 \x03(\x0e\x32\x1c.ClientPayload.ClientFeature\x12,\n\nuser_agent\x18\x05 \x01(\x0b\x32\x18.ClientPayload.UserAgent\x12(\n\x08web_info\x18\x06 \x01(\x0b\x32\x16.ClientPayload.WebInfo\x12\x11\n\tpush_name\x18\x07 \x01(\t\x12\x12\n\nsession_id\x18\t \x01(\x0f\x12\x15\n\rshort_connect\x18\n \x01(\x08\x12\x30\n\x0c\x63onnect_type\x18\x0c \x01(\x0e\x32\x1a.ClientPayload.ConnectType\x12\x34\n\x0e\x63onnect_reason\x18\r \x01(\x0e\x32\x1c.ClientPayload.ConnectReason\x12\x0e\n\x06shards\x18\x0e \x03(\x0f\x12,\n\ndns_source\x18\x0f \x01(\x0b\x32\x18.ClientPayload.DnsSource\x12\x1d\n\x15\x63onnect_attempt_count\x18\x10 \x01(\x0f\x12\x39\n\x11ios_app_extension\x18\x1e \x01(\x0e\x32\x1e.ClientPayload.IosAppExtension\x1a\x9a\x01\n\tDnsSource\x12\x35\n\tdnsMethod\x18\x0f \x01(\x0e\x32\".ClientPayload.DnsSource.DnsMethod\x12\x11\n\tappCached\x18\x10 \x01(\x08\"C\n\tDnsMethod\x12\x0c\n\x08METHOD_0\x10\x00\x12\x0c\n\x08METHOD_1\x10\x01\x12\x0c\n\x08METHOD_2\x10\x02\x12\x0c\n\x08METHOD_3\x10\x03\x1a\xeb\x05\n\tUserAgent\x12<\n\x08platform\x18\x01 \x01(\x0e\x32!.ClientPayload.UserAgent.Platform:\x07\x41NDROID\x12\x38\n\x0b\x61pp_version\x18\x02 \x01(\x0b\x32#.ClientPayload.UserAgent.AppVersion\x12\x0b\n\x03mcc\x18\x03 \x01(\t\x12\x0b\n\x03mnc\x18\x04 \x01(\t\x12\x12\n\nos_version\x18\x05 \x01(\t\x12\x14\n\x0cmanufacturer\x18\x06 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x07 \x01(\t\x12\x17\n\x0fos_build_number\x18\x08 \x01(\t\x12\x10\n\x08phone_id\x18\t \x01(\t\x12I\n\x0frelease_channel\x18\n \x01(\x0e\x32\'.ClientPayload.UserAgent.ReleaseChannel:\x07RELEASE\x12!\n\x19locale_language_iso_639_1\x18\x0b \x01(\t\x12)\n!locale_country_iso_3166_1_alpha_2\x18\x0c \x01(\t\x1aV\n\nAppVersion\x12\x0f\n\x07primary\x18\x01 \x01(\r\x12\x11\n\tsecondary\x18\x02 \x01(\r\x12\x10\n\x08tertiary\x18\x03 \x01(\r\x12\x12\n\nquaternary\x18\x04 \x01(\r\"\xb6\x01\n\x08Platform\x12\x0b\n\x07\x41NDROID\x10\x00\x12\x07\n\x03IOS\x10\x01\x12\x11\n\rWINDOWS_PHONE\x10\x02\x12\x0e\n\nBLACKBERRY\x10\x03\x12\x0f\n\x0b\x42LACKBERRYX\x10\x04\x12\x07\n\x03S40\x10\x05\x12\x07\n\x03S60\x10\x06\x12\x11\n\rPYTHON_CLIENT\x10\x07\x12\t\n\x05TIZEN\x10\x08\x12\x0e\n\nENTERPRISE\x10\t\x12\x0f\n\x0bPLATFORM_10\x10\n\x12\x0f\n\x0bPLATFORM_11\x10\x0b\"=\n\x0eReleaseChannel\x12\x0b\n\x07RELEASE\x10\x00\x12\x08\n\x04\x42\x45TA\x10\x01\x12\t\n\x05\x41LPHA\x10\x02\x12\t\n\x05\x44\x45\x42UG\x10\x03\x1a\xa7\x03\n\x07WebInfo\x12\x11\n\tref_token\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x38\n\x0cwebd_payload\x18\x03 \x01(\x0b\x32\".ClientPayload.WebInfo.WebdPayload\x1a\xbd\x02\n\x0bWebdPayload\x12\x1f\n\x17uses_participant_in_key\x18\x01 \x01(\x08\x12!\n\x19supports_starred_messages\x18\x02 \x01(\x08\x12\"\n\x1asupports_document_messages\x18\x03 \x01(\x08\x12\x1d\n\x15supports_url_messages\x18\x04 \x01(\x08\x12\x1c\n\x14supports_media_retry\x18\x05 \x01(\x08\x12\x1a\n\x12supports_e2e_image\x18\x06 \x01(\x08\x12\x1a\n\x12supports_e2e_video\x18\x07 \x01(\x08\x12\x1a\n\x12supports_e2e_audio\x18\x08 \x01(\x08\x12\x1d\n\x15supports_e2e_document\x18\t \x01(\x08\x12\x16\n\x0e\x64ocument_types\x18\n \x01(\t\"\x19\n\rClientFeature\x12\x08\n\x04NONE\x10\x00\"\xac\x01\n\x0b\x43onnectType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04WIFI\x10\x01\x12\x08\n\x04\x45\x44GE\x10\x64\x12\x08\n\x04IDEN\x10\x65\x12\x08\n\x04UMTS\x10\x66\x12\x08\n\x04\x45VDO\x10g\x12\x08\n\x04GPRS\x10h\x12\t\n\x05HSDPA\x10i\x12\t\n\x05HSUPA\x10j\x12\x08\n\x04HSPA\x10k\x12\x08\n\x04\x43\x44MA\x10l\x12\x0b\n\x07ONExRTT\x10m\x12\t\n\x05\x45HRPD\x10n\x12\x07\n\x03LTE\x10o\x12\t\n\x05HSPAP\x10p\"c\n\rConnectReason\x12\x0c\n\x08REASON_0\x10\x00\x12\x0c\n\x08REASON_1\x10\x01\x12\x0c\n\x08REASON_2\x10\x02\x12\x0c\n\x08REASON_3\x10\x03\x12\x0c\n\x08REASON_4\x10\x04\x12\x0c\n\x08REASON_5\x10\x06\"2\n\x0fIosAppExtension\x12\t\n\x05\x45XT_0\x10\x00\x12\t\n\x05\x45XT_1\x10\x01\x12\t\n\x05\x45XT_2\x10\x02\"\xea\x02\n\x10HandshakeMessage\x12\x33\n\x0c\x63lient_hello\x18\x02 \x01(\x0b\x32\x1d.HandshakeMessage.ClientHello\x12\x33\n\x0cserver_hello\x18\x03 \x01(\x0b\x32\x1d.HandshakeMessage.ServerHello\x12\x35\n\rclient_finish\x18\x04 \x01(\x0b\x32\x1e.HandshakeMessage.ClientFinish\x1a\x41\n\x0b\x43lientHello\x12\x11\n\tephemeral\x18\x01 \x01(\x0c\x12\x0e\n\x06static\x18\x02 \x01(\x0c\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x1a\x41\n\x0bServerHello\x12\x11\n\tephemeral\x18\x01 \x01(\x0c\x12\x0e\n\x06static\x18\x02 \x01(\x0c\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x1a/\n\x0c\x43lientFinish\x12\x0e\n\x06static\x18\x01 \x01(\x0c\x12\x0f\n\x07payload\x18\x02 \x01(\x0c\"\x90\x01\n\x10NoiseCertificate\x12\x0f\n\x07\x64\x65tails\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x1aX\n\x07\x44\x65tails\x12\x0e\n\x06serial\x18\x01 \x01(\r\x12\x0e\n\x06issuer\x18\x02 \x01(\t\x12\x0f\n\x07\x65xpires\x18\x03 \x01(\x04\x12\x0f\n\x07subject\x18\x04 \x01(\t\x12\x0b\n\x03key\x18\x05 \x01(\x0c') ) _CLIENTPAYLOAD_DNSSOURCE_DNSMETHOD = _descriptor.EnumDescriptor( name='DnsMethod', full_name='ClientPayload.DnsSource.DnsMethod', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='METHOD_0', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='METHOD_1', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='METHOD_2', index=2, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='METHOD_3', index=3, number=3, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=616, serialized_end=683, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_DNSSOURCE_DNSMETHOD) _CLIENTPAYLOAD_USERAGENT_PLATFORM = _descriptor.EnumDescriptor( name='Platform', full_name='ClientPayload.UserAgent.Platform', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='ANDROID', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='IOS', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='WINDOWS_PHONE', index=2, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='BLACKBERRY', index=3, number=3, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='BLACKBERRYX', index=4, number=4, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='S40', index=5, number=5, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='S60', index=6, number=6, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='PYTHON_CLIENT', index=7, number=7, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='TIZEN', index=8, number=8, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ENTERPRISE', index=9, number=9, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='PLATFORM_10', index=10, number=10, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='PLATFORM_11', index=11, number=11, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=1188, serialized_end=1370, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_USERAGENT_PLATFORM) _CLIENTPAYLOAD_USERAGENT_RELEASECHANNEL = _descriptor.EnumDescriptor( name='ReleaseChannel', full_name='ClientPayload.UserAgent.ReleaseChannel', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='RELEASE', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='BETA', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ALPHA', index=2, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='DEBUG', index=3, number=3, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=1372, serialized_end=1433, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_USERAGENT_RELEASECHANNEL) _CLIENTPAYLOAD_CLIENTFEATURE = _descriptor.EnumDescriptor( name='ClientFeature', full_name='ClientPayload.ClientFeature', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='NONE', index=0, number=0, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=1861, serialized_end=1886, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_CLIENTFEATURE) _CLIENTPAYLOAD_CONNECTTYPE = _descriptor.EnumDescriptor( name='ConnectType', full_name='ClientPayload.ConnectType', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='UNKNOWN', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='WIFI', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='EDGE', index=2, number=100, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='IDEN', index=3, number=101, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='UMTS', index=4, number=102, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='EVDO', index=5, number=103, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='GPRS', index=6, number=104, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='HSDPA', index=7, number=105, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='HSUPA', index=8, number=106, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='HSPA', index=9, number=107, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='CDMA', index=10, number=108, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ONExRTT', index=11, number=109, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='EHRPD', index=12, number=110, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='LTE', index=13, number=111, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='HSPAP', index=14, number=112, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=1889, serialized_end=2061, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_CONNECTTYPE) _CLIENTPAYLOAD_CONNECTREASON = _descriptor.EnumDescriptor( name='ConnectReason', full_name='ClientPayload.ConnectReason', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='REASON_0', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REASON_1', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REASON_2', index=2, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REASON_3', index=3, number=3, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REASON_4', index=4, number=4, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REASON_5', index=5, number=6, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=2063, serialized_end=2162, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_CONNECTREASON) _CLIENTPAYLOAD_IOSAPPEXTENSION = _descriptor.EnumDescriptor( name='IosAppExtension', full_name='ClientPayload.IosAppExtension', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='EXT_0', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='EXT_1', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='EXT_2', index=2, number=2, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=2164, serialized_end=2214, ) _sym_db.RegisterEnumDescriptor(_CLIENTPAYLOAD_IOSAPPEXTENSION) _CLIENTPAYLOAD_DNSSOURCE = _descriptor.Descriptor( name='DnsSource', full_name='ClientPayload.DnsSource', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='dnsMethod', full_name='ClientPayload.DnsSource.dnsMethod', index=0, number=15, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='appCached', full_name='ClientPayload.DnsSource.appCached', index=1, number=16, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _CLIENTPAYLOAD_DNSSOURCE_DNSMETHOD, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=529, serialized_end=683, ) _CLIENTPAYLOAD_USERAGENT_APPVERSION = _descriptor.Descriptor( name='AppVersion', full_name='ClientPayload.UserAgent.AppVersion', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='primary', full_name='ClientPayload.UserAgent.AppVersion.primary', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='secondary', full_name='ClientPayload.UserAgent.AppVersion.secondary', index=1, number=2, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='tertiary', full_name='ClientPayload.UserAgent.AppVersion.tertiary', index=2, number=3, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='quaternary', full_name='ClientPayload.UserAgent.AppVersion.quaternary', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1099, serialized_end=1185, ) _CLIENTPAYLOAD_USERAGENT = _descriptor.Descriptor( name='UserAgent', full_name='ClientPayload.UserAgent', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='platform', full_name='ClientPayload.UserAgent.platform', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='app_version', full_name='ClientPayload.UserAgent.app_version', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='mcc', full_name='ClientPayload.UserAgent.mcc', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='mnc', full_name='ClientPayload.UserAgent.mnc', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='os_version', full_name='ClientPayload.UserAgent.os_version', index=4, number=5, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='manufacturer', full_name='ClientPayload.UserAgent.manufacturer', index=5, number=6, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='device', full_name='ClientPayload.UserAgent.device', index=6, number=7, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='os_build_number', full_name='ClientPayload.UserAgent.os_build_number', index=7, number=8, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='phone_id', full_name='ClientPayload.UserAgent.phone_id', index=8, number=9, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='release_channel', full_name='ClientPayload.UserAgent.release_channel', index=9, number=10, type=14, cpp_type=8, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='locale_language_iso_639_1', full_name='ClientPayload.UserAgent.locale_language_iso_639_1', index=10, number=11, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='locale_country_iso_3166_1_alpha_2', full_name='ClientPayload.UserAgent.locale_country_iso_3166_1_alpha_2', index=11, number=12, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_CLIENTPAYLOAD_USERAGENT_APPVERSION, ], enum_types=[ _CLIENTPAYLOAD_USERAGENT_PLATFORM, _CLIENTPAYLOAD_USERAGENT_RELEASECHANNEL, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=686, serialized_end=1433, ) _CLIENTPAYLOAD_WEBINFO_WEBDPAYLOAD = _descriptor.Descriptor( name='WebdPayload', full_name='ClientPayload.WebInfo.WebdPayload', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='uses_participant_in_key', full_name='ClientPayload.WebInfo.WebdPayload.uses_participant_in_key', index=0, number=1, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_starred_messages', full_name='ClientPayload.WebInfo.WebdPayload.supports_starred_messages', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_document_messages', full_name='ClientPayload.WebInfo.WebdPayload.supports_document_messages', index=2, number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_url_messages', full_name='ClientPayload.WebInfo.WebdPayload.supports_url_messages', index=3, number=4, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_media_retry', full_name='ClientPayload.WebInfo.WebdPayload.supports_media_retry', index=4, number=5, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_e2e_image', full_name='ClientPayload.WebInfo.WebdPayload.supports_e2e_image', index=5, number=6, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_e2e_video', full_name='ClientPayload.WebInfo.WebdPayload.supports_e2e_video', index=6, number=7, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_e2e_audio', full_name='ClientPayload.WebInfo.WebdPayload.supports_e2e_audio', index=7, number=8, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='supports_e2e_document', full_name='ClientPayload.WebInfo.WebdPayload.supports_e2e_document', index=8, number=9, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='document_types', full_name='ClientPayload.WebInfo.WebdPayload.document_types', index=9, number=10, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1542, serialized_end=1859, ) _CLIENTPAYLOAD_WEBINFO = _descriptor.Descriptor( name='WebInfo', full_name='ClientPayload.WebInfo', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='ref_token', full_name='ClientPayload.WebInfo.ref_token', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='version', full_name='ClientPayload.WebInfo.version', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='webd_payload', full_name='ClientPayload.WebInfo.webd_payload', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_CLIENTPAYLOAD_WEBINFO_WEBDPAYLOAD, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1436, serialized_end=1859, ) _CLIENTPAYLOAD = _descriptor.Descriptor( name='ClientPayload', full_name='ClientPayload', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='username', full_name='ClientPayload.username', index=0, number=1, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='passive', full_name='ClientPayload.passive', index=1, number=3, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='client_features', full_name='ClientPayload.client_features', index=2, number=4, type=14, cpp_type=8, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='user_agent', full_name='ClientPayload.user_agent', index=3, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='web_info', full_name='ClientPayload.web_info', index=4, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='push_name', full_name='ClientPayload.push_name', index=5, number=7, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='session_id', full_name='ClientPayload.session_id', index=6, number=9, type=15, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='short_connect', full_name='ClientPayload.short_connect', index=7, number=10, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='connect_type', full_name='ClientPayload.connect_type', index=8, number=12, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='connect_reason', full_name='ClientPayload.connect_reason', index=9, number=13, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='shards', full_name='ClientPayload.shards', index=10, number=14, type=15, cpp_type=1, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='dns_source', full_name='ClientPayload.dns_source', index=11, number=15, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='connect_attempt_count', full_name='ClientPayload.connect_attempt_count', index=12, number=16, type=15, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='ios_app_extension', full_name='ClientPayload.ios_app_extension', index=13, number=30, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_CLIENTPAYLOAD_DNSSOURCE, _CLIENTPAYLOAD_USERAGENT, _CLIENTPAYLOAD_WEBINFO, ], enum_types=[ _CLIENTPAYLOAD_CLIENTFEATURE, _CLIENTPAYLOAD_CONNECTTYPE, _CLIENTPAYLOAD_CONNECTREASON, _CLIENTPAYLOAD_IOSAPPEXTENSION, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=15, serialized_end=2214, ) _HANDSHAKEMESSAGE_CLIENTHELLO = _descriptor.Descriptor( name='ClientHello', full_name='HandshakeMessage.ClientHello', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='ephemeral', full_name='HandshakeMessage.ClientHello.ephemeral', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='static', full_name='HandshakeMessage.ClientHello.static', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='payload', full_name='HandshakeMessage.ClientHello.payload', index=2, number=3, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2398, serialized_end=2463, ) _HANDSHAKEMESSAGE_SERVERHELLO = _descriptor.Descriptor( name='ServerHello', full_name='HandshakeMessage.ServerHello', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='ephemeral', full_name='HandshakeMessage.ServerHello.ephemeral', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='static', full_name='HandshakeMessage.ServerHello.static', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='payload', full_name='HandshakeMessage.ServerHello.payload', index=2, number=3, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2465, serialized_end=2530, ) _HANDSHAKEMESSAGE_CLIENTFINISH = _descriptor.Descriptor( name='ClientFinish', full_name='HandshakeMessage.ClientFinish', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='static', full_name='HandshakeMessage.ClientFinish.static', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='payload', full_name='HandshakeMessage.ClientFinish.payload', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2532, serialized_end=2579, ) _HANDSHAKEMESSAGE = _descriptor.Descriptor( name='HandshakeMessage', full_name='HandshakeMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='client_hello', full_name='HandshakeMessage.client_hello', index=0, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='server_hello', full_name='HandshakeMessage.server_hello', index=1, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='client_finish', full_name='HandshakeMessage.client_finish', index=2, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_HANDSHAKEMESSAGE_CLIENTHELLO, _HANDSHAKEMESSAGE_SERVERHELLO, _HANDSHAKEMESSAGE_CLIENTFINISH, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2217, serialized_end=2579, ) _NOISECERTIFICATE_DETAILS = _descriptor.Descriptor( name='Details', full_name='NoiseCertificate.Details', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='serial', full_name='NoiseCertificate.Details.serial', index=0, number=1, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='issuer', full_name='NoiseCertificate.Details.issuer', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='expires', full_name='NoiseCertificate.Details.expires', index=2, number=3, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='subject', full_name='NoiseCertificate.Details.subject', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='key', full_name='NoiseCertificate.Details.key', index=4, number=5, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2638, serialized_end=2726, ) _NOISECERTIFICATE = _descriptor.Descriptor( name='NoiseCertificate', full_name='NoiseCertificate', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='details', full_name='NoiseCertificate.details', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='signature', full_name='NoiseCertificate.signature', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_NOISECERTIFICATE_DETAILS, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2582, serialized_end=2726, ) _CLIENTPAYLOAD_DNSSOURCE.fields_by_name['dnsMethod'].enum_type = _CLIENTPAYLOAD_DNSSOURCE_DNSMETHOD _CLIENTPAYLOAD_DNSSOURCE.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD_DNSSOURCE_DNSMETHOD.containing_type = _CLIENTPAYLOAD_DNSSOURCE _CLIENTPAYLOAD_USERAGENT_APPVERSION.containing_type = _CLIENTPAYLOAD_USERAGENT _CLIENTPAYLOAD_USERAGENT.fields_by_name['platform'].enum_type = _CLIENTPAYLOAD_USERAGENT_PLATFORM _CLIENTPAYLOAD_USERAGENT.fields_by_name['app_version'].message_type = _CLIENTPAYLOAD_USERAGENT_APPVERSION _CLIENTPAYLOAD_USERAGENT.fields_by_name['release_channel'].enum_type = _CLIENTPAYLOAD_USERAGENT_RELEASECHANNEL _CLIENTPAYLOAD_USERAGENT.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD_USERAGENT_PLATFORM.containing_type = _CLIENTPAYLOAD_USERAGENT _CLIENTPAYLOAD_USERAGENT_RELEASECHANNEL.containing_type = _CLIENTPAYLOAD_USERAGENT _CLIENTPAYLOAD_WEBINFO_WEBDPAYLOAD.containing_type = _CLIENTPAYLOAD_WEBINFO _CLIENTPAYLOAD_WEBINFO.fields_by_name['webd_payload'].message_type = _CLIENTPAYLOAD_WEBINFO_WEBDPAYLOAD _CLIENTPAYLOAD_WEBINFO.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD.fields_by_name['client_features'].enum_type = _CLIENTPAYLOAD_CLIENTFEATURE _CLIENTPAYLOAD.fields_by_name['user_agent'].message_type = _CLIENTPAYLOAD_USERAGENT _CLIENTPAYLOAD.fields_by_name['web_info'].message_type = _CLIENTPAYLOAD_WEBINFO _CLIENTPAYLOAD.fields_by_name['connect_type'].enum_type = _CLIENTPAYLOAD_CONNECTTYPE _CLIENTPAYLOAD.fields_by_name['connect_reason'].enum_type = _CLIENTPAYLOAD_CONNECTREASON _CLIENTPAYLOAD.fields_by_name['dns_source'].message_type = _CLIENTPAYLOAD_DNSSOURCE _CLIENTPAYLOAD.fields_by_name['ios_app_extension'].enum_type = _CLIENTPAYLOAD_IOSAPPEXTENSION _CLIENTPAYLOAD_CLIENTFEATURE.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD_CONNECTTYPE.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD_CONNECTREASON.containing_type = _CLIENTPAYLOAD _CLIENTPAYLOAD_IOSAPPEXTENSION.containing_type = _CLIENTPAYLOAD _HANDSHAKEMESSAGE_CLIENTHELLO.containing_type = _HANDSHAKEMESSAGE _HANDSHAKEMESSAGE_SERVERHELLO.containing_type = _HANDSHAKEMESSAGE _HANDSHAKEMESSAGE_CLIENTFINISH.containing_type = _HANDSHAKEMESSAGE _HANDSHAKEMESSAGE.fields_by_name['client_hello'].message_type = _HANDSHAKEMESSAGE_CLIENTHELLO _HANDSHAKEMESSAGE.fields_by_name['server_hello'].message_type = _HANDSHAKEMESSAGE_SERVERHELLO _HANDSHAKEMESSAGE.fields_by_name['client_finish'].message_type = _HANDSHAKEMESSAGE_CLIENTFINISH _NOISECERTIFICATE_DETAILS.containing_type = _NOISECERTIFICATE DESCRIPTOR.message_types_by_name['ClientPayload'] = _CLIENTPAYLOAD DESCRIPTOR.message_types_by_name['HandshakeMessage'] = _HANDSHAKEMESSAGE DESCRIPTOR.message_types_by_name['NoiseCertificate'] = _NOISECERTIFICATE _sym_db.RegisterFileDescriptor(DESCRIPTOR) ClientPayload = _reflection.GeneratedProtocolMessageType('ClientPayload', (_message.Message,), dict( DnsSource = _reflection.GeneratedProtocolMessageType('DnsSource', (_message.Message,), dict( DESCRIPTOR = _CLIENTPAYLOAD_DNSSOURCE, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload.DnsSource) )) , UserAgent = _reflection.GeneratedProtocolMessageType('UserAgent', (_message.Message,), dict( AppVersion = _reflection.GeneratedProtocolMessageType('AppVersion', (_message.Message,), dict( DESCRIPTOR = _CLIENTPAYLOAD_USERAGENT_APPVERSION, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload.UserAgent.AppVersion) )) , DESCRIPTOR = _CLIENTPAYLOAD_USERAGENT, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload.UserAgent) )) , WebInfo = _reflection.GeneratedProtocolMessageType('WebInfo', (_message.Message,), dict( WebdPayload = _reflection.GeneratedProtocolMessageType('WebdPayload', (_message.Message,), dict( DESCRIPTOR = _CLIENTPAYLOAD_WEBINFO_WEBDPAYLOAD, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload.WebInfo.WebdPayload) )) , DESCRIPTOR = _CLIENTPAYLOAD_WEBINFO, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload.WebInfo) )) , DESCRIPTOR = _CLIENTPAYLOAD, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:ClientPayload) )) _sym_db.RegisterMessage(ClientPayload) _sym_db.RegisterMessage(ClientPayload.DnsSource) _sym_db.RegisterMessage(ClientPayload.UserAgent) _sym_db.RegisterMessage(ClientPayload.UserAgent.AppVersion) _sym_db.RegisterMessage(ClientPayload.WebInfo) _sym_db.RegisterMessage(ClientPayload.WebInfo.WebdPayload) HandshakeMessage = _reflection.GeneratedProtocolMessageType('HandshakeMessage', (_message.Message,), dict( ClientHello = _reflection.GeneratedProtocolMessageType('ClientHello', (_message.Message,), dict( DESCRIPTOR = _HANDSHAKEMESSAGE_CLIENTHELLO, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:HandshakeMessage.ClientHello) )) , ServerHello = _reflection.GeneratedProtocolMessageType('ServerHello', (_message.Message,), dict( DESCRIPTOR = _HANDSHAKEMESSAGE_SERVERHELLO, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:HandshakeMessage.ServerHello) )) , ClientFinish = _reflection.GeneratedProtocolMessageType('ClientFinish', (_message.Message,), dict( DESCRIPTOR = _HANDSHAKEMESSAGE_CLIENTFINISH, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:HandshakeMessage.ClientFinish) )) , DESCRIPTOR = _HANDSHAKEMESSAGE, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:HandshakeMessage) )) _sym_db.RegisterMessage(HandshakeMessage) _sym_db.RegisterMessage(HandshakeMessage.ClientHello) _sym_db.RegisterMessage(HandshakeMessage.ServerHello) _sym_db.RegisterMessage(HandshakeMessage.ClientFinish) NoiseCertificate = _reflection.GeneratedProtocolMessageType('NoiseCertificate', (_message.Message,), dict( Details = _reflection.GeneratedProtocolMessageType('Details', (_message.Message,), dict( DESCRIPTOR = _NOISECERTIFICATE_DETAILS, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:NoiseCertificate.Details) )) , DESCRIPTOR = _NOISECERTIFICATE, __module__ = 'wa20_pb2' # @@protoc_insertion_point(class_scope:NoiseCertificate) )) _sym_db.RegisterMessage(NoiseCertificate) _sym_db.RegisterMessage(NoiseCertificate.Details) # @@protoc_insertion_point(module_scope) consonance-0.1.3/consonance/protocol.py000066400000000000000000000072571347116303700202220ustar00rootroot00000000000000from .config.client import ClientConfig from .handshake import WAHandshake from .streams.segmented.segmented import SegmentedStream from .transport import WANoiseTransport from .exceptions.handshake_failed_exception import HandshakeFailedException from transitions import Machine class WANoiseProtocol(object): STATE_INIT = 'init' STATE_HANDSHAKE = 'handshake' STATE_TRANSPORT = 'transport' STATE_ERROR = 'error' STATES = [ STATE_INIT, STATE_HANDSHAKE, STATE_TRANSPORT, STATE_ERROR ] TRANSITIONS = [ ['start', STATE_INIT, STATE_HANDSHAKE], ['finish', STATE_HANDSHAKE, STATE_TRANSPORT], ['fail', STATE_HANDSHAKE, STATE_ERROR], ['fail', STATE_TRANSPORT, STATE_ERROR], ['reset', STATE_INIT, '='], ['reset', STATE_TRANSPORT, STATE_INIT], ['reset', STATE_HANDSHAKE, STATE_INIT], ['reset', 'error', STATE_INIT], ['send', STATE_TRANSPORT, '='], ['receive', STATE_TRANSPORT, '='], ['start', STATE_ERROR, STATE_HANDSHAKE] ] def __init__(self, version_major, version_minor, protocol_state_callbacks=None): """ :param version_major: :type version_major: int :param version_minor: :type version_minor: int :param datastream :type datastream SegmentedStream """ self._version_major = version_major self._version_minor = version_minor self._protocol_state_callbacks = protocol_state_callbacks self._rs = None self._machine = Machine( states=self.STATES, transitions=self.TRANSITIONS, initial='init', after_state_change=self._trigger_state_callback ) # type: Machine self._transport = None # type: WANoiseTransport self._last_triggered_state = None def _trigger_state_callback(self): if self._protocol_state_callbacks is not None and self._last_triggered_state != self._machine.state: self._last_triggered_state = self._machine.state self._protocol_state_callbacks(self._machine.state) @property def state(self): return self._machine.state @property def rs(self): return self._rs def start(self, stream, client_config, s, rs=None): """ :param stream :type stream: SegmentedStream :param client_config: :type client_config: ClientConfig :return: :rtype: :param s: :type s: consonance.structs.keypair.KeyPair :param rs: :type rs: consonance.structs.publickey.PublicKey """ self._machine.start() handshake = WAHandshake(self._version_major, self._version_minor) try: result = handshake.perform(client_config, stream, s, rs) if result is not None: self._rs = handshake.rs self._transport = WANoiseTransport(stream, result[0], result[1]) self._machine.finish() else: raise HandshakeFailedException("No cipherstates") except HandshakeFailedException as e: self._machine.fail() raise def reset(self): self._machine.reset() self._transport = None def send(self, data): """ :param data: :type data: bytes :param datastream :type SegmentedDataStream :return: :rtype: """ self._machine.send() self._transport.send(data) def receive(self): """ :param datastream :type SegmentedDataStream :return: :rtype: bytes """ self._machine.receive() return self._transport.recv() consonance-0.1.3/consonance/streams/000077500000000000000000000000001347116303700174525ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/__init__.py000066400000000000000000000000001347116303700215510ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/arbitrary/000077500000000000000000000000001347116303700214515ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/arbitrary/__init__.py000066400000000000000000000000001347116303700235500ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/arbitrary/arbitrary.py000066400000000000000000000005541347116303700240260ustar00rootroot00000000000000import logging logger = logging.getLogger(__file__) class ArbitraryStream(object): def read(self, readsize): """ :param readsize: :type readsize: int :return: :rtype: bytes """ def write(self, data): """ :param data: :type data: bytes :return: :rtype: """ consonance-0.1.3/consonance/streams/arbitrary/arbitrary_socket.py000066400000000000000000000006211347116303700253710ustar00rootroot00000000000000from socket import socket from .arbitrary import ArbitraryStream class SocketArbitraryStream(ArbitraryStream): def __init__(self, socket): """ :param socket: :type socket: socket """ self._socket = socket # type: socket def read(self, readsize): return self._socket.recv(readsize) def write(self, data): self._socket.send(data) consonance-0.1.3/consonance/streams/segmented/000077500000000000000000000000001347116303700214255ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/segmented/__init__.py000066400000000000000000000000001347116303700235240ustar00rootroot00000000000000consonance-0.1.3/consonance/streams/segmented/blockingqueue.py000066400000000000000000000022471347116303700246410ustar00rootroot00000000000000from .segmented import SegmentedStream try: import Queue except ImportError: import queue as Queue class BlockingQueueSegmentedStream(SegmentedStream): EVENT_READ = 1 EVENT_WRITE = 2 def __init__(self): self._readqueue = Queue.Queue() self._writequeue = Queue.Queue() self._events_callback = None def set_events_callback(self, events_callback): self._events_callback = events_callback def remove_events_callback(self): self._events_callback = None def put_read_segment(self, data): """ :param data: :type data: bytes :return: :rtype: """ self._readqueue.put(data) def get_write_segment(self): """ :return: :rtype: bytes """ return self._writequeue.get(block=True) def read_segment(self): if self._events_callback is not None: self._events_callback(self.EVENT_READ) return self._readqueue.get(block=True) def write_segment(self, data): self._writequeue.put(data) if self._events_callback is not None: self._events_callback(self.EVENT_WRITE) consonance-0.1.3/consonance/streams/segmented/dummy.py000066400000000000000000000011061347116303700231300ustar00rootroot00000000000000from .segmented import SegmentedStream class DummySegmentedStream(SegmentedStream): def __init__(self, data): """ :param data: :type data: list[bytes] """ self._read = data # type: list[bytes] self._sent = [] # type: list[bytes] def read_segment(self): """ :return: :rtype: bytes """ return self._read.pop(0) def write_segment(self, data): """ :param data: :type data: bytes :return: :rtype: """ self._sent.append(data) consonance-0.1.3/consonance/streams/segmented/segmented.py000066400000000000000000000001711347116303700237510ustar00rootroot00000000000000class SegmentedStream(object): def read_segment(self): pass def write_segment(self, data): pass consonance-0.1.3/consonance/streams/segmented/wa.py000066400000000000000000000013651347116303700224130ustar00rootroot00000000000000import struct from .segmented import SegmentedStream from ..arbitrary.arbitrary import ArbitraryStream class WASegmentedStream(SegmentedStream): def __init__(self, dynamicstream): """ :param dynamicstream: :type dynamicstream: DataStream """ self._datastream = dynamicstream # type: ArbitraryStream def read_segment(self): size = struct.unpack('>I', b"\x00" + self._datastream.read(3))[0] # type: int return self._datastream.read(size) def write_segment(self, data): if len(data) >= 16777216: raise ValueError("data too large to write; length=%d" % len(data)) self._datastream.write(struct.pack('>I', len(data))[1:]) self._datastream.write(data) consonance-0.1.3/consonance/structs/000077500000000000000000000000001347116303700175035ustar00rootroot00000000000000consonance-0.1.3/consonance/structs/__init__.py000066400000000000000000000000001347116303700216020ustar00rootroot00000000000000consonance-0.1.3/consonance/structs/keypair.py000066400000000000000000000027251347116303700215270ustar00rootroot00000000000000from .publickey import PublicKey from .privatekey import PrivateKey from dissononce.dh.x25519.x25519 import X25519DH from dissononce.dh.x25519.keypair import KeyPair as X25519KeyPair class KeyPair(object): def __init__(self, public, private): """ :param public: :type public: PublicKey :param private: :type private: PrivateKey """ self._public = public # type: PublicKey self._private = private # type: PrivateKey @property def public(self): return self._public @property def private(self): return self._private def __eq__(self, other): return type(other) is KeyPair and other.public == self.public and other.private == self.private @classmethod def generate(cls): """ :return: :rtype: KeyPair """ keypair = X25519DH().generate_keypair() return KeyPair( PublicKey( keypair.public.data ), PrivateKey( keypair.private.data ) ) @classmethod def from_bytes(cls, data): """ :param data: :type data: bytes :return: :rtype: KeyPair """ keypair = X25519KeyPair.from_bytes(data) return KeyPair( PublicKey( keypair.public.data ), PrivateKey( keypair.private.data ) ) consonance-0.1.3/consonance/structs/privatekey.py000066400000000000000000000005101347116303700222340ustar00rootroot00000000000000class PrivateKey(object): def __init__(self, data): """ :param data: :type data: bytes """ self._data = data # type: bytes @property def data(self): return self._data def __eq__(self, other): return type(other) is PrivateKey and self.data == other.data consonance-0.1.3/consonance/structs/publickey.py000066400000000000000000000005061347116303700220450ustar00rootroot00000000000000class PublicKey(object): def __init__(self, data): """ :param data: :type data: bytes """ self._data = data # type: bytes @property def data(self): return self._data def __eq__(self, other): return type(other) is PublicKey and self.data == other.data consonance-0.1.3/consonance/transport.py000066400000000000000000000021141347116303700204000ustar00rootroot00000000000000from dissononce.processing.cipherstate import CipherState from .streams.segmented.segmented import SegmentedStream class WANoiseTransport(object): def __init__(self, stream, send_cipherstate, recv_cipherstate): """ :param stream: :type stream: SegmentedStream :param send_cipherstate: :type send_cipherstate: CipherState :param recv_cipherstate: :type recv_cipherstate: CipherState """ self._stream = stream self._send_cipherstate = send_cipherstate self._recv_cipherstate = recv_cipherstate def send(self, plaintext): """ :param plaintext: :type plaintext: bytes :return: :rtype: """ ciphertext = self._send_cipherstate.encrypt_with_ad(b'', plaintext) self._stream.write_segment(ciphertext) def recv(self): """ :return: :rtype: bytes """ ciphertext = self._stream.read_segment() plaintext = self._recv_cipherstate.decrypt_with_ad(b'', ciphertext) return bytearray(plaintext) consonance-0.1.3/consonance/util/000077500000000000000000000000001347116303700167515ustar00rootroot00000000000000consonance-0.1.3/consonance/util/__init__.py000066400000000000000000000000001347116303700210500ustar00rootroot00000000000000consonance-0.1.3/consonance/util/byte.py000066400000000000000000000012041347116303700202630ustar00rootroot00000000000000class ByteUtil(object): @staticmethod def split(input, first_len, second_len, third_len=None): """ :param input: :type input: bytes :param first_len: :type first_len: int :param second_len: :type second_len: int :param third_len: :type third_len: int :return: :rtype: """ parts = [] parts.append(input[:first_len]) parts.append(input[first_len:first_len + second_len]) if third_len is not None: parts.append(input[first_len + second_len: first_len + second_len + third_len]) return parts consonance-0.1.3/examples/000077500000000000000000000000001347116303700154645ustar00rootroot00000000000000consonance-0.1.3/examples/walogin_handshake_ik.py000066400000000000000000000055071347116303700221760ustar00rootroot00000000000000from consonance.structs.keypair import KeyPair from consonance.structs.publickey import PublicKey from consonance.protocol import WANoiseProtocol from consonance.config.client import ClientConfig from consonance.streams.segmented.wa import WASegmentedStream from consonance.streams.arbitrary.arbitrary_socket import SocketArbitraryStream from consonance.config.templates.useragent_samsung_s9p import SamsungS9PUserAgentConfig import consonance import uuid import dissononce import socket import logging import sys import base64 consonance.logger.setLevel(logging.DEBUG) dissononce.logger.setLevel(logging.DEBUG) # username is phone number USERNAME = 123456789 # on Android fetch client_static_keypair from /data/data/com.whatsapp/shared_prefs/keystore.xml KEYPAIR = KeyPair.from_bytes( base64.b64decode(b"YJa8Vd9pG0KV2tDYi5V+DMOtSvCEFzRGCzOlGZkvBHzJvBE5C3oC2Fruniw0GBGo7HHgR4TjvjI3C9AihStsVg==") ) WA_PUBLIC = PublicKey( base64.b64decode(b"8npJs5ulcmDmDaHZYflOveqXO73Gg2CzJySKvDs6qh4=") ) # same phone_id/fdid used at registration. # on Android it's phoneid_id under /data/data/com.whatsapp/shared_prefs/com.whatsapp_preferences.xml PHONE_ID = uuid.uuid4().__str__() # create full configuration which will translate later into a protobuf payload CONFIG = ClientConfig( username=USERNAME, passive=True, useragent=SamsungS9PUserAgentConfig( app_version="2.19.51", phone_id=PHONE_ID ), pushname="consonance", short_connect=True ) ENDPOINT = ("e1.whatsapp.net", 443) HEADER = b"WA\x02\x01" if __name__ == "__main__": s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(ENDPOINT) # send WA header indicating protocol version s.send(HEADER) # use WASegmentedStream for sending/receiving in frames stream = WASegmentedStream(SocketArbitraryStream(s)) # initialize WANoiseProtocol 2.1 wa_noiseprotocol = WANoiseProtocol(2, 1) # start the protocol, this should attempt a IK handshake since we # specifying the remote static public key. The handshake should # succeeds if the WA_PUBLIC is valid, but authentication should fail. if wa_noiseprotocol.start(stream, CONFIG, KEYPAIR, rs=WA_PUBLIC): print("Handshake completed, checking authentication...") # we are now in transport phase, first incoming data # will indicate whether we are authenticated first_transport_data = wa_noiseprotocol.receive() # fourth byte is status, 172 is success, 52 is failure if first_transport_data[3] == 172: print("Authentication succeeded") elif first_transport_data[3] == 52: print("Authentication failed") sys.exit(1) else: print("Unrecognized authentication response: %s" % (first_transport_data[3])) sys.exit(1) else: print("Handshake failed") sys.exit(1) consonance-0.1.3/examples/walogin_handshake_xx.py000066400000000000000000000051041347116303700222230ustar00rootroot00000000000000from consonance.structs.keypair import KeyPair from consonance.protocol import WANoiseProtocol from consonance.config.client import ClientConfig from consonance.streams.segmented.wa import WASegmentedStream from consonance.streams.arbitrary.arbitrary_socket import SocketArbitraryStream from consonance.config.templates.useragent_samsung_s9p import SamsungS9PUserAgentConfig import consonance import uuid import dissononce import socket import logging import sys import base64 consonance.logger.setLevel(logging.DEBUG) dissononce.logger.setLevel(logging.DEBUG) # username is phone number USERNAME = 123456789 # on Android fetch client_static_keypair from /data/data/com.whatsapp/shared_prefs/keystore.xml KEYPAIR = KeyPair.from_bytes( base64.b64decode(b"YJa8Vd9pG0KV2tDYi5V+DMOtSvCEFzRGCzOlGZkvBHzJvBE5C3oC2Fruniw0GBGo7HHgR4TjvjI3C9AihStsVg==") ) # same phone_id/fdid used at registration. # on Android it's phoneid_id under /data/data/com.whatsapp/shared_prefs/com.whatsapp_preferences.xml PHONE_ID = uuid.uuid4().__str__() # create full configuration which will translate later into a protobuf payload CONFIG = ClientConfig( username=USERNAME, passive=True, useragent=SamsungS9PUserAgentConfig( app_version="2.19.51", phone_id=PHONE_ID ), pushname="consonance", short_connect=True ) ENDPOINT = ("e1.whatsapp.net", 443) HEADER = b"WA\x02\x01" if __name__ == "__main__": s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(ENDPOINT) # send WA header indicating protocol version s.send(HEADER) # use WASegmentedStream for sending/receiving in frames stream = WASegmentedStream(SocketArbitraryStream(s)) # initialize WANoiseProtocol 2.1 wa_noiseprotocol = WANoiseProtocol(2, 1) # start the protocol, this should a XX handshake since # we are not passing the remote static public key if wa_noiseprotocol.start(stream, CONFIG, KEYPAIR): print("Handshake completed, checking authentication...") # we are now in transport phase, first incoming data # will indicate whether we are authenticated first_transport_data = wa_noiseprotocol.receive() # fourth byte is status, 172 is success, 52 is failure if first_transport_data[3] == 172: print("Authentication succeeded") elif first_transport_data[3] == 52: print("Authentication failed") sys.exit(1) else: print("Unrecognized authentication response: %s" % (first_transport_data[3])) sys.exit(1) else: print("Handshake failed") sys.exit(1) consonance-0.1.3/examples/walogin_handshake_xxfallback.py000066400000000000000000000056021347116303700237060ustar00rootroot00000000000000from consonance.structs.keypair import KeyPair from consonance.protocol import WANoiseProtocol from consonance.config.client import ClientConfig from consonance.streams.segmented.wa import WASegmentedStream from consonance.streams.arbitrary.arbitrary_socket import SocketArbitraryStream from consonance.config.templates.useragent_samsung_s9p import SamsungS9PUserAgentConfig import consonance import uuid import dissononce import socket import logging import sys import base64 consonance.logger.setLevel(logging.DEBUG) dissononce.logger.setLevel(logging.DEBUG) # username is phone number USERNAME = 123456789 # on Android fetch client_static_keypair from /data/data/com.whatsapp/shared_prefs/keystore.xml KEYPAIR = KeyPair.from_bytes( base64.b64decode(b"YJa8Vd9pG0KV2tDYi5V+DMOtSvCEFzRGCzOlGZkvBHzJvBE5C3oC2Fruniw0GBGo7HHgR4TjvjI3C9AihStsVg==") ) # using a random remote public key WA_PUBLIC = KeyPair.generate().public # same phone_id/fdid used at registration. # on Android it's phoneid_id under /data/data/com.whatsapp/shared_prefs/com.whatsapp_preferences.xml PHONE_ID = uuid.uuid4().__str__() # create full configuration which will translate later into a protobuf payload CONFIG = ClientConfig( username=USERNAME, passive=True, useragent=SamsungS9PUserAgentConfig( app_version="2.19.51", phone_id=PHONE_ID ), pushname="consonance", short_connect=True ) ENDPOINT = ("e1.whatsapp.net", 443) HEADER = b"WA\x02\x01" if __name__ == "__main__": s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(ENDPOINT) # send WA header indicating protocol version s.send(HEADER) # use WASegmentedStream for sending/receiving in frames stream = WASegmentedStream(SocketArbitraryStream(s)) # initialize WANoiseProtocol 2.1 wa_noiseprotocol = WANoiseProtocol(2, 1) # start the protocol, this should attempt a IK handshake since we # specifying the remote static public key. The handshake should # fail because WA_PUBLIC is invalid. This results in reverting to # a xxfallack handshake. Note that eventually authentication # should fail anyways due to invalid credentials of this examples. if wa_noiseprotocol.start(stream, CONFIG, KEYPAIR, rs=WA_PUBLIC): print("Handshake completed, checking authentication...") # we are now in transport phase, first incoming data # will indicate whether we are authenticated first_transport_data = wa_noiseprotocol.receive() # fourth byte is status, 172 is success, 52 is failure if first_transport_data[3] == 172: print("Authentication succeeded") elif first_transport_data[3] == 52: print("Authentication failed") sys.exit(1) else: print("Unrecognized authentication response: %s" % (first_transport_data[3])) sys.exit(1) else: print("Handshake failed") sys.exit(1) consonance-0.1.3/setup.py000066400000000000000000000034451347116303700153660ustar00rootroot00000000000000# -*- coding: utf-8 -*- import consonance from setuptools import find_packages, setup setup( name='consonance', version=consonance.__version__, packages=find_packages(exclude=['tests', 'examples']), install_requires=['dissononce>=0.34.3', 'python-axolotl-curve25519', 'transitions', 'protobuf>=3.6.0'], license='GPL-3+', author='Tarek Galal', author_email='tare2.galal@gmail.com', description="WhatsApp's handshake implementation using Noise Protocol", long_description="This library implements WhatsApp's handshake process which makes use of " "Noise Pipes with Curve25519, AES-GCM, and SHA256 from Noise Protocol", platforms='any', classifiers=['Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Natural Language :: English', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX :: Linux', 'Topic :: Security :: Cryptography', 'Topic :: Software Development :: Libraries :: Python Modules'] ) consonance-0.1.3/tests/000077500000000000000000000000001347116303700150105ustar00rootroot00000000000000consonance-0.1.3/tests/__init__.py000066400000000000000000000000001347116303700171070ustar00rootroot00000000000000consonance-0.1.3/tests/test_handshakes_offline.py000066400000000000000000000035311347116303700222360ustar00rootroot00000000000000from consonance.structs.keypair import KeyPair from consonance.handshake import WAHandshake from consonance.config.client import ClientConfig from consonance.streams.segmented.dummy import DummySegmentedStream from consonance.config.templates.useragent_vbox import VBoxUserAgentConfig import uuid import base64 import unittest class HandshakesTest(unittest.TestCase): KEYPAIR = KeyPair.from_bytes( base64.b64decode(b"YJa8Vd9pG0KV2tDYi5V+DMOtSvCEFzRGCzOlGZkvBHzJvBE5C3oC2Fruniw0GBGo7HHgR4TjvjI3C9AihStsVg==") ) PHONE_ID = uuid.uuid4().__str__() CONFIG = ClientConfig( username=1, passive=True, useragent=VBoxUserAgentConfig( app_version="2.19.51", phone_id=PHONE_ID, mcc="000", mnc="000", ), pushname="consonance", short_connect=True ) def test_xx_handshake_offline(self): stream = DummySegmentedStream([ base64.b64decode( b"GvoBCiCiMwovEL8pYkUdcxCz6w5lvzvyxgAgHiNm4LnOwO8KQxIwt+dvmTcTMcE12jCC" b"rbnLcFY+H2/QuKr4/h4BCHy0rDS9rKp63yqRfFX5vEPY0/UGGqMBCfYtpYzsdsU3cN0Bq4ui5Dm0MY/+Yur2cCFb" b"tLRgBa858hWFuCIuWKrkE89GrF0uo+wJsolq4miiqMOdXJfuZ2YBZ4paFS2mWjVmQSINRo8J3LzXncUDMeQBO/KkC" b"ARw5BTcVkj2gwI6FG+yB/qI8BUJIxxswJc6q+H+HWkNro+Xl6urn5aOwK7bgBSPNctncZGY72NlJByEQCB6Bra7U" b"ykzQA==") ]) ephemeral = KeyPair.from_bytes( base64.b64decode( b"qLt+l8Jh9mUF/QciIRjd7Z0qKyhN//46Xawk5jdL4WF4tFaszfGgyodH3ErvqU5lV4GnOccdy9zj39GU6AAPVQ==" ) ) # initialize WANoiseProtocol 2.1 wa_handshake = WAHandshake(2, 1) # this should do a XX handshake since we are not passing the remote static public key wa_handshake.perform(self.CONFIG, stream, self.KEYPAIR, e=ephemeral) consonance-0.1.3/tests/test_handshakes_online.py000066400000000000000000000034461347116303700221050ustar00rootroot00000000000000from consonance.structs.keypair import KeyPair from consonance.protocol import WANoiseProtocol from consonance.config.client import ClientConfig from consonance.streams.segmented.wa import WASegmentedStream from consonance.streams.arbitrary.arbitrary_socket import SocketArbitraryStream from consonance.config.templates.useragent_vbox import VBoxUserAgentConfig import uuid import socket import unittest class HandshakesTest(unittest.TestCase): USERNAME = 123456789 KEYPAIR = KeyPair.generate() PHONE_ID = uuid.uuid4().__str__() CONFIG = ClientConfig( username=USERNAME, passive=True, useragent=VBoxUserAgentConfig( app_version="2.19.51", phone_id=PHONE_ID, mcc="000", mnc="000", ), pushname="consonance", short_connect=True ) ENDPOINT = ("e1.whatsapp.net", 443) HEADER = b"WA\x02\x01" def test_xx_handshake(self): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(self.ENDPOINT) # send WA header indicating protocol version s.send(self.HEADER) # use WASegmentedStream for sending/receiving in frames stream = WASegmentedStream(SocketArbitraryStream(s)) # initialize WANoiseProtocol 2.1 wa_noiseprotocol = WANoiseProtocol(2, 1) # start the protocol, this should a XX handshake since # we are not passing the remote static public key self.assertTrue(wa_noiseprotocol.start(stream, self.CONFIG, self.KEYPAIR)) # we are now in transport phase, first incoming data # will indicate whether we are authenticated first_transport_data = wa_noiseprotocol.receive() # fourth byte is status, 172 is success, 52 is failure self.assertEqual(52, first_transport_data[3]) consonance-0.1.3/tox.ini000066400000000000000000000006041347116303700151610ustar00rootroot00000000000000# Tox (http://tox.testrun.org/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. [tox] skip_missing_interpreters = true envlist = py27, py32, py33, py34, py35, py36, py37 [testenv] commands = nosetests tests deps = nose