├── .gitignore
├── LICENSE
├── README.md
├── constants.py
├── requirements.txt
└── tpa.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # virtualenv
2 | [Bb]in
3 | [Ii]nclude
4 | [Ll]ib
5 | local
6 | pip-selfcheck.json
7 | [Ss]cripts
8 | # Python bytecode files
9 | *.pyc
10 | # Emacs temporary files
11 | .\#*
12 | \#*\#
13 | cache
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
676 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SSL/TLS Protocol Analyzer
2 | Passively listens on interface and shows information about SSL/TLS connections.
3 | Yes, scapy does something similar (and much, much more), but you'll need several dependencies. Getting scapy to run on Windows for example can be quite a hassle.
4 | This script 'only' depends on dpkt, and pypcap if you want to sniff live traffic.
5 |
6 | Please note that you need correct permissions to sniff traffic (root or Administrator privileges).
7 |
8 |
9 | Dependencies
10 | ------------
11 | + dpkt
12 | + pypcap
13 |
14 | Optional (to show IP addresses per interface):
15 | + netifaces
16 |
17 |
18 | Installation
19 | ------------
20 | ```pip install -r requirements.txt```
21 | Note that this also installs netifaces
22 |
23 |
24 | Usage
25 | ----
26 | ```
27 | ./tpa.py
28 | ```
29 | Listens on default interface eth0 and shows information about SSL/TLS handshakes. Currently only the Client Hello parser is implemented, so that's the information that will be displayed.
30 |
31 | ```
32 | ./tpa.py -i eth3
33 | ```
34 |
35 | Listens on interface eth3
36 |
37 | When running on Linux environments (including Cygwin, MSYS and MSYS2 under Windows), you can specify the standard name (e.g. `eth1`) for the interface.
38 | When running native on Windows you need to specify the extremely unfriendly looking device name, e.g. `\\DEVICE\NPF_{C0FFEE-15-G00D}`
39 | Note that you can retrieve a list of these device names using the `--list-interfaces` option
40 |
41 | ```
42 | ./tpa.py -r PCAPFILE
43 | ```
44 | Reads a pcap file and displays information about SSL/TLS connections.
45 |
46 | ```
47 | ./tpa.py --list-interfaces
48 | ```
49 | Lists all available interfaces with their IP addresses
50 |
51 | Example output
52 | --------------
53 | ```
54 | [+] Client Hello detected (172.1.2.3:31337 --> 192.30.252.131:443)
55 | [*] Ciphers:
56 | 0xc02b - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
57 | 0xc02f - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
58 | 0xc00a - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
59 | 0xc009 - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
60 | 0xc013 - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
61 | 0xc014 - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
62 | 0x33 - TLS_DHE_RSA_WITH_AES_128_CBC_SHA
63 | 0x39 - TLS_DHE_RSA_WITH_AES_256_CBC_SHA
64 | 0x2f - TLS_RSA_WITH_AES_128_CBC_SHA
65 | 0x35 - TLS_RSA_WITH_AES_256_CBC_SHA
66 | 0xa - TLS_RSA_WITH_3DES_EDE_CBC_SHA
67 | [*] Compression methods:
68 | 0 - null
69 | [*] Extensions:
70 | 0 - server_name (Length: 15)
71 | github.com (Type host name)
72 | 65281 - renegotiation_info (Length: 1)
73 | 10 - supported_groups (Length: 8)
74 | 11 - ec_point_formats (Length: 2)
75 | 35 - SessionTicket TLS (Length: 0)
76 | 13172 - next_protocol_negotiation (Length: 0)
77 | 16 - application_layer_protocol_negotiation (Length: 23)
78 | h2
79 | spdy/3.1
80 | http/1.1
81 | 5 - status_request (Length: 5)
82 | 13 - signature_algorithms (Length: 22)
83 |
84 | ```
85 |
86 |
--------------------------------------------------------------------------------
/constants.py:
--------------------------------------------------------------------------------
1 | PRETTY_NAMES = {
2 | 'alert_level': {
3 | 1: 'warning',
4 | 2: 'fatal'
5 | },
6 | 'alert_description': {
7 | 0: 'close_notify',
8 | 10: 'unexpected_message',
9 | 20: 'bad_record_mac',
10 | 21: 'decryption_failed',
11 | 22: 'record_overflow',
12 | 30: 'decompression_failure',
13 | 40: 'handshake_failure',
14 | 41: 'no_certificate',
15 | 42: 'bad_certificate',
16 | 43: 'unsupported_certificate',
17 | 44: 'certificate_revoked',
18 | 45: 'certificate_expired',
19 | 46: 'certificate_unknown',
20 | 47: 'illegal_parameter',
21 | 48: 'unknown_ca',
22 | 49: 'access_denied',
23 | 50: 'decode_error',
24 | 51: 'decrypt_error',
25 | 60: 'export_restriction',
26 | 70: 'protocol_version',
27 | 71: 'insufficient_security',
28 | 80: 'internal_error',
29 | 86: 'inappropriate_fallback',
30 | 90: 'user_canceled',
31 | 100: 'no_renegotiation',
32 | 110: 'unsupported_extension',
33 | 111: 'certificate_unobtainable',
34 | 112: 'unrecognized_name',
35 | 113: 'bad_certificate_status_response',
36 | 114: 'bad_certificate_hash_value',
37 | 115: 'unknown_psk_identity'
38 | },
39 | 'cipher_suites': {
40 | 0x010080: 'SSL_CK_RC4_128_WITH_MD5',
41 | 0x020080: 'SSL_CK_RC4_128_EXPORT40_WITH_MD5',
42 | 0x030080: 'SSL_CK_RC2_128_CBC_WITH_MD5 ',
43 | 0x040080: 'SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5',
44 | 0x050080: 'SSL_CK_IDEA_128_CBC_WITH_MD5',
45 | 0x060040: 'SSL_CK_DES_64_CBC_WITH_MD5',
46 | 0x0700C0: 'SSL_CK_DES_192_EDE3_CBC_WITH_MD5',
47 | 0x080080: 'SSL_CK_RC4_64_WITH_MD5',
48 | 0x00: 'TLS_NULL_WITH_NULL_NULL',
49 | 0x01: 'TLS_RSA_WITH_NULL_MD5',
50 | 0x02: 'TLS_RSA_WITH_NULL_SHA',
51 | 0x03: 'TLS_RSA_EXPORT_WITH_RC4_40_MD5',
52 | 0x04: 'TLS_RSA_WITH_RC4_128_MD5',
53 | 0x05: 'TLS_RSA_WITH_RC4_128_SHA',
54 | 0x06: 'TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5',
55 | 0x07: 'TLS_RSA_WITH_IDEA_CBC_SHA',
56 | 0x08: 'TLS_RSA_EXPORT_WITH_DES40_CBC_SHA',
57 | 0x09: 'TLS_RSA_WITH_DES_CBC_SHA',
58 | 0x0A: 'TLS_RSA_WITH_3DES_EDE_CBC_SHA',
59 | 0x0B: 'TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA',
60 | 0x0C: 'TLS_DH_DSS_WITH_DES_CBC_SHA',
61 | 0x0D: 'TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA',
62 | 0x0E: 'TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA',
63 | 0x0F: 'TLS_DH_RSA_WITH_DES_CBC_SHA',
64 | 0x10: 'TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA',
65 | 0x11: 'TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA',
66 | 0x12: 'TLS_DHE_DSS_WITH_DES_CBC_SHA',
67 | 0x13: 'TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA',
68 | 0x14: 'TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA',
69 | 0x15: 'TLS_DHE_RSA_WITH_DES_CBC_SHA',
70 | 0x16: 'TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA',
71 | 0x17: 'TLS_DH_anon_EXPORT_WITH_RC4_40_MD5',
72 | 0x18: 'TLS_DH_anon_WITH_RC4_128_MD5',
73 | 0x19: 'TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA',
74 | 0x1A: 'TLS_DH_anon_WITH_DES_CBC_SHA',
75 | 0x1B: 'TLS_DH_anon_WITH_3DES_EDE_CBC_SHA',
76 | 0x1E: 'TLS_KRB5_WITH_DES_CBC_SHA',
77 | 0x1F: 'TLS_KRB5_WITH_3DES_EDE_CBC_SHA',
78 | 0x20: 'TLS_KRB5_WITH_RC4_128_SHA',
79 | 0x21: 'TLS_KRB5_WITH_IDEA_CBC_SHA',
80 | 0x22: 'TLS_KRB5_WITH_DES_CBC_MD5',
81 | 0x23: 'TLS_KRB5_WITH_3DES_EDE_CBC_MD5',
82 | 0x24: 'TLS_KRB5_WITH_RC4_128_MD5',
83 | 0x25: 'TLS_KRB5_WITH_IDEA_CBC_MD5',
84 | 0x26: 'TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA',
85 | 0x27: 'TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA',
86 | 0x28: 'TLS_KRB5_EXPORT_WITH_RC4_40_SHA',
87 | 0x29: 'TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5',
88 | 0x2A: 'TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5',
89 | 0x2B: 'TLS_KRB5_EXPORT_WITH_RC4_40_MD5',
90 | 0x2C: 'TLS_PSK_WITH_NULL_SHA',
91 | 0x2D: 'TLS_DHE_PSK_WITH_NULL_SHA',
92 | 0x2E: 'TLS_RSA_PSK_WITH_NULL_SHA',
93 | 0x2F: 'TLS_RSA_WITH_AES_128_CBC_SHA',
94 | 0x30: 'TLS_DH_DSS_WITH_AES_128_CBC_SHA',
95 | 0x31: 'TLS_DH_RSA_WITH_AES_128_CBC_SHA',
96 | 0x32: 'TLS_DHE_DSS_WITH_AES_128_CBC_SHA',
97 | 0x33: 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA',
98 | 0x34: 'TLS_DH_anon_WITH_AES_128_CBC_SHA',
99 | 0x35: 'TLS_RSA_WITH_AES_256_CBC_SHA',
100 | 0x36: 'TLS_DH_DSS_WITH_AES_256_CBC_SHA',
101 | 0x37: 'TLS_DH_RSA_WITH_AES_256_CBC_SHA',
102 | 0x38: 'TLS_DHE_DSS_WITH_AES_256_CBC_SHA',
103 | 0x39: 'TLS_DHE_RSA_WITH_AES_256_CBC_SHA',
104 | 0x3A: 'TLS_DH_anon_WITH_AES_256_CBC_SHA',
105 | 0x3B: 'TLS_RSA_WITH_NULL_SHA256',
106 | 0x3C: 'TLS_RSA_WITH_AES_128_CBC_SHA256',
107 | 0x3D: 'TLS_RSA_WITH_AES_256_CBC_SHA256',
108 | 0x3E: 'TLS_DH_DSS_WITH_AES_128_CBC_SHA256',
109 | 0x3F: 'TLS_DH_RSA_WITH_AES_128_CBC_SHA256',
110 | 0x40: 'TLS_DHE_DSS_WITH_AES_128_CBC_SHA256',
111 | 0x41: 'TLS_RSA_WITH_CAMELLIA_128_CBC_SHA',
112 | 0x42: 'TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA',
113 | 0x43: 'TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA',
114 | 0x44: 'TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA',
115 | 0x45: 'TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA',
116 | 0x46: 'TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA',
117 | 0x60: 'TLS_RSA_EXPORT1024_WITH_RC4_56_MD5',
118 | 0x61: 'TLS_RSA_EXPORT1024_WITH_RC2_56_MD5',
119 | 0x62: 'TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA',
120 | 0x63: 'TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA',
121 | 0x64: 'TLS_RSA_EXPORT1024_WITH_RC4_56_SHA',
122 | 0x65: 'TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA',
123 | 0x66: 'TLS_DHE_DSS_WITH_RC4_128_SHA',
124 | 0x67: 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA256',
125 | 0x68: 'TLS_DH_DSS_WITH_AES_256_CBC_SHA256',
126 | 0x69: 'TLS_DH_RSA_WITH_AES_256_CBC_SHA256',
127 | 0x6A: 'TLS_DHE_DSS_WITH_AES_256_CBC_SHA256',
128 | 0x6B: 'TLS_DHE_RSA_WITH_AES_256_CBC_SHA256',
129 | 0x6C: 'TLS_DH_anon_WITH_AES_128_CBC_SHA256',
130 | 0x6D: 'TLS_DH_anon_WITH_AES_256_CBC_SHA256',
131 | 0x80: 'TLS_GOSTR341094_WITH_28147_CNT_IMIT',
132 | 0x81: 'TLS_GOSTR341001_WITH_28147_CNT_IMIT',
133 | 0x82: 'TLS_GOSTR341094_WITH_NULL_GOSTR3411',
134 | 0x83: 'TLS_GOSTR341001_WITH_NULL_GOSTR3411',
135 | 0x84: 'TLS_RSA_WITH_CAMELLIA_256_CBC_SHA',
136 | 0x85: 'TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA',
137 | 0x86: 'TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA',
138 | 0x87: 'TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA',
139 | 0x88: 'TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA',
140 | 0x89: 'TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA',
141 | 0x8A: 'TLS_PSK_WITH_RC4_128_SHA',
142 | 0x8B: 'TLS_PSK_WITH_3DES_EDE_CBC_SHA',
143 | 0x8C: 'TLS_PSK_WITH_AES_128_CBC_SHA',
144 | 0x8D: 'TLS_PSK_WITH_AES_256_CBC_SHA',
145 | 0x8E: 'TLS_DHE_PSK_WITH_RC4_128_SHA',
146 | 0x8F: 'TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA',
147 | 0x90: 'TLS_DHE_PSK_WITH_AES_128_CBC_SHA',
148 | 0x91: 'TLS_DHE_PSK_WITH_AES_256_CBC_SHA',
149 | 0x92: 'TLS_RSA_PSK_WITH_RC4_128_SHA',
150 | 0x93: 'TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA',
151 | 0x94: 'TLS_RSA_PSK_WITH_AES_128_CBC_SHA',
152 | 0x95: 'TLS_RSA_PSK_WITH_AES_256_CBC_SHA',
153 | 0x96: 'TLS_RSA_WITH_SEED_CBC_SHA',
154 | 0x97: 'TLS_DH_DSS_WITH_SEED_CBC_SHA',
155 | 0x98: 'TLS_DH_RSA_WITH_SEED_CBC_SHA',
156 | 0x99: 'TLS_DHE_DSS_WITH_SEED_CBC_SHA',
157 | 0x9A: 'TLS_DHE_RSA_WITH_SEED_CBC_SHA',
158 | 0x9B: 'TLS_DH_anon_WITH_SEED_CBC_SHA',
159 | 0x9C: 'TLS_RSA_WITH_AES_128_GCM_SHA256',
160 | 0x9D: 'TLS_RSA_WITH_AES_256_GCM_SHA384',
161 | 0x9E: 'TLS_DHE_RSA_WITH_AES_128_GCM_SHA256',
162 | 0x9F: 'TLS_DHE_RSA_WITH_AES_256_GCM_SHA384',
163 | 0xA0: 'TLS_DH_RSA_WITH_AES_128_GCM_SHA256',
164 | 0xA1: 'TLS_DH_RSA_WITH_AES_256_GCM_SHA384',
165 | 0xA2: 'TLS_DHE_DSS_WITH_AES_128_GCM_SHA256',
166 | 0xA3: 'TLS_DHE_DSS_WITH_AES_256_GCM_SHA384',
167 | 0xA4: 'TLS_DH_DSS_WITH_AES_128_GCM_SHA256',
168 | 0xA5: 'TLS_DH_DSS_WITH_AES_256_GCM_SHA384',
169 | 0xA6: 'TLS_DH_anon_WITH_AES_128_GCM_SHA256',
170 | 0xA7: 'TLS_DH_anon_WITH_AES_256_GCM_SHA384',
171 | 0xA8: 'TLS_PSK_WITH_AES_128_GCM_SHA256',
172 | 0xA9: 'TLS_PSK_WITH_AES_256_GCM_SHA384',
173 | 0xAA: 'TLS_DHE_PSK_WITH_AES_128_GCM_SHA256',
174 | 0xAB: 'TLS_DHE_PSK_WITH_AES_256_GCM_SHA384',
175 | 0xAC: 'TLS_RSA_PSK_WITH_AES_128_GCM_SHA256',
176 | 0xAD: 'TLS_RSA_PSK_WITH_AES_256_GCM_SHA384',
177 | 0xAE: 'TLS_PSK_WITH_AES_128_CBC_SHA256',
178 | 0xAF: 'TLS_PSK_WITH_AES_256_CBC_SHA384',
179 | 0xB0: 'TLS_PSK_WITH_NULL_SHA256',
180 | 0xB1: 'TLS_PSK_WITH_NULL_SHA384',
181 | 0xB2: 'TLS_DHE_PSK_WITH_AES_128_CBC_SHA256',
182 | 0xB3: 'TLS_DHE_PSK_WITH_AES_256_CBC_SHA384',
183 | 0xB4: 'TLS_DHE_PSK_WITH_NULL_SHA256',
184 | 0xB5: 'TLS_DHE_PSK_WITH_NULL_SHA384',
185 | 0xB6: 'TLS_RSA_PSK_WITH_AES_128_CBC_SHA256',
186 | 0xB7: 'TLS_RSA_PSK_WITH_AES_256_CBC_SHA384',
187 | 0xB8: 'TLS_RSA_PSK_WITH_NULL_SHA256',
188 | 0xB9: 'TLS_RSA_PSK_WITH_NULL_SHA384',
189 | 0xBA: 'TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256',
190 | 0xBB: 'TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256',
191 | 0xBC: 'TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256',
192 | 0xBD: 'TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256',
193 | 0xBE: 'TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256',
194 | 0xBF: 'TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256',
195 | 0xC0: 'TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256',
196 | 0xC1: 'TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256',
197 | 0xC2: 'TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256',
198 | 0xC3: 'TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256',
199 | 0xC4: 'TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256',
200 | 0xC5: 'TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256',
201 | 0xFF: 'TLS_EMPTY_RENEGOTIATION_INFO_SCSV',
202 | 0x5600: 'TLS_FALLBACK_SCSV',
203 | 0xC001: 'TLS_ECDH_ECDSA_WITH_NULL_SHA',
204 | 0xC002: 'TLS_ECDH_ECDSA_WITH_RC4_128_SHA',
205 | 0xC003: 'TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA',
206 | 0xC004: 'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA',
207 | 0xC005: 'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA',
208 | 0xC006: 'TLS_ECDHE_ECDSA_WITH_NULL_SHA',
209 | 0xC007: 'TLS_ECDHE_ECDSA_WITH_RC4_128_SHA',
210 | 0xC008: 'TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA',
211 | 0xC009: 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',
212 | 0xC00A: 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',
213 | 0xC00B: 'TLS_ECDH_RSA_WITH_NULL_SHA',
214 | 0xC00C: 'TLS_ECDH_RSA_WITH_RC4_128_SHA',
215 | 0xC00D: 'TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA',
216 | 0xC00E: 'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA',
217 | 0xC00F: 'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA',
218 | 0xC010: 'TLS_ECDHE_RSA_WITH_NULL_SHA',
219 | 0xC011: 'TLS_ECDHE_RSA_WITH_RC4_128_SHA',
220 | 0xC012: 'TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA',
221 | 0xC013: 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA',
222 | 0xC014: 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',
223 | 0xC015: 'TLS_ECDH_anon_WITH_NULL_SHA',
224 | 0xC016: 'TLS_ECDH_anon_WITH_RC4_128_SHA',
225 | 0xC017: 'TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA',
226 | 0xC018: 'TLS_ECDH_anon_WITH_AES_128_CBC_SHA',
227 | 0xC019: 'TLS_ECDH_anon_WITH_AES_256_CBC_SHA',
228 | 0xC01A: 'TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA',
229 | 0xC01B: 'TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA',
230 | 0xC01C: 'TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA',
231 | 0xC01D: 'TLS_SRP_SHA_WITH_AES_128_CBC_SHA',
232 | 0xC01E: 'TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA',
233 | 0xC01F: 'TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA',
234 | 0xC020: 'TLS_SRP_SHA_WITH_AES_256_CBC_SHA',
235 | 0xC021: 'TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA',
236 | 0xC022: 'TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA',
237 | 0xC023: 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256',
238 | 0xC024: 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384',
239 | 0xC025: 'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256',
240 | 0xC026: 'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384',
241 | 0xC027: 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256',
242 | 0xC028: 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384',
243 | 0xC029: 'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256',
244 | 0xC02A: 'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384',
245 | 0xC02B: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
246 | 0xC02C: 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
247 | 0xC02D: 'TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256',
248 | 0xC02E: 'TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384',
249 | 0xC02F: 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',
250 | 0xC030: 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
251 | 0xC031: 'TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256',
252 | 0xC032: 'TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384',
253 | 0xC033: 'TLS_ECDHE_PSK_WITH_RC4_128_SHA',
254 | 0xC034: 'TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA',
255 | 0xC035: 'TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA',
256 | 0xC036: 'TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA',
257 | 0xC037: 'TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256',
258 | 0xC038: 'TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384',
259 | 0xC039: 'TLS_ECDHE_PSK_WITH_NULL_SHA',
260 | 0xC03A: 'TLS_ECDHE_PSK_WITH_NULL_SHA256',
261 | 0xC03B: 'TLS_ECDHE_PSK_WITH_NULL_SHA384',
262 | 0xC03C: 'TLS_RSA_WITH_ARIA_128_CBC_SHA256',
263 | 0xC03D: 'TLS_RSA_WITH_ARIA_256_CBC_SHA384',
264 | 0xC03E: 'TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256',
265 | 0xC03F: 'TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384',
266 | 0xC040: 'TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256',
267 | 0xC041: 'TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384',
268 | 0xC042: 'TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256',
269 | 0xC043: 'TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384',
270 | 0xC044: 'TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256',
271 | 0xC045: 'TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384',
272 | 0xC046: 'TLS_DH_anon_WITH_ARIA_128_CBC_SHA256',
273 | 0xC047: 'TLS_DH_anon_WITH_ARIA_256_CBC_SHA384',
274 | 0xC048: 'TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256',
275 | 0xC049: 'TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384',
276 | 0xC04A: 'TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256',
277 | 0xC04B: 'TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384',
278 | 0xC04C: 'TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256',
279 | 0xC04D: 'TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384',
280 | 0xC04E: 'TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256',
281 | 0xC04F: 'TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384',
282 | 0xC050: 'TLS_RSA_WITH_ARIA_128_GCM_SHA256',
283 | 0xC051: 'TLS_RSA_WITH_ARIA_256_GCM_SHA384',
284 | 0xC052: 'TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256',
285 | 0xC053: 'TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384',
286 | 0xC054: 'TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256',
287 | 0xC055: 'TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384',
288 | 0xC056: 'TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256',
289 | 0xC057: 'TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384',
290 | 0xC058: 'TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256',
291 | 0xC059: 'TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384',
292 | 0xC05A: 'TLS_DH_anon_WITH_ARIA_128_GCM_SHA256',
293 | 0xC05B: 'TLS_DH_anon_WITH_ARIA_256_GCM_SHA384',
294 | 0xC05C: 'TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256',
295 | 0xC05D: 'TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384',
296 | 0xC05E: 'TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256',
297 | 0xC05F: 'TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384',
298 | 0xC060: 'TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256',
299 | 0xC061: 'TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384',
300 | 0xC062: 'TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256',
301 | 0xC063: 'TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384',
302 | 0xC064: 'TLS_PSK_WITH_ARIA_128_CBC_SHA256',
303 | 0xC065: 'TLS_PSK_WITH_ARIA_256_CBC_SHA384',
304 | 0xC066: 'TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256',
305 | 0xC067: 'TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384',
306 | 0xC068: 'TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256',
307 | 0xC069: 'TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384',
308 | 0xC06A: 'TLS_PSK_WITH_ARIA_128_GCM_SHA256',
309 | 0xC06B: 'TLS_PSK_WITH_ARIA_256_GCM_SHA384',
310 | 0xC06C: 'TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256',
311 | 0xC06D: 'TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384',
312 | 0xC06E: 'TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256',
313 | 0xC06F: 'TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384',
314 | 0xC070: 'TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256',
315 | 0xC071: 'TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384',
316 | 0xC072: 'TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256',
317 | 0xC073: 'TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384',
318 | 0xC074: 'TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256',
319 | 0xC075: 'TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384',
320 | 0xC076: 'TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256',
321 | 0xC077: 'TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384',
322 | 0xC078: 'TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256',
323 | 0xC079: 'TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384',
324 | 0xC07A: 'TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256',
325 | 0xC07B: 'TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384',
326 | 0xC07C: 'TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256',
327 | 0xC07D: 'TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384',
328 | 0xC07E: 'TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256',
329 | 0xC07F: 'TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384',
330 | 0xC080: 'TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256',
331 | 0xC081: 'TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384',
332 | 0xC082: 'TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256',
333 | 0xC083: 'TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384',
334 | 0xC084: 'TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256',
335 | 0xC085: 'TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384',
336 | 0xC086: 'TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256',
337 | 0xC087: 'TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384',
338 | 0xC088: 'TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256',
339 | 0xC089: 'TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384',
340 | 0xC08A: 'TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256',
341 | 0xC08B: 'TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384',
342 | 0xC08C: 'TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256',
343 | 0xC08D: 'TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384',
344 | 0xC08E: 'TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256',
345 | 0xC08F: 'TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384',
346 | 0xC090: 'TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256',
347 | 0xC091: 'TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384',
348 | 0xC092: 'TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256',
349 | 0xC093: 'TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384',
350 | 0xC094: 'TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256',
351 | 0xC095: 'TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384',
352 | 0xC096: 'TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256',
353 | 0xC097: 'TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384',
354 | 0xC098: 'TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256',
355 | 0xC099: 'TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384',
356 | 0xC09A: 'TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256',
357 | 0xC09B: 'TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384',
358 | 0xC09C: 'TLS_RSA_WITH_AES_128_CCM',
359 | 0xC09D: 'TLS_RSA_WITH_AES_256_CCM',
360 | 0xC09E: 'TLS_DHE_RSA_WITH_AES_128_CCM',
361 | 0xC09F: 'TLS_DHE_RSA_WITH_AES_256_CCM',
362 | 0xC0A0: 'TLS_RSA_WITH_AES_128_CCM_8',
363 | 0xC0A1: 'TLS_RSA_WITH_AES_256_CCM_8',
364 | 0xC0A2: 'TLS_DHE_RSA_WITH_AES_128_CCM_8',
365 | 0xC0A3: 'TLS_DHE_RSA_WITH_AES_256_CCM_8',
366 | 0xC0A4: 'TLS_PSK_WITH_AES_128_CCM',
367 | 0xC0A5: 'TLS_PSK_WITH_AES_256_CCM',
368 | 0xC0A6: 'TLS_DHE_PSK_WITH_AES_128_CCM',
369 | 0xC0A7: 'TLS_DHE_PSK_WITH_AES_256_CCM',
370 | 0xC0A8: 'TLS_PSK_WITH_AES_128_CCM_8',
371 | 0xC0A9: 'TLS_PSK_WITH_AES_256_CCM_8',
372 | 0xC0AA: 'TLS_PSK_DHE_WITH_AES_128_CCM_8',
373 | 0xC0AB: 'TLS_PSK_DHE_WITH_AES_256_CCM_8',
374 | 0xC09C: 'TLS_RSA_WITH_AES_128_CCM',
375 | 0xC09D: 'TLS_RSA_WITH_AES_256_CCM',
376 | 0xC09E: 'TLS_DHE_RSA_WITH_AES_128_CCM',
377 | 0xC09F: 'TLS_DHE_RSA_WITH_AES_256_CCM',
378 | 0xC0A0: 'TLS_RSA_WITH_AES_128_CCM_8',
379 | 0xC0A1: 'TLS_RSA_WITH_AES_256_CCM_8',
380 | 0xC0A2: 'TLS_DHE_RSA_WITH_AES_128_CCM_8',
381 | 0xC0A3: 'TLS_DHE_RSA_WITH_AES_256_CCM_8',
382 | 0xC0A4: 'TLS_PSK_WITH_AES_128_CCM',
383 | 0xC0A5: 'TLS_PSK_WITH_AES_256_CCM',
384 | 0xC0A6: 'TLS_DHE_PSK_WITH_AES_128_CCM',
385 | 0xC0A7: 'TLS_DHE_PSK_WITH_AES_256_CCM',
386 | 0xC0A8: 'TLS_PSK_WITH_AES_128_CCM_8',
387 | 0xC0A9: 'TLS_PSK_WITH_AES_256_CCM_8',
388 | 0xC0AA: 'TLS_PSK_DHE_WITH_AES_128_CCM_8',
389 | 0xC0AB: 'TLS_PSK_DHE_WITH_AES_256_CCM_80',
390 | 0xC0AC: 'TLS_ECDHE_ECDSA_WITH_AES_128_CCM',
391 | 0xC0AD: 'TLS_ECDHE_ECDSA_WITH_AES_256_CCM',
392 | 0xC0AE: 'TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8',
393 | 0xC0AF: 'TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8',
394 | 0xCC13: 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256',
395 | 0xCC14: 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256',
396 | 0xCC15: 'TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256',
397 | 0xCCA8: 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256',
398 | 0xCCA9: 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256',
399 | 0xFEFE: 'SSL_RSA_FIPS_WITH_DES_CBC_SHA',
400 | 0xFEFE: 'SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA',
401 | 0xFFE0: 'SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA',
402 | 0xFFE1: 'SSL_RSA_FIPS_WITH_DES_CBC_SHA'
403 | },
404 | 'compression_methods': {
405 | 0: 'null',
406 | 1: 'Zlib'
407 | },
408 | 'ec_point_formats': {
409 | 0: 'uncompressed',
410 | 1: 'ansiX962_compressed_prime',
411 | 2: 'ansiX962_compressed_char2'
412 | },
413 | 'extension_type': {
414 | 0: 'server_name',
415 | 1: 'max_fragment_length',
416 | 2: 'client_certificate_url',
417 | 3: 'trusted_ca_keys',
418 | 4: 'truncated_hmac',
419 | 5: 'status_request',
420 | 6: 'user_mapping',
421 | 7: 'client_authz',
422 | 8: 'server_authz',
423 | 9: 'cert_type',
424 | 10: 'elliptic_curves',
425 | 11: 'ec_point_formats',
426 | 12: 'srp',
427 | 13: 'signature_algorithms',
428 | 14: 'use_srtp',
429 | 15: 'heartbeat',
430 | 16: 'application_layer_protocol_negotiation',
431 | 17: 'status_request_v2',
432 | 18: 'signed_certificate_timestamp',
433 | 19: 'client_certificate_type',
434 | 20: 'server_certificate_type',
435 | 21: 'padding',
436 | 22: 'encrypt_then_mac',
437 | 23: 'extended_master_secret',
438 | 35: 'SessionTicket_TLS',
439 | 13172: 'next_protocol_negotiation',
440 | 30031: 'channel_id_old',
441 | 30032: 'channel_id',
442 | 62208: 'tack',
443 | 65281: 'renegotiation_info'},
444 | 'heartbeat': {
445 | 0: 'heartbeat_request',
446 | 1: 'peer_allowed_to_send'
447 | },
448 | 'elliptic_curves': {
449 | 1: 'sect163k1',
450 | 2: 'sect163r1',
451 | 3: 'sect163r2',
452 | 4: 'sect193r1',
453 | 5: 'sect193r2',
454 | 6: 'sect233k1',
455 | 7: 'sect233r1',
456 | 8: 'sect239k1',
457 | 9: 'sect283k1',
458 | 10: 'sect283r1',
459 | 11: 'sect409k1',
460 | 12: 'sect409r1',
461 | 13: 'sect571k1',
462 | 14: 'sect571r1',
463 | 15: 'secp160k1',
464 | 16: 'secp160r1',
465 | 17: 'secp160r2',
466 | 18: 'secp192k1',
467 | 19: 'secp192r1',
468 | 20: 'secp224k1',
469 | 21: 'secp224r1',
470 | 22: 'secp256k1',
471 | 23: 'secp256r1',
472 | 24: 'secp384r1',
473 | 25: 'secp521r1',
474 | 26: 'brainpoolP256r1',
475 | 27: 'brainpoolP384r1',
476 | 28: 'brainpoolP512r1',
477 | 256: 'ffdhe2048',
478 | 257: 'ffdhe3072',
479 | 258: 'ffdhe4096',
480 | 259: 'ffdhe6144',
481 | 260: 'ffdhe8192',
482 | 65281: 'arbitrary_explicit_prime_curves',
483 | 65282: 'arbitrary_explicit_char2_curves'
484 | },
485 | 'signature_algorithms_hash': { #RFC 5246
486 | 0: 'none',
487 | 1: 'md5',
488 | 2: 'sha1',
489 | 3: 'sha224',
490 | 4: 'sha256',
491 | 5: 'sha384',
492 | 6: 'sha512'
493 | },
494 | 'signature_algorithms_signature': {
495 | 0: 'anonymous',
496 | 1: 'rsa',
497 | 2: 'dsa',
498 | 3: 'ecdsa'
499 | },
500 | 'status_request': {
501 | 0: 'empty'
502 | },
503 | 'tls_record': {
504 | 20: 'change_cipher',
505 | 21: 'alert',
506 | 22: 'handshake',
507 | 23: 'application_data'
508 | },
509 | 'tls_version': {
510 | 0x300: 'SSL 3.0',
511 | 0x301: 'TLS 1.0',
512 | 0x302: 'TLS 1.1',
513 | 0x303: 'TLS 1.2',
514 | }
515 | }
516 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | dpkt==1.8.6.2
2 | netifaces==0.10.4
3 | pypcap==1.1.4
4 | wheel==0.26.0
5 |
--------------------------------------------------------------------------------
/tpa.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from __future__ import absolute_import
4 | from __future__ import print_function
5 | import argparse
6 | from binascii import hexlify
7 | import socket
8 | import struct
9 | import sys
10 | import textwrap
11 |
12 |
13 | import dpkt
14 | import pcap
15 |
16 | from constants import PRETTY_NAMES
17 |
18 | global streambuffer
19 | streambuffer = {}
20 | global encrypted_streams
21 | encrypted_streams = []
22 |
23 |
24 | class Extension(object):
25 | """
26 | Encapsulates TLS extensions.
27 | """
28 | def __init__(self, payload):
29 | self._type_id, payload = unpacker('H', payload)
30 | self._type_name = pretty_name('extension_type', self._type_id)
31 | self._length, payload = unpacker('H', payload)
32 | # Data contains an array with the 'raw' contents
33 | self._data = None
34 | # pretty_data contains an array with the 'beautified' contents
35 | self._pretty_data = None
36 | if self._length > 0:
37 | self._data, self._pretty_data = parse_extension(payload[:self._length],
38 | self._type_name)
39 |
40 | def __str__(self):
41 | # Prints out data array in textual format
42 | return '{0}: {1}'.format(self._type_name, self._pretty_data)
43 |
44 |
45 | def analyze_packet(_timestamp, packet):
46 | """
47 | Main analysis loop for pcap.
48 | """
49 | eth = dpkt.ethernet.Ethernet(packet)
50 | if isinstance(eth.data, dpkt.ip.IP):
51 | parse_ip_packet(eth.data)
52 |
53 |
54 | def parse_arguments():
55 | """
56 | Parses command line arguments.
57 | """
58 | global filename
59 | global cap_filter
60 | global interface
61 | global verboseprint
62 | parser = argparse.ArgumentParser(
63 | formatter_class=argparse.RawDescriptionHelpFormatter,
64 | description=textwrap.dedent('''\
65 | Captures, parses and shows TLS Handshake packets
66 |
67 | Copyright (C) 2015 Peter Mosmans [Go Forward]
68 | This program is free software: you can redistribute it and/or modify
69 | it under the terms of the GNU General Public License as published by
70 | the Free Software Foundation, either version 3 of the License, or
71 | (at your option) any later version.'''))
72 | parser.add_argument('--filter', action='store',
73 | default='', help='the pcap filter')
74 | parser.add_argument('-i', '--interface', action='store',
75 | default='eth0', help='the interface to listen on')
76 | parser.add_argument('--list-interfaces', action='store_true',
77 | help='list all available interfaces and exit')
78 | parser.add_argument('-r', '--read', metavar='FILE', action='store',
79 | help='read from file (don\'t capture live packets)')
80 | parser.add_argument('-v', '--verbose', action='store_true',
81 | help='increase output verbosity')
82 | args = parser.parse_args()
83 | if args.list_interfaces:
84 | list_interfaces()
85 | exit()
86 | if args.verbose:
87 | def verboseprint(*args):
88 | print('# ', end="")
89 | for arg in args:
90 | print(arg, end="")
91 | print()
92 | else:
93 | verboseprint = lambda *a: None
94 | interface = args.interface
95 | cap_filter = args.filter
96 | filename = None
97 | if args.read:
98 | filename = args.read
99 |
100 |
101 | def list_interfaces():
102 | """
103 | Prints out all available interfaces with IP adresses, when possible.
104 | """
105 | i = 0
106 | for name in pcap.findalldevs():
107 | prettydevicename = ''
108 | queryname = name
109 | if name.startswith(r'\Device\NPF_'):
110 | queryname = name[12:]
111 | if name.endswith('}'):
112 | prettydevicename = 'eth{0} '.format(i)
113 | i += 1
114 | try:
115 | import netifaces
116 | print('{1}{0} {2}'.format(name, prettydevicename,
117 | netifaces.ifaddresses(queryname)
118 | [netifaces.AF_INET][0]['addr']))
119 | except ImportError:
120 | print('{0}{1}'.format(prettydevicename, name))
121 |
122 |
123 | def parse_ip_packet(ip):
124 | """
125 | Parses IP packet.
126 | """
127 | sys.stdout.flush()
128 | if isinstance(ip.data, dpkt.tcp.TCP) and len(ip.data.data):
129 | parse_tcp_packet(ip)
130 |
131 |
132 | def parse_tcp_packet(ip):
133 | """
134 | Parses TCP packet.
135 | """
136 | global streambuffer
137 | global encrypted_streams
138 | connection = '{0}:{1}-{2}:{3}'.format(socket.inet_ntoa(ip.src),
139 | ip.data.sport,
140 | socket.inet_ntoa(ip.dst),
141 | ip.data.dport)
142 | if ord(ip.data.data[0]) in set((20, 21, 22)):
143 | stream = ip.data.data
144 | else:
145 | if streambuffer.has_key(connection):
146 | verboseprint('Added sequence number {0:12d} to buffer'.
147 | format(ip.data.seq))
148 | stream = streambuffer[connection] + ip.data.data
149 | del streambuffer[connection]
150 | if len(stream) > (10000):
151 | verboseprint('Flushed buffer ({0} bytes)'.
152 | format(len(stream)))
153 | else:
154 | if ord(ip.data.data[0]) == 23 and connection in encrypted_streams:
155 | verboseprint('Encrypted data between {0}'.
156 | format(connection))
157 | return
158 | parse_tls_records(ip, stream)
159 |
160 |
161 | def add_to_buffer(ip, partial_stream):
162 | """
163 | Adds partial_stream of ip to global stream buffer.
164 | """
165 | global streambuffer
166 | connection = '{0}:{1}-{2}:{3}'.format(socket.inet_ntoa(ip.src),
167 | ip.data.sport,
168 | socket.inet_ntoa(ip.dst),
169 | ip.data.dport)
170 | streambuffer[connection] = partial_stream
171 | verboseprint('Added {0} bytes (seq {1}) to streambuffer for {2}'.
172 | format(len(partial_stream), ip.data.seq, connection))
173 |
174 |
175 | def parse_tls_records(ip, stream):
176 | """
177 | Parses TLS Records.
178 | """
179 | try:
180 | records, bytes_used = dpkt.ssl.tls_multi_factory(stream)
181 | except dpkt.ssl.SSL3Exception as exception:
182 | verboseprint('exception while parsing TLS records: {0}'.
183 | format(exception))
184 | return
185 | connection = '{0}:{1}-{2}:{3}'.format(socket.inet_ntoa(ip.src),
186 | ip.data.sport,
187 | socket.inet_ntoa(ip.dst),
188 | ip.data.dport)
189 | global encrypted_streams
190 | if bytes_used != len(stream):
191 | add_to_buffer(ip, stream[bytes_used:])
192 | for record in records:
193 | record_type = pretty_name('tls_record', record.type)
194 | verboseprint('captured TLS record type {0}'.format(record_type))
195 | if record_type == 'handshake':
196 | parse_tls_handshake(ip, record.data)
197 | if record_type == 'alert':
198 | parse_alert_message(connection, record.data)
199 | if record_type == 'change_cipher':
200 | print('[+] Change cipher - encrypted messages from now on for {0}'.
201 | format(connection))
202 | encrypted_streams.append(connection)
203 | sys.stdout.flush()
204 |
205 |
206 | def parse_tls_handshake(ip, data):
207 | """
208 | Parses TLS Handshake message contained in data according to their type.
209 | """
210 | connection = '{0}:{1}-{2}:{3}'.format(socket.inet_ntoa(ip.src),
211 | ip.data.sport,
212 | socket.inet_ntoa(ip.dst),
213 | ip.data.dport)
214 | if connection in encrypted_streams:
215 | print('[+] Encrypted handshake message between {0}'.format(connection))
216 | return
217 | else:
218 | try:
219 | handshake_type = ord(data[:1])
220 | verboseprint('First 10 bytes {0}'.
221 | format(hexlify(data[:10])))
222 | if handshake_type == 4:
223 | print('[#] New Session Ticket is not implemented yet')
224 | return
225 | else:
226 | handshake = dpkt.ssl.TLSHandshake(data)
227 | except dpkt.ssl.SSL3Exception as exception:
228 | verboseprint('exception while parsing TLS handshake record: {0}'.
229 | format(exception))
230 | return
231 | except dpkt.dpkt.NeedData as exception:
232 | verboseprint('exception while parsing TLS handshake record: {0}'.
233 | format(exception))
234 | return
235 | client = '{0}:{1}'.format(socket.inet_ntoa(ip.src), ip.data.sport)
236 | server = '{0}:{1}'.format(socket.inet_ntoa(ip.dst), ip.data.dport)
237 | if handshake.type == 0:
238 | print('<- Hello Request {0} <- {1}'.format(client, server))
239 | if handshake.type == 1:
240 | print(' -> ClientHello {0} -> {1}'.format(client, server))
241 | parse_client_hello(handshake)
242 | if handshake.type == 2:
243 | print('<- ServerHello {1} <- {0}'.format(client, server))
244 | parse_server_hello(handshake.data)
245 | if handshake.type == 11:
246 | print('<- Certificate {0} <- {1}'.format(client, server))
247 | if handshake.type == 12:
248 | print('<- ServerKeyExchange {1} <- {0}'.format(server, client))
249 | if handshake.type == 13:
250 | print('<- CertificateRequest {1} <- {0}'.format(client, server))
251 | if handshake.type == 14:
252 | print('<- ServerHelloDone {1} <- {0}'.format(client, server))
253 | if handshake.type == 15:
254 | print(' -> CertificateVerify {0} -> {1}'.format(client, server))
255 | if handshake.type == 16:
256 | print(' -> ClientKeyExchange {0} -> {1}'.format(client, server))
257 | if handshake.type == 20:
258 | print(' -> Finished {0} -> {1}'.format(client, server))
259 |
260 |
261 | def unpacker(type_string, packet):
262 | """
263 | Returns network-order parsed data and the packet minus the parsed data.
264 | """
265 | if type_string.endswith('H'):
266 | length = 2
267 | if type_string.endswith('B'):
268 | length = 1
269 | if type_string.endswith('P'): # 2 bytes for the length of the string
270 | length, packet = unpacker('H', packet)
271 | type_string = '{0}s'.format(length)
272 | if type_string.endswith('p'): # 1 byte for the length of the string
273 | length, packet = unpacker('B', packet)
274 | type_string = '{0}s'.format(length)
275 | data = struct.unpack('!' + type_string, packet[:length])[0]
276 | if type_string.endswith('s'):
277 | data = ''.join(data)
278 | return data, packet[length:]
279 |
280 |
281 | def parse_server_hello(handshake):
282 | """
283 | Parses server hello handshake.
284 | """
285 | payload = handshake.data
286 | session_id, payload = unpacker('p', payload)
287 | cipher_suite, payload = unpacker('H', payload)
288 | print('[*] Cipher: {0}'.format(pretty_name('cipher_suites',
289 | cipher_suite)))
290 | compression, payload = unpacker('B', payload)
291 | print('[*] Compression: {0}'.format(pretty_name('compression_methods',
292 | compression)))
293 | extensions = parse_extensions(payload)
294 | for extension in extensions:
295 | print(' {0}'.format(extension))
296 |
297 |
298 | def parse_client_hello(handshake):
299 | hello = handshake.data
300 | compressions = []
301 | cipher_suites = []
302 | extensions = []
303 | payload = handshake.data.data
304 | session_id, payload = unpacker('p', payload)
305 | cipher_suites, pretty_cipher_suites = parse_extension(payload, 'cipher_suites')
306 | verboseprint('TLS Record Layer Length: {0}'.format(len(handshake)))
307 | verboseprint('Client Hello Version: {0}'.format(dpkt.ssl.ssl3_versions_str[hello.version]))
308 | verboseprint('Client Hello Length: {0}'.format(len(hello)))
309 | verboseprint('Session ID: {0}'.format(hexlify(session_id)))
310 | print('[*] Ciphers: {0}'.format(pretty_cipher_suites))
311 | # consume 2 bytes for each cipher suite plus 2 length bytes
312 | payload = payload[(len(cipher_suites) * 2) + 2:]
313 | compressions, pretty_compressions = parse_extension(payload, 'compression_methods')
314 | print('[*] Compression methods: {0}'.format(pretty_compressions))
315 | # consume 1 byte for each compression method plus 1 length byte
316 | payload = payload[len(compressions) + 1:]
317 | extensions = parse_extensions(payload)
318 | for extension in extensions:
319 | print(' {0}'.format(extension))
320 |
321 |
322 | def parse_extensions(payload):
323 | """
324 | Parse data as one or more TLS extensions.
325 | """
326 | extensions = []
327 | if len(payload) <= 0:
328 | return
329 | print('[*] Extensions:')
330 | extensions_len, payload = unpacker('H', payload)
331 | verboseprint('Extensions Length: {0}'.format(extensions_len))
332 | while len(payload) > 0:
333 | extension = Extension(payload)
334 | extensions.append(extension)
335 | # consume 2 bytes for type and 2 bytes for length
336 | payload = payload[extension._length + 4:]
337 | return extensions
338 |
339 |
340 | def parse_alert_message(connection, payload):
341 | """
342 | Parses a TLS alert message.
343 | """
344 | global encrypted_streams
345 | verboseprint(hexlify(payload))
346 | if connection in encrypted_streams:
347 | print('[+] Encrypted TLS Alert message between {0}'.format(connection))
348 | # presume the alert message ended the encryption
349 | encrypted_streams.remove(connection)
350 | else:
351 | alert_level, payload = unpacker('B', payload)
352 | alert_description, payload = unpacker('B', payload)
353 | print('[+] TLS Alert message between {0}: {1} {2}'.
354 | format(connection, pretty_name('alert_level', alert_level),
355 | pretty_name('alert_description', alert_description)))
356 |
357 |
358 | def parse_extension(payload, type_name):
359 | """
360 | Parses an extension based on the type_name.
361 | Returns an array of raw values as well as an array of prettified values.
362 | """
363 | entries = []
364 | pretty_entries = []
365 | format_list_length = 'H'
366 | format_entry = 'B'
367 | list_length = 0
368 | if type_name == 'elliptic_curves':
369 | format_list_length = 'H'
370 | format_entry = 'H'
371 | if type_name == 'ec_point_formats':
372 | format_list_length = 'B'
373 | if type_name == 'compression_methods':
374 | format_list_length = 'B'
375 | format_entry = 'B'
376 | if type_name == 'heartbeat':
377 | format_list_length = 'B'
378 | format_entry = 'B'
379 | if type_name == 'next_protocol_negotiation':
380 | format_entry = 'p'
381 | else:
382 | if len(payload) > 1: # contents are a list
383 | list_length, payload = unpacker(format_list_length, payload)
384 | verboseprint('type {0}, list type is {1}, number of entries is {2}'.
385 | format(type_name, format_list_length, list_length))
386 | if type_name == 'status_request' or type_name == 'status_request_v2':
387 | _type, payload = unpacker('B', payload)
388 | format_entry = 'H'
389 | if type_name == 'padding':
390 | return payload, hexlify(payload)
391 | if type_name == 'SessionTicket_TLS':
392 | return payload, hexlify(payload)
393 | if type_name == 'cipher_suites':
394 | format_entry = 'H'
395 | if type_name == 'supported_groups':
396 | format_entry = 'H'
397 | if type_name == 'signature_algorithms':
398 | format_entry = 'H'
399 | if type_name == 'cipher_suites':
400 | format_entry = 'H'
401 | if list_length:
402 | payload = payload[:list_length]
403 | while (len(payload) > 0):
404 | if type_name == 'server_name':
405 | _type, payload = unpacker('B', payload)
406 | format_entry = 'P'
407 | if type_name == 'application_layer_protocol_negotiation':
408 | format_entry = 'p'
409 | entry, payload = unpacker(format_entry, payload)
410 | entries.append(entry)
411 | if type_name == 'signature_algorithms':
412 | pretty_entries.append('{0}-{1}'.
413 | format(pretty_name
414 | ('signature_algorithms_hash',
415 | entry >> 8),
416 | pretty_name('signature_algorithms_signature',
417 | entry % 256)))
418 | else:
419 | if format_entry.lower() == 'p':
420 | pretty_entries.append(entry)
421 | else:
422 | pretty_entries.append(pretty_name(type_name, entry))
423 | return entries, pretty_entries
424 |
425 |
426 | def pretty_name(name_type, name_value):
427 | """Returns the pretty name for type name_type."""
428 | if name_type in PRETTY_NAMES:
429 | if name_value in PRETTY_NAMES[name_type]:
430 | name_value = PRETTY_NAMES[name_type][name_value]
431 | else:
432 | name_value = '{0}: unknown value {1}'.format(name_value, name_type)
433 | else:
434 | name_value = 'unknown type: {0}'.format(name_type)
435 | return name_value
436 |
437 |
438 | def main():
439 | """
440 | Main program loop.
441 | """
442 | global cap_filter
443 | global interface
444 | parse_arguments()
445 | if filename:
446 | read_file(filename)
447 | else:
448 | start_listening(interface, cap_filter)
449 |
450 |
451 | def read_file(filename):
452 | try:
453 | with open(filename, 'rb') as f:
454 | capture = dpkt.pcap.Reader(f)
455 | for timestamp, packet in capture:
456 | analyze_packet(timestamp, packet)
457 | except IOError:
458 | print('could not parse {0}'.format(filename))
459 |
460 |
461 | def start_listening(interface, cap_filter):
462 | """
463 | Starts the listening process with an optional filter.
464 | """
465 | try:
466 | capture = pcap.pcap(name=interface)
467 | capture.setfilter(cap_filter)
468 | except OSError as exception:
469 | print('[-] Issue: {0}'.format(exception))
470 | sys.exit(-1)
471 | while True:
472 | print('[+] Listening on {0}'.format(capture.name))
473 | sys.stdout.flush()
474 | capture.loop(0, analyze_packet)
475 | print('[-] Capture stopped unexpectedly, restarting...')
476 |
477 |
478 | if __name__ == "__main__":
479 | main()
480 |
--------------------------------------------------------------------------------