├── .gitignore
├── .travis.yml
├── LICENSE
├── cvsslib
├── __init__.py
├── base_enum.py
├── command.py
├── command2.py
├── contrib
│ ├── __init__.py
│ └── django_model.py
├── cvss2
│ ├── __init__.py
│ ├── calculations.py
│ └── enums.py
├── cvss3
│ ├── __init__.py
│ ├── calculations.py
│ └── enums.py
├── example_vectors.py
├── mixin.py
├── rvss
│ ├── __init__.py
│ ├── calculations.py
│ └── enums.py
├── utils.py
└── vector.py
├── docs
└── readme.md
├── readme.md
├── rvss.jpg
├── setup.py
├── test_requirements.txt
├── tests
├── __init__.py
├── django_app
│ ├── __init__.py
│ ├── app
│ │ ├── __init__.py
│ │ └── models.py
│ ├── manage.py
│ ├── pytest.ini
│ ├── settings.py
│ └── urls.py
├── files
│ ├── vectors_random2
│ ├── vectors_random3
│ ├── vectors_simple2
│ └── vectors_simple3
├── pytest.ini
├── test_django.py
├── test_enums.py
├── test_rvss.py
├── test_vector.py
└── tests_cvss3_rvss.py
└── try.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Python template
3 | # Byte-compiled / optimized / DLL files
4 | __pycache__/
5 | *.py[cod]
6 | *$py.class
7 |
8 | # C extensions
9 | *.so
10 |
11 | # Distribution / packaging
12 | .Python
13 | env/
14 | build/
15 | develop-eggs/
16 | dist/
17 | downloads/
18 | eggs/
19 | .eggs/
20 | lib/
21 | lib64/
22 | parts/
23 | sdist/
24 | var/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | htmlcov/
41 | .tox/
42 | .coverage
43 | .coverage.*
44 | .cache
45 | nosetests.xml
46 | coverage.xml
47 | *,cover
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 |
56 | # Sphinx documentation
57 | docs/_build/
58 |
59 | # PyBuilder
60 | target/
61 | ### JetBrains template
62 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
63 |
64 | *.iml
65 |
66 | ## Directory-based project format:
67 | .idea/
68 | # if you remove the above rule, at least ignore the following:
69 |
70 | # User-specific stuff:
71 | # .idea/workspace.xml
72 | # .idea/tasks.xml
73 | # .idea/dictionaries
74 |
75 | # Sensitive or high-churn files:
76 | # .idea/dataSources.ids
77 | # .idea/dataSources.xml
78 | # .idea/sqlDataSources.xml
79 | # .idea/dynamic.xml
80 | # .idea/uiDesigner.xml
81 |
82 | # Gradle:
83 | # .idea/gradle.xml
84 | # .idea/libraries
85 |
86 | # Mongo Explorer plugin:
87 | # .idea/mongoSettings.xml
88 |
89 | ## File-based project format:
90 | *.ipr
91 | *.iws
92 |
93 | ## Plugin-specific files:
94 |
95 | # IntelliJ
96 | /out/
97 |
98 | # mpeltonen/sbt-idea plugin
99 | .idea_modules/
100 |
101 | # JIRA plugin
102 | atlassian-ide-plugin.xml
103 |
104 | # Crashlytics plugin (for Android Studio and IntelliJ)
105 | com_crashlytics_export_strings.xml
106 | crashlytics.properties
107 | crashlytics-build.properties
108 |
109 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python:
3 | - "3.3"
4 | - "3.4"
5 | - "3.5"
6 | - "pypy3"
7 | # command to install dependencies
8 | install:
9 | - pip install --upgrade pip wheel
10 | - pip install -r test_requirements.txt
11 | - pip install .
12 | # command to run tests
13 | script:
14 | - export PYTHONPATH=./tests/:$PYTHONPATH
15 | - cd tests && py.test . -vv
16 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/cvsslib/__init__.py:
--------------------------------------------------------------------------------
1 | from .mixin import class_mixin
2 | from . import cvss3, cvss2, rvss
3 |
4 |
5 | def make_display_name(str):
6 | return " ".join(
7 | s.capitalize() for s in str.lower().split("_")
8 | )
9 |
10 |
11 | class CVSS2State(class_mixin(cvss2)):
12 | pass
13 |
14 |
15 | class CVSS3State(class_mixin(cvss3)):
16 | pass
17 |
18 | class RVSSState(class_mixin(rvss)):
19 | pass
20 |
21 | from .vector import parse_vector, calculate_vector
22 |
--------------------------------------------------------------------------------
/cvsslib/base_enum.py:
--------------------------------------------------------------------------------
1 | import enum
2 | import inspect
3 |
4 | try:
5 | from functools import lru_cache
6 | except ImportError:
7 | from backports.functools_lru_cache import lru_cache
8 |
9 |
10 | class NotDefined(object):
11 | def __init__(self, value=None):
12 | self.value = value
13 | self.name = "NOT_DEFINED"
14 |
15 |
16 | def make_display_name(str):
17 | return " ".join(
18 | s.capitalize() for s in str.lower().split("_")
19 | )
20 |
21 |
22 | class BaseEnum(enum.Enum):
23 | @classmethod
24 | @lru_cache()
25 | def get_options(cls):
26 | docstring = inspect.getdoc(cls)
27 | if docstring is None:
28 | return {}
29 |
30 | lines = docstring.strip().split("\n")
31 | options = {
32 | line.split(":")[0].lower().strip(): line.split(":")[1].strip()
33 | for line in lines
34 | }
35 | return options
36 |
37 | @classmethod
38 | def members(self):
39 | return (
40 | (name, value) for name, value in self.__members__.items() if not name.startswith("_")
41 | )
42 |
43 | @classmethod
44 | def get_default(cls):
45 | if hasattr(cls, "NOT_DEFINED"):
46 | default = cls.NOT_DEFINED
47 | elif hasattr(cls, "NONE"):
48 | default = cls.NONE
49 | else:
50 | default = cls(min(value.value for name, value in cls.members()))
51 | return default
52 |
53 | def get_value_key(self):
54 | default_vectors = {}
55 |
56 | cls = self.__class__
57 | if hasattr(cls, "_vectors"):
58 | default_vectors = {name: vec for vec, name in cls._vectors.value.items()}
59 |
60 | if self.name == "NOT_DEFINED":
61 | return None
62 | elif self.name in default_vectors.keys():
63 | for key, v in default_vectors.items():
64 | if key == self.name:
65 | return v.upper()
66 | else:
67 | value = self.name[0]
68 |
69 | return value.upper()
70 |
71 | @classmethod
72 | @lru_cache()
73 | def get_value_from_vector_key(cls, key):
74 | key = key.lower()
75 | # print(key)
76 |
77 | if key in {"x", "nd"} and hasattr(cls, "NOT_DEFINED"):
78 | return cls.NOT_DEFINED
79 |
80 | vector_override = {}
81 |
82 | if hasattr(cls, "_vectors"):
83 | vector_override = cls._vectors.value
84 |
85 | if key in vector_override:
86 | # print(getattr(cls, vector_override[key]))
87 | return getattr(cls, vector_override[key])
88 |
89 | # print(cls.members())
90 | for name, value in cls.members():
91 | # print(name.lower())
92 | if name == "NOT_DEFINED" or name in vector_override.values():
93 | continue
94 |
95 | if name[0].lower() == key:
96 | # print(type(value))
97 | return value
98 |
99 | raise RuntimeError("Unknown vector key '{0}' for {1}".format(key, cls.__name__))
100 |
101 | @classmethod
102 | def choices(cls):
103 | return [(value.value if not isinstance(value.value, NotDefined) else value.value.value,
104 | make_display_name(name)) for name, value in cls.members()]
105 |
106 | @classmethod
107 | def extend(cls, name, extra, doc="", mod=None):
108 | new_cls = enum.Enum(
109 | value=name,
110 | names=cls.to_mapping(extra),
111 | type=BaseEnum
112 | )
113 | new_cls._parent = cls
114 | new_cls.__doc__ = doc or cls.__doc__
115 | new_cls.__module__ = mod or cls.__module__
116 | return new_cls
117 |
118 | @classmethod
119 | def to_mapping(cls, extra=None):
120 | returner = {
121 | name: value.value
122 | for name, value in cls.members()
123 | }
124 |
125 | if extra:
126 | returner.update(extra)
127 |
128 | return returner
129 |
--------------------------------------------------------------------------------
/cvsslib/command.py:
--------------------------------------------------------------------------------
1 | from cvsslib.vector import detect_vector, calculate_vector, VectorError
2 | from cvsslib import cvss2, cvss3
3 | import argparse
4 |
5 |
6 | def main():
7 | parser = argparse.ArgumentParser(description="Calculate CVSS scores from a vector")
8 | parser.add_argument('vector')
9 | parser.add_argument('-v', default=None, dest="version", type=int, help="CVSS version to use (default: autodetect)")
10 | args = parser.parse_args()
11 |
12 | module = None
13 |
14 | if args.version is not None:
15 | module = {2: cvss2, 3: cvss3}[args.version]
16 | else:
17 | module = detect_vector(args.vector)
18 |
19 | try:
20 | results = calculate_vector(args.vector, module)
21 | except VectorError as e:
22 | print("Error parsing vector: {0}".format(e.message))
23 | else:
24 | print("Base Score:\t{0}".format(results[0]))
25 | print("Temporal:\t{0}".format(results[1]))
26 | print("Environment:\t{0}".format(results[2]))
27 |
28 |
29 | if __name__ == "__main__":
30 | main()
31 |
--------------------------------------------------------------------------------
/cvsslib/command2.py:
--------------------------------------------------------------------------------
1 | from cvsslib.vector import detect_vector, calculate_vector, VectorError
2 | # from cvsslib import cvss2, cvss3, rvss
3 | from cvsslib import rvss
4 | import argparse
5 |
6 |
7 | def main():
8 | parser = argparse.ArgumentParser(description="Calculate RVSS scores from a vector")
9 | parser.add_argument('vector')
10 | parser.add_argument('-v', default=None, dest="version", type=int, help="RVSS version to use (default: autodetect)")
11 | args = parser.parse_args()
12 |
13 | module = None
14 |
15 | if args.version is not None:
16 | module = {2: cvss2, 3: cvss3}[args.version]
17 | else:
18 | module = detect_vector(args.vector)
19 |
20 | if not(module):
21 | raise NotImplementedError("module not detected")
22 |
23 | try:
24 | results = calculate_vector(args.vector, module)
25 | except VectorError as e:
26 | print("Error parsing vector: {0}".format(e.message))
27 | else:
28 | print("Base Score:\t{0}".format(results[0]))
29 | print("Temporal:\t{0}".format(results[1]))
30 | print("Environment:\t{0}".format(results[2]))
31 |
32 |
33 | if __name__ == "__main__":
34 | main()
35 |
--------------------------------------------------------------------------------
/cvsslib/contrib/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aliasrobotics/RVSS/dc064f0c168df0e382a4673e7087af9bd80277a2/cvsslib/contrib/__init__.py
--------------------------------------------------------------------------------
/cvsslib/contrib/django_model.py:
--------------------------------------------------------------------------------
1 | import operator
2 |
3 | from django.db.models.base import ModelBase
4 |
5 | from enumfields import EnumField
6 |
7 | from cvsslib.mixin import cvss_mixin_data, utils_mixin
8 | from cvsslib.base_enum import NotDefined
9 |
10 |
11 | class KeyedEnumField(EnumField):
12 | """
13 | An enum field that stores the names of the values as strings, rather than the values.
14 | """
15 | def get_prep_value(self, value):
16 | if isinstance(value, str):
17 | return value
18 |
19 | return value.name
20 |
21 | def to_python(self, value):
22 | if isinstance(value, str):
23 | return getattr(self.enum, value)
24 | return super().to_python(value)
25 |
26 | def get_default(self):
27 | if self.has_default():
28 | if self.default is None:
29 | return None
30 |
31 | if isinstance(self.default, str):
32 | return self.default
33 |
34 | return super().get_default()
35 |
36 |
37 | def django_mixin(module, base=ModelBase, attr_name=None):
38 | # This is a function that takes a module (filled with enums and a function called 'calculate')
39 | # and wires it up into a Django model that we can use.
40 |
41 | def field_callback(name, enum_cls):
42 | choices = enum_cls.choices()
43 | nullable = any((isinstance(o, NotDefined) and o.value.value is None) or
44 | o.value is None for o in enum_cls)
45 |
46 | max_length = max(len(o.name) for o in enum_cls)
47 |
48 | default = enum_cls.get_default()
49 |
50 | return KeyedEnumField(enum_cls,
51 | choices=choices,
52 | default=default.name,
53 | max_length=max_length,
54 | null=nullable)
55 |
56 | mixin_data, enum_map = cvss_mixin_data(module, field_callback)
57 | Utils = utils_mixin(module, enum_map)
58 |
59 | class DjangoUtils(Utils):
60 | def debug(self):
61 | result = []
62 | fields = [(field.attname, getattr(self, field.attname))
63 | for field in self._meta.get_fields()
64 | if isinstance(field, KeyedEnumField)]
65 |
66 | ordered_enums = sorted(fields, key=operator.itemgetter(0))
67 | for name, value in ordered_enums:
68 | result.append("{name} = {value}".format(name=name, value=value))
69 |
70 | return result
71 |
72 | class MetaClass(base):
73 | def __new__(cls, name, bases, attrs):
74 | cls_base = DjangoUtils
75 |
76 | if "__module__" in attrs:
77 | DjangoUtils.__module__ = attrs["__module__"]
78 |
79 | bases = (cls_base,) + bases
80 |
81 | return super().__new__(cls, name, bases, attrs)
82 |
83 | @classmethod
84 | def __prepare__(mcs, *args, **kwargs):
85 | returner = super().__prepare__(*args, **kwargs)
86 | returner.update(mixin_data)
87 |
88 | return returner
89 |
90 | MetaClass.django_utils = DjangoUtils
91 |
92 | if attr_name:
93 | DjangoUtils.__name__ = attr_name + ".django_utils"
94 |
95 | return MetaClass
96 |
--------------------------------------------------------------------------------
/cvsslib/cvss2/__init__.py:
--------------------------------------------------------------------------------
1 | from . import enums
2 | from .calculations import *
--------------------------------------------------------------------------------
/cvsslib/cvss2/calculations.py:
--------------------------------------------------------------------------------
1 | from .enums import *
2 | from cvsslib.base_enum import NotDefined
3 |
4 |
5 | def calculate_impact(conf: ConfidentialityImpact,
6 | integ: IntegrityImpact,
7 | avail: AvailabilityImpact):
8 | # Impact = 10.41*(1-(1-ConfImpact)*(1-IntegImpact)*(1-AvailImpact))
9 | return D("10.41") * \
10 | (1 -
11 | (1 - conf) *
12 | (1 - integ) *
13 | (1 - avail))
14 |
15 |
16 | def calculate_exploitability(access: AccessVector,
17 | complexity: AccessComplexity,
18 | auth: Authentication):
19 | # Exploitability = 20* AccessVector*AccessComplexity*Authentication
20 | return D("20") * access * complexity * auth
21 |
22 |
23 | def calculate_base_score(run_calculation, impact_function):
24 | # BaseScore = round_to_1_decimal(((0.6*Impact)+(0.4*Exploitability)-1.5)*f(Impact))
25 | # f(impact)= 0 if Impact=0, 1.176 otherwise
26 | impact = run_calculation(impact_function)
27 | exploitability = run_calculation(calculate_exploitability)
28 |
29 | result = (D("0.6") * impact) + (D("0.4") * exploitability) - D("1.5")
30 | f_impact = 0 if impact == 0 else D("1.176")
31 |
32 | return round(result * f_impact, 1)
33 |
34 |
35 | # emporalScore = round_to_1_decimal(BaseScore*Exploitability*RemediationLevel*ReportConfidence)
36 | def calculate_temporal_score(base_score,
37 | exploit: Exploitability,
38 | remediation: RemediationLevel,
39 | confidence: ReportConfidence):
40 | return round(base_score * exploit * remediation * confidence, 1)
41 |
42 |
43 | # AdjustedImpact = min(10,10.41*(1-(1-ConfImpact*ConfReq)*(1-IntegImpact*IntegReq)*(1-AvailImpact*AvailReq)))
44 | def calculate_adjusted_impact(conf_impact: ConfidentialityImpact,
45 | conf_req: ConfidentialityRequirement,
46 | integ_impact: IntegrityImpact,
47 | integ_req: IntegrityRequirement,
48 | avail_impact: AvailabilityImpact,
49 | avail_req: AvailabilityRequirement):
50 | return min(
51 | 10,
52 | D("10.41") * (
53 | 1 - (
54 | (1 - conf_impact * conf_req) *
55 | (1 - integ_impact * integ_req) *
56 | (1 - avail_impact * avail_req)
57 | )
58 | )
59 | )
60 |
61 |
62 | # EnvironmentalScore = round_to_1_decimal((AdjustedTemporal+(10-AdjustedTemporal)
63 | # *CollateralDamagePotential)*TargetDistribution)
64 | #
65 | # AdjustedTemporal = TemporalScore recomputed with the BaseScores Impact sub-equation
66 | # replaced with the AdjustedImpact equation
67 | def calculate_environmental_score(run_calculation,
68 | collat_damage: CollateralDamagePotential,
69 | target_dist: TargetDistribution):
70 | adjusted_base_score = run_calculation(calculate_base_score, calculate_adjusted_impact)
71 | adjusted_temporal = run_calculation(calculate_temporal_score, adjusted_base_score)
72 |
73 | return round(
74 | (adjusted_temporal +
75 | (10 - adjusted_temporal) *
76 | collat_damage) *
77 | target_dist, 1
78 | )
79 |
80 |
81 | def calculate(run_calculation, get):
82 | # We pass `calculate_impact` here because we need to pass a different impact function while computing the
83 | # environmental score
84 | base_score = run_calculation(calculate_base_score, calculate_impact)
85 |
86 | temporal_metrics = {get(Exploitability), get(RemediationLevel), get(ReportConfidence)}
87 | if all(isinstance(e.value, NotDefined) for e in temporal_metrics):
88 | temporal_score = None
89 | else:
90 | temporal_score = float(run_calculation(calculate_temporal_score, base_score))
91 |
92 | environment_metrics = {get(cls) for cls in ENVIRONMENTAL_METRICS}
93 | if all(isinstance(e.value, NotDefined) for e in environment_metrics):
94 | environmental_score = None
95 | else:
96 | environmental_score = float(run_calculation(calculate_environmental_score))
97 |
98 | return float(base_score), temporal_score, environmental_score
99 |
--------------------------------------------------------------------------------
/cvsslib/cvss2/enums.py:
--------------------------------------------------------------------------------
1 | from decimal import Decimal as D
2 | from cvsslib.base_enum import BaseEnum, NotDefined
3 |
4 |
5 | # Taken from https://www.first.org/cvss/v2/guide#i3.2.1
6 |
7 | class AccessVector(BaseEnum):
8 | """
9 | Vector: AV
10 | """
11 | LOCAL_ACCESS = D("0.395")
12 | ADJACENT_NETWORK = D("0.646")
13 | NETWORK_ACCESSIBLE = D("1")
14 |
15 |
16 | class AccessComplexity(BaseEnum):
17 | """
18 | Vector: AC
19 | """
20 | HIGH = D("0.35")
21 | MEDIUM = D("0.61")
22 | LOW = D("0.71")
23 |
24 |
25 | class Authentication(BaseEnum):
26 | """
27 | Vector: Au
28 | """
29 | MULTIPLE = D("0.45")
30 | SINGLE = D("0.56")
31 | NONE = D("0.704")
32 |
33 |
34 | class ConfidentialityImpact(BaseEnum):
35 | """
36 | Vector: C
37 | """
38 | NONE = D("0")
39 | PARTIAL = D("0.275")
40 | COMPLETE = D("0.660")
41 |
42 |
43 | class IntegrityImpact(BaseEnum):
44 | """
45 | Vector: I
46 | """
47 | NONE = D("0")
48 | PARTIAL = D("0.275")
49 | COMPLETE = D("0.660")
50 |
51 |
52 | class AvailabilityImpact(BaseEnum):
53 | """
54 | Vector: A
55 | """
56 | NONE = D("0")
57 | PARTIAL = D("0.275")
58 | COMPLETE = D("0.660")
59 |
60 |
61 | # Temporal:
62 | class Exploitability(BaseEnum):
63 | """
64 | Vector: E
65 | """
66 | UNPROVEN = D("0.85")
67 | PROOF_OF_CONCEPT = D("0.9")
68 | FUNCTIONAL = D("0.95")
69 | HIGH = D("1")
70 | NOT_DEFINED = NotDefined(D("1"))
71 |
72 | _vectors = {
73 | "poc": "PROOF_OF_CONCEPT"
74 | }
75 |
76 |
77 | class RemediationLevel(BaseEnum):
78 | """
79 | Vector: RL
80 | """
81 | OFFICIAL_FIX = D("0.87")
82 | TEMPORARY_FIX = D("0.90")
83 | WORKAROUND = D("0.95")
84 | UNAVAILABLE = D("1")
85 | NOT_DEFINED = NotDefined(D("1"))
86 |
87 | _vectors = {
88 | "of": "OFFICIAL_FIX",
89 | "tf": "TEMPORARY_FIX"
90 | }
91 |
92 |
93 | class ReportConfidence(BaseEnum):
94 | """
95 | Vector: RC
96 | """
97 | UNCONFIRMED = D("0.9")
98 | UNCORROBORATED = D("0.95")
99 | CONFIRMED = D("1")
100 | NOT_DEFINED = NotDefined(D("1"))
101 |
102 | _vectors = {
103 | "uc": "UNCONFIRMED",
104 | "ur": "UNCORROBORATED"
105 | }
106 |
107 |
108 | # Environmental
109 | class CollateralDamagePotential(BaseEnum):
110 | """
111 | Vector: CDP
112 | """
113 | NONE = D("0")
114 | LOW = D("0.1")
115 | LOW_MEDIUM = D("0.3")
116 | MEDIUM_HIGH = D("0.4")
117 | HIGH = D("0.5")
118 | NOT_DEFINED = NotDefined(D("0"))
119 |
120 | _vectors = {
121 | "lm": "LOW_MEDIUM",
122 | "mh": "MEDIUM_HIGH"
123 | }
124 |
125 |
126 | class TargetDistribution(BaseEnum):
127 | """
128 | Vector: TD
129 | """
130 | NONE = D("0")
131 | LOW = D("0.25")
132 | MEDIUM = D("0.75")
133 | HIGH = D("1")
134 | NOT_DEFINED = NotDefined(D("1"))
135 |
136 |
137 | class ConfidentialityRequirement(BaseEnum):
138 | """
139 | Vector: CR
140 | """
141 | LOW = D("0.5")
142 | MEDIUM = D("1")
143 | HIGH = D("1.51")
144 | NOT_DEFINED = NotDefined(D("1"))
145 |
146 |
147 | class IntegrityRequirement(BaseEnum):
148 | """
149 | Vector: IR
150 | """
151 | LOW = D("0.5")
152 | MEDIUM = D("1")
153 | HIGH = D("1.51")
154 | NOT_DEFINED = NotDefined(D("1"))
155 |
156 |
157 | class AvailabilityRequirement(BaseEnum):
158 | """
159 | Vector: AR
160 | """
161 | LOW = D("0.5")
162 | MEDIUM = D("1.0")
163 | HIGH = D("1.51")
164 | NOT_DEFINED = NotDefined(D("1.0"))
165 |
166 |
167 | ENVIRONMENTAL_METRICS = {
168 | CollateralDamagePotential,
169 | TargetDistribution,
170 | ConfidentialityRequirement,
171 | IntegrityRequirement,
172 | AvailabilityRequirement
173 | }
174 |
175 | ORDERING = (
176 | AccessVector,
177 | AccessComplexity,
178 | Authentication,
179 |
180 | ConfidentialityImpact,
181 | IntegrityImpact,
182 | AvailabilityImpact,
183 |
184 | Exploitability,
185 | RemediationLevel,
186 | ReportConfidence,
187 |
188 | CollateralDamagePotential,
189 | TargetDistribution,
190 |
191 | ConfidentialityRequirement,
192 | IntegrityRequirement,
193 | AvailabilityRequirement
194 | )
--------------------------------------------------------------------------------
/cvsslib/cvss3/__init__.py:
--------------------------------------------------------------------------------
1 | from .enums import *
2 | from .calculations import *
3 |
4 |
--------------------------------------------------------------------------------
/cvsslib/cvss3/calculations.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 | from .enums import *
4 | from decimal import Decimal as D
5 | from cvsslib.base_enum import NotDefined
6 | import decimal
7 |
8 |
9 | EXPLOITABILITY_COEFFECIENT = D("8.22")
10 | IMPACT_UNCHANGED_COEFFECIENT = D("6.42")
11 | IMPACT_CHANGED_COEFFECIENT = D("7.52")
12 |
13 |
14 | def roundup(num):
15 | return D(math.ceil(num * 10) / 10).quantize(D("0.1"))
16 |
17 |
18 | def calculate_exploitability_sub_score(attack_vector: AttackVector,
19 | complexity: AttackComplexity,
20 | privilege: PrivilegeRequired,
21 | interaction: UserInteraction):
22 | return EXPLOITABILITY_COEFFECIENT * attack_vector * complexity * privilege * interaction
23 |
24 |
25 | def calculate_modified_exploitability_sub_score(vector: ModifiedAttackVector,
26 | complexity: ModifiedAttackComplexity,
27 | privilege: ModifiedPrivilegesRequired,
28 | interaction: ModifiedUserInteraction):
29 | # print("modified complexity: " + str(complexity))
30 | # print("modified privilege: " + str(privilege))
31 | # print("modified interaction: " + str(interaction))
32 | return EXPLOITABILITY_COEFFECIENT * vector * complexity * privilege * interaction
33 |
34 |
35 | def calculate_impact_sub_score(scope: Scope,
36 | conf_impact: ConfidentialityImpact,
37 | integ_impact: IntegrityImpact,
38 | avail_impact: AvailabilityImpact):
39 | base_impact_sub_score = 1 - ((1 - conf_impact) * (1 - integ_impact) * (1 - avail_impact))
40 |
41 | if scope == Scope.UNCHANGED.value:
42 | return IMPACT_UNCHANGED_COEFFECIENT * base_impact_sub_score
43 | else:
44 | # What they hell are people smoking...
45 | return IMPACT_CHANGED_COEFFECIENT *\
46 | (base_impact_sub_score - D("0.029")) -\
47 | D("3.25") * D(math.pow(base_impact_sub_score - D("0.02"), 15))
48 |
49 |
50 | def calculate_modified_impact_sub_score(scope: ModifiedScope,
51 | modified_conf: ModifiedConfidentialityImpact,
52 | modified_integ: ModifiedIntegrityImpact,
53 | modified_avail: ModifiedAvailabilityImpact,
54 | conf_req: ConfidentialityRequirement,
55 | integ_req: IntegrityRequirement,
56 | avail_req: AvailabilityRequirement):
57 | modified = min(
58 | 1 -
59 | (1 - modified_conf * conf_req) *
60 | (1 - modified_integ * integ_req) *
61 | (1 - modified_avail * avail_req),
62 | 0.915
63 | )
64 |
65 | if scope == ModifiedScope.UNCHANGED.value:
66 | return IMPACT_UNCHANGED_COEFFECIENT * decimal.Decimal(modified)
67 | else:
68 | return IMPACT_CHANGED_COEFFECIENT * (decimal.Decimal(modified) - D("0.029")) - D("3.25") * D(math.pow(decimal.Decimal(modified) - D(0.02), 15))
69 |
70 |
71 | def calculate_base_score(run_calculation, scope: Scope, privilege: PrivilegeRequired):
72 | impact_sub_score = run_calculation(calculate_impact_sub_score)
73 |
74 | if impact_sub_score <= 0:
75 | return 0
76 | else:
77 |
78 | override = {}
79 | if scope == Scope.CHANGED.value:
80 | # Ok, so the privilege enum needs slightly different values depending on the scope. God damn.
81 | modified_privilege = PrivilegeRequired.extend("PrivilegeRequired", {"LOW": D("0.68"), "HIGH": D("0.50")})
82 | privilege = getattr(modified_privilege, PrivilegeRequired(privilege).name)
83 | override[PrivilegeRequired] = privilege.value
84 |
85 | exploitability_sub_score = run_calculation(calculate_exploitability_sub_score, override=override)
86 |
87 | combined_score = impact_sub_score + exploitability_sub_score
88 |
89 | if scope == Scope.CHANGED.value:
90 | return roundup(min(D("1.08") * combined_score, 10))
91 | else:
92 | return roundup(min(combined_score, 10))
93 |
94 |
95 | def calculate_temporal_score(base_score,
96 | maturity: ExploitCodeMaturity,
97 | remediation: RemediationLevel,
98 | confidence: ReportConfidence):
99 | return roundup(base_score * maturity * remediation * confidence)
100 |
101 |
102 | def calculate_environmental_score(run_calculation,
103 | modified_scope: ModifiedScope,
104 | exploit_code: ExploitCodeMaturity,
105 | remediation: RemediationLevel,
106 | confidence: ReportConfidence,
107 | privilege: ModifiedPrivilegesRequired):
108 |
109 | modified_impact_sub_score = run_calculation(calculate_modified_impact_sub_score)
110 |
111 | if modified_impact_sub_score <= 0:
112 | return 0
113 |
114 | if modified_scope == ModifiedScope.CHANGED.value:
115 | # Ok, so the privilege enum needs slightly different values depending on the scope. God damn.
116 | modified_privilege = ModifiedPrivilegesRequired.extend("ModifiedPrivilegeRequired", {"LOW": D("0.68"), "HIGH": D("0.50")})
117 | privilege = getattr(modified_privilege, ModifiedPrivilegesRequired(privilege).name).value
118 |
119 | modified_exploitability_sub_score = run_calculation(calculate_modified_exploitability_sub_score,
120 | override={ModifiedPrivilegesRequired: privilege})
121 |
122 | if modified_scope == ModifiedScope.UNCHANGED.value:
123 | return roundup(
124 | roundup(min(modified_impact_sub_score + modified_exploitability_sub_score, 10)) *
125 | exploit_code * remediation * confidence
126 | )
127 | else:
128 | return roundup(
129 | roundup(min(D("1.08") * (modified_impact_sub_score + modified_exploitability_sub_score), 10)) *
130 | exploit_code * remediation * confidence
131 | )
132 |
133 |
134 | def calculate(run_calculation, get):
135 | base_score = run_calculation(calculate_base_score)
136 | temporal_score = run_calculation(calculate_temporal_score, base_score)
137 |
138 | override = {}
139 |
140 | for optional_enum in OPTIONAL_VALUES:
141 | set_value = get(optional_enum)
142 |
143 | if isinstance(set_value.value, NotDefined):
144 | # Override the value with the non-optional one
145 | parent_enum_class = optional_enum._parent
146 | parent_enum_value = get(parent_enum_class)
147 | override[optional_enum] = parent_enum_value.value
148 |
149 | environment_score = run_calculation(calculate_environmental_score, override=override)
150 |
151 | return float(base_score), float(temporal_score), float(environment_score)
152 |
--------------------------------------------------------------------------------
/cvsslib/cvss3/enums.py:
--------------------------------------------------------------------------------
1 | from decimal import Decimal as D
2 |
3 | from cvsslib.base_enum import BaseEnum, NotDefined
4 |
5 |
6 | # Taken from https://www.first.org/cvss/specification-document#i8.4
7 |
8 | # Exploitability metrics
9 | class AttackVector(BaseEnum):
10 | """
11 | Vector: AV
12 | Mandatory: yes
13 | """
14 | NETWORK = D("0.85")
15 | ADJACENT_NETWORK = D("0.62")
16 | LOCAL = D("0.55")
17 | PHYSICAL = D("0.2")
18 |
19 | class AttackComplexity(BaseEnum):
20 | """
21 | Vector: AC
22 | Mandatory: yes
23 | """
24 | LOW = D("0.77")
25 | HIGH = D("0.44")
26 |
27 |
28 | class PrivilegeRequired(BaseEnum):
29 | """
30 | Vector: PR
31 | Mandatory: yes
32 | """
33 | NONE = D("0.85")
34 | LOW = D("0.62")
35 | HIGH = D("0.27")
36 |
37 |
38 | class UserInteraction(BaseEnum):
39 | """
40 | Vector: UI
41 | Mandatory: yes
42 | """
43 | NONE = D("0.85")
44 | REQUIRED = D("0.62")
45 |
46 |
47 | class Scope(BaseEnum):
48 | """
49 | Vector: S
50 | Mandatory: yes
51 | """
52 | UNCHANGED = D("0")
53 | CHANGED = D("1")
54 |
55 |
56 | # Impacts
57 | class ConfidentialityImpact(BaseEnum):
58 | """
59 | Vector: C
60 | Mandatory: yes
61 | """
62 | HIGH = D("0.56")
63 | LOW = D("0.22")
64 | NONE = D("0")
65 |
66 |
67 | class IntegrityImpact(BaseEnum):
68 | """
69 | Vector: I
70 | Mandatory: yes
71 | """
72 | HIGH = D("0.56")
73 | LOW = D("0.22")
74 | NONE = D("0")
75 |
76 |
77 | class AvailabilityImpact(BaseEnum):
78 | """
79 | Vector: A
80 | Mandatory: yes
81 | """
82 | HIGH = D("0.56")
83 | LOW = D("0.22")
84 | NONE = D("0")
85 |
86 |
87 | # Temporal metrics
88 | class ExploitCodeMaturity(BaseEnum):
89 | """
90 | Vector: E
91 | """
92 | NOT_DEFINED = NotDefined(D("1"))
93 | HIGH = D("1")
94 | FUNCTIONAL = D("0.97")
95 | PROOF_OF_CONCEPT = D("0.94")
96 | UNPROVEN = D("0.91")
97 |
98 |
99 | class RemediationLevel(BaseEnum):
100 | """
101 | Vector: RL
102 | """
103 | NOT_DEFINED = NotDefined(D("1"))
104 | UNAVAILABLE = D("1")
105 | WORKAROUND = D("0.97")
106 | TEMPORARY_FIX = D("0.96")
107 | OFFICIAL_FIX = D("0.95")
108 |
109 |
110 | class ReportConfidence(BaseEnum):
111 | """
112 | Vector: RC
113 | """
114 | NOT_DEFINED = NotDefined(D("1"))
115 | CONFIRMED = D("1")
116 | REASONABLE = D("0.96")
117 | UNKNOWN = D("0.92")
118 |
119 |
120 | class ConfidentialityRequirement(BaseEnum):
121 | """
122 | Vector: CR
123 | """
124 | NOT_DEFINED = NotDefined(D("1"))
125 | HIGH = D("1.5")
126 | MEDIUM = D("1")
127 | LOW = D("0.5")
128 |
129 |
130 | class IntegrityRequirement(BaseEnum):
131 | """
132 | Vector: IR
133 | """
134 | NOT_DEFINED = NotDefined(D("1"))
135 | HIGH = D("1.5")
136 | MEDIUM = D("1")
137 | LOW = D("0.5")
138 |
139 |
140 | class AvailabilityRequirement(BaseEnum):
141 | """
142 | Vector: AR
143 | """
144 | NOT_DEFINED = NotDefined(D("1"))
145 | HIGH = D("1.5")
146 | MEDIUM = D("1")
147 | LOW = D("0.5")
148 |
149 |
150 | ModifiedAttackVector = AttackVector.extend("ModifiedAttackVector",
151 | {"NOT_DEFINED": NotDefined()},
152 | "Vector: MAV")
153 |
154 | ModifiedAttackComplexity = AttackComplexity.extend("ModifiedAttackComplexity", {"NOT_DEFINED": NotDefined()},
155 | "Vector: MAC")
156 |
157 | ModifiedPrivilegesRequired = PrivilegeRequired.extend("ModifiedPrivilegesRequired", {"NOT_DEFINED": NotDefined()},
158 | "Vector: MPR")
159 |
160 | ModifiedUserInteraction = UserInteraction.extend("ModifiedUserInteraction", {"NOT_DEFINED": NotDefined()},
161 | "Vector: MUI")
162 |
163 | ModifiedScope = Scope.extend("ModifiedScope", {"NOT_DEFINED": NotDefined()}, "Vector: MS")
164 |
165 | ModifiedConfidentialityImpact = ConfidentialityImpact.extend("ModifiedConfidentialityImpact",
166 | {"NOT_DEFINED": NotDefined()}, "Vector: MC")
167 |
168 | ModifiedIntegrityImpact = IntegrityImpact.extend("ModifiedIntegrityImpact", {"NOT_DEFINED": NotDefined()}, "Vector: MI")
169 |
170 | ModifiedAvailabilityImpact = AvailabilityImpact.extend("ModifiedAvailabilityImpact", {"NOT_DEFINED": NotDefined()},
171 | "Vector: MA")
172 |
173 | OPTIONAL_VALUES = {
174 | ModifiedAttackVector, ModifiedAttackComplexity, ModifiedPrivilegesRequired,
175 | ModifiedUserInteraction, ModifiedScope, ModifiedConfidentialityImpact,
176 | ModifiedIntegrityImpact, ModifiedAvailabilityImpact
177 | }
178 |
179 | ORDERING = (
180 | AttackVector,
181 | AttackComplexity,
182 | PrivilegeRequired,
183 | UserInteraction,
184 |
185 | Scope,
186 | ConfidentialityImpact,
187 | IntegrityImpact,
188 | AvailabilityImpact,
189 |
190 | ExploitCodeMaturity,
191 | RemediationLevel,
192 | ReportConfidence,
193 |
194 | ConfidentialityRequirement,
195 | IntegrityRequirement,
196 | AvailabilityRequirement,
197 |
198 | ModifiedAttackVector,
199 | ModifiedAttackComplexity,
200 | ModifiedPrivilegesRequired,
201 | ModifiedUserInteraction,
202 | ModifiedScope,
203 |
204 | ModifiedConfidentialityImpact,
205 | ModifiedIntegrityImpact,
206 | ModifiedAvailabilityImpact
207 | )
208 |
--------------------------------------------------------------------------------
/cvsslib/example_vectors.py:
--------------------------------------------------------------------------------
1 | v3_vectors = [
2 | ("CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N/MAV:A/MAC:L/MPR:N/MUI:N/MS:U/MC:N/MI:N/MA:N", (4.6, 4.6, 0.0)),
3 | ("CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N/MAV:A/MAC:L/MPR:N/MUI:N/MS:U/MC:L/MI:N/MA:N", (4.6, 4.6, 4.3)),
4 | ("CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/E:H/RL:W/RC:U/CR:H/IR:H/AR:M/MAV:L/MAC:L/MPR:H/MUI:N/MS:C/MC:N/MI:H/MA:L", (5.8, 5.2, 7.4)),
5 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N", (0.0, 0.0, 0.0)),
6 | ("CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N", (5.8, 5.8, 7.1)),
7 | ("CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:H", (8.2, 8.2, 8.2)),
8 | ("CVSS:3.0/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L/E:U/RL:U/RC:R/CR:M/MPR:L/MUI:R/MI:N/MA:H", (7.7, 6.8, 6.3)),
9 | ("CVSS:3.0/AV:L/AC:H/PR:H/UI:N/S:C/C:N/I:H/A:N/E:P/RL:U/RC:U/CR:H/IR:L/AR:H/MAV:L/MUI:R/MS:C/MC:N/MI:L/MA:N", (5.3, 4.6, 1.3)),
10 |
11 | # Taken from the CVSS examples page: https://www.first.org/cvss/examples
12 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", (6.1, 6.1, 6.1)),
13 | ("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N", (6.4, 6.4, 6.4)),
14 | ("CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N", (3.1, 3.1, 3.1)),
15 | ("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H", (9.9, 9.9, 9.9)),
16 | ("CVSS:3.0/AV:L/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L", (4.2, 4.2, 4.2)),
17 | ("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", (8.8, 8.8, 8.8)),
18 | ("CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", (7.8, 7.8, 7.8)),
19 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", (7.5, 7.5, 7.5)),
20 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", (9.8, 9.8, 9.8)),
21 | ("CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N", (6.8, 6.8, 6.8)),
22 | ("CVSS:3.0/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", (6.8, 6.8, 6.8)),
23 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N", (5.8, 5.8, 5.8)),
24 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N", (5.8, 5.8, 5.8)),
25 | ("CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:H", (9.3, 9.3, 9.3)),
26 | ("CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", (5.4, 5.4, 5.4)),
27 | ("CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", (7.8, 7.8, 7.8)),
28 | ("CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", (8.8, 8.8, 8.8)),
29 | ("CVSS:3.0/AV:P/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N", (4.6, 4.6, 4.6)),
30 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", (8.8, 8.8, 8.8)),
31 | ("CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N", (7.4, 7.4, 7.4)),
32 | ("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H", (9.6, 9.6, 9.6))
33 | ]
34 |
35 |
36 | v2_vectors = [
37 | ("AV:L/AC:M/Au:S/C:N/I:P/A:C/E:U/RL:OF/RC:UR/CDP:N/TD:L/CR:H/IR:H/AR:H", (5, 3.5, 1.2)),
38 | ("AV:N/AC:M/Au:M/C:C/I:N/A:P/RL:W/RC:UC/CDP:LM/TD:M/CR:L/IR:L/AR:L", (6.4, 5.5, 4)),
39 | ("AV:L/AC:L/Au:S/C:P/I:P/A:P/E:U/RC:C/CDP:LM/TD:L/IR:H/AR:M", (4.3, 3.7, 1.5)),
40 | ("AV:A/AC:M/Au:S/C:C/I:P/A:C", (7, None, None)),
41 |
42 | # From the example document
43 | ("AV:N/AC:M/Au:N/C:N/I:P/A:N", (4.3, None, None)),
44 | ("AV:N/AC:L/Au:S/C:P/I:P/A:N", (5.5, None, None)),
45 | ("AV:N/AC:M/Au:N/C:P/I:N/A:N", (4.3, None, None)),
46 | ("AV:N/AC:L/Au:S/C:C/I:C/A:C", (9, None, None)),
47 | ("AV:L/AC:L/Au:N/C:P/I:P/A:P", (4.6, None, None)),
48 | ("AV:N/AC:M/Au:S/C:C/I:C/A:C", (8.5, None, None)),
49 | ("AV:N/AC:M/Au:N/C:P/I:P/A:P", (6.8, None, None)),
50 | ("AV:N/AC:L/Au:N/C:P/I:N/A:N", (5, None, None)),
51 | ("AV:N/AC:L/Au:N/C:C/I:C/A:C", (10, None, None)),
52 | ("AV:N/AC:L/Au:N/C:N/I:P/A:N", (5, None, None)),
53 | ("AV:L/AC:M/Au:N/C:C/I:C/A:C", (6.9, None, None)),
54 | ("AV:N/AC:L/Au:N/C:P/I:N/A:N", (5, None, None)),
55 | ("AV:N/AC:L/Au:N/C:N/I:P/A:N", (5, None, None)),
56 | ("AV:A/AC:L/Au:N/C:N/I:C/A:N", (6.1, None, None)),
57 | ("AV:N/AC:M/Au:N/C:N/I:P/A:N", (4.3, None, None)),
58 | ("AV:N/AC:M/Au:N/C:C/I:C/A:C", (9.3, None, None)),
59 | ("AV:A/AC:L/Au:N/C:C/I:C/A:C", (8.3, None, None)),
60 | ("AV:L/AC:L/Au:N/C:N/I:C/A:N", (4.9, None, None)),
61 | ("AV:N/AC:M/Au:N/C:P/I:P/A:P", (6.8, None, None)),
62 | ("AV:N/AC:L/Au:N/C:C/I:C/A:C", (10, None, None))
63 | ]
64 |
--------------------------------------------------------------------------------
/cvsslib/mixin.py:
--------------------------------------------------------------------------------
1 | from functools import partial
2 | from .utils import get_enums, run_calc
3 | from .vector import to_vector, parse_vector
4 | import operator
5 |
6 |
7 | class BaseCVSSUtilsMixin(object):
8 | ENUM_MODULE = None
9 |
10 | @classmethod
11 | def enum_module(cls):
12 | return cls.ENUM_MODULE
13 |
14 | def debug(self):
15 | result = []
16 |
17 | ordered_enums = sorted(get_enums(self, only_classes=False), key=operator.itemgetter(0))
18 | for name, value in ordered_enums:
19 | result.append("{name} = {value}".format(name=name, value=value))
20 |
21 | return result
22 |
23 |
24 | def make_attribute_name(str):
25 | """
26 | Turns strings like AttackVector and ExploitCodeMaturity into
27 | attack_vector and exploit_code_maturity
28 | """
29 | returner = ""
30 |
31 | for idx, char in enumerate(str):
32 | if char.isupper() and idx != 0:
33 | returner += "_"
34 | returner += char.lower()
35 |
36 | return returner
37 |
38 |
39 | def cvss_mixin_data(module, field_callback=None):
40 | returner = {}
41 | enum_dict = {}
42 |
43 | for name, obj in get_enums(module):
44 | attr_name = make_attribute_name(name)
45 | default = obj.get_default()
46 |
47 | if field_callback is None:
48 | returner[attr_name] = default
49 | else:
50 | returner[attr_name] = field_callback(attr_name, obj)
51 |
52 | enum_dict[obj] = attr_name
53 |
54 | return returner, enum_dict
55 |
56 |
57 | def utils_mixin(module, enum_map):
58 | calculate_func = getattr(module, "calculate", None)
59 |
60 | if not calculate_func:
61 | raise RuntimeError("Cannot find 'calculate' method in {module}".format(module=module))
62 |
63 | class CVSSUtilsMixin(BaseCVSSUtilsMixin):
64 | ENUM_MODULE = module
65 |
66 | def _getter(self, enum_type):
67 | member_name = enum_map[enum_type]
68 | return getattr(self, member_name)
69 |
70 | # Make the 'calculate' method
71 | def calculate(self):
72 | return run_calc(calculate_func, getter=self._getter)
73 |
74 | def to_vector(self):
75 | return to_vector(module, self._getter)
76 |
77 | def from_vector(self, vector_result, **kwargs):
78 | if isinstance(vector_result, str):
79 | vector_result = parse_vector(vector_result, module, **kwargs)
80 |
81 | for cls, value in vector_result.items():
82 | attr_name = enum_map[cls]
83 | setattr(self, attr_name, value)
84 |
85 | return CVSSUtilsMixin
86 |
87 |
88 | def class_mixin(module, base=object):
89 | mixin_data, enum_map = cvss_mixin_data(module)
90 | Utils = utils_mixin(module, enum_map)
91 |
92 | class CVSSMixin(Utils, base):
93 | def __init__(self, *args, **kwargs):
94 | # enum_map maps an enum class to it's attribute name.
95 | for thing, value in mixin_data.items():
96 | setattr(self, thing, value)
97 |
98 | super().__init__(*args, **kwargs)
99 |
100 | @property
101 | def enums(self):
102 | return get_enums(self, only_classes=False)
103 |
104 | @property
105 | def enums_map(self):
106 | return enum_map
107 |
108 | return CVSSMixin
109 |
--------------------------------------------------------------------------------
/cvsslib/rvss/__init__.py:
--------------------------------------------------------------------------------
1 | from .enums import *
2 | from .calculations import *
3 |
4 |
--------------------------------------------------------------------------------
/cvsslib/rvss/calculations.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 | from .enums import *
4 | from decimal import Decimal as D
5 | from cvsslib.base_enum import NotDefined
6 | import decimal
7 |
8 | EXPLOITABILITY_COEFFECIENT = D("8.22")
9 | IMPACT_UNCHANGED_COEFFECIENT = D("6.42")
10 | IMPACT_CHANGED_COEFFECIENT = D("7.52")
11 |
12 |
13 | def roundup(num):
14 | return D(math.ceil(num * 10) / 10).quantize(D("0.1"))
15 |
16 |
17 | def calculate_exploitability_sub_score(attack_vector: AttackVector,
18 | complexity: AttackComplexity,
19 | privilege: PrivilegeRequired,
20 | interaction: UserInteraction,
21 | age:Age):
22 | # print("age: " + str(age))
23 | return EXPLOITABILITY_COEFFECIENT * attack_vector * complexity * privilege * interaction * age
24 |
25 | def calculate_modified_exploitability_sub_score(vector: ModifiedAttackVector,
26 | complexity: ModifiedAttackComplexity,
27 | privilege: ModifiedPrivilegesRequired,
28 | interaction: ModifiedUserInteraction,
29 | age: ModifiedAge):
30 | # print("modified complexity: " + str(complexity))
31 | # print("modified privilege: " + str(privilege))
32 | # print("modified interaction: " + str(interaction))
33 | # print("modified age: " + str(age))
34 | return EXPLOITABILITY_COEFFECIENT * vector * complexity * privilege * interaction * age
35 |
36 |
37 | def calculate_impact_sub_score(scope: Scope,
38 | conf_impact: ConfidentialityImpact,
39 | integ_impact: IntegrityImpact,
40 | avail_impact: AvailabilityImpact,
41 | safe_impact: SafetyImpact):
42 |
43 |
44 | safety_weight = decimal.Decimal(1.2)
45 | # safety setup 2
46 | base_impact_sub_score = 1 - ((1 - conf_impact) * (1 - integ_impact) * (1 - avail_impact)) \
47 | + safety_weight * safe_impact
48 |
49 | # base_impact_sub_score_old = 1 - ((1 - conf_impact) * (1 - integ_impact) * (1 - avail_impact))
50 |
51 | # print("actual: ", base_impact_sub_score)
52 | # print("old: ", base_impact_sub_score_old)
53 |
54 | # # safety setup 1
55 | # base_impact_sub_score = safety_weight * safe_impact - ((1 - conf_impact) * (1 - integ_impact)
56 | # * (1 - avail_impact))
57 |
58 | if scope == Scope.UNCHANGED.value:
59 | # print("actual final: ", IMPACT_UNCHANGED_COEFFECIENT * base_impact_sub_score)
60 | # print("old final: ",IMPACT_UNCHANGED_COEFFECIENT * base_impact_sub_score_old)
61 | return IMPACT_UNCHANGED_COEFFECIENT * base_impact_sub_score
62 | else:
63 | if base_impact_sub_score > 1.0:
64 | base_impact_sub_score = D(1.0) # trim the base_impact_sub_score
65 | # Slighly modify the math so that it still rates as before
66 | changed_value = IMPACT_CHANGED_COEFFECIENT *\
67 | (base_impact_sub_score - D("0.029")) -\
68 | D("3.25") * D(math.pow(base_impact_sub_score - D("0.04"), 15))
69 | # print("changed_value: ", changed_value)
70 | return changed_value
71 |
72 | else:
73 | changed_value = IMPACT_CHANGED_COEFFECIENT *\
74 | (base_impact_sub_score - D("0.029")) -\
75 | D("3.25") * D(math.pow(base_impact_sub_score - D("0.02"), 15))
76 | # print("changed_value: ", changed_value)
77 | return changed_value
78 |
79 |
80 | def calculate_modified_impact_sub_score(scope: ModifiedScope,
81 | modified_conf: ModifiedConfidentialityImpact,
82 | modified_integ: ModifiedIntegrityImpact,
83 | modified_avail: ModifiedAvailabilityImpact,
84 | modified_safe: ModifiedSafetyImpact,
85 | conf_req: ConfidentialityRequirement,
86 | integ_req: IntegrityRequirement,
87 | avail_req: AvailabilityRequirement,
88 | safe_req: SafetyRequirement):
89 | # print(modified_safe)
90 | # print(safe_req)
91 |
92 | safety_weight = decimal.Decimal(1.2)
93 | # safety setup 2
94 | modified = min(
95 | 1 -
96 | (1 - modified_conf * conf_req) *
97 | (1 - modified_integ * integ_req) *
98 | (1 - modified_avail * avail_req),
99 | 0.915) + safety_weight * modified_safe * safe_req
100 |
101 | # # safety setup 1
102 | # modified = safety_weight * modified_safe * safe_req - (1 - modified_conf * conf_req) \
103 | # * (1 - modified_integ * integ_req) * (1 - modified_avail * avail_req)
104 |
105 |
106 | if scope == ModifiedScope.UNCHANGED.value:
107 | # print("calculating")
108 | # print(type(IMPACT_UNCHANGED_COEFFECIENT)) # Decimal.decimal
109 | # print(type(modified)) # float
110 | # print(IMPACT_UNCHANGED_COEFFECIENT * decimal.Decimal(modified))
111 | return IMPACT_UNCHANGED_COEFFECIENT * decimal.Decimal(modified)
112 | else:
113 | if modified > 1.0:
114 | modified = D(1.0) # trim the modified value
115 | return IMPACT_CHANGED_COEFFECIENT * (decimal.Decimal(modified) - \
116 | D("0.029")) - D("3.25") * \
117 | D(math.pow(decimal.Decimal(modified) - D(0.04), 15))
118 | else:
119 | return IMPACT_CHANGED_COEFFECIENT * (decimal.Decimal(modified) - \
120 | D("0.029")) - D("3.25") * \
121 | D(math.pow(decimal.Decimal(modified) - D(0.02), 15))
122 |
123 |
124 | def calculate_base_score(run_calculation, scope: Scope, privilege: PrivilegeRequired):
125 | impact_sub_score = run_calculation(calculate_impact_sub_score)
126 |
127 | if impact_sub_score <= 0:
128 | return 0
129 | else:
130 |
131 | override = {}
132 | if scope == Scope.CHANGED.value:
133 | # Ok, so the privilege enum needs slightly different values depending on the scope. God damn.
134 | modified_privilege = PrivilegeRequired.extend("PrivilegeRequired", {"LOW": D("0.68"), "HIGH": D("0.50")})
135 | privilege = getattr(modified_privilege, PrivilegeRequired(privilege).name)
136 | override[PrivilegeRequired] = privilege.value
137 |
138 | exploitability_sub_score = run_calculation(calculate_exploitability_sub_score, override=override)
139 |
140 | combined_score = impact_sub_score + exploitability_sub_score
141 |
142 | if scope == Scope.CHANGED.value:
143 | return roundup(min(D("1.08") * combined_score, 10))
144 | else:
145 | return roundup(min(combined_score, 10))
146 |
147 |
148 | def calculate_temporal_score(base_score,
149 | maturity: ExploitCodeMaturity,
150 | remediation: RemediationLevel,
151 | confidence: ReportConfidence):
152 | return roundup(base_score * maturity * remediation * confidence)
153 |
154 |
155 | def calculate_environmental_score(run_calculation,
156 | modified_scope: ModifiedScope,
157 | exploit_code: ExploitCodeMaturity,
158 | remediation: RemediationLevel,
159 | confidence: ReportConfidence,
160 | privilege: ModifiedPrivilegesRequired):
161 |
162 | modified_impact_sub_score = run_calculation(calculate_modified_impact_sub_score)
163 | # print(modified_impact_sub_score)
164 |
165 | if modified_impact_sub_score <= 0:
166 | return 0
167 |
168 | if modified_scope == ModifiedScope.CHANGED.value:
169 | # Ok, so the privilege enum needs slightly different values depending on the scope. God damn.
170 | modified_privilege = ModifiedPrivilegesRequired.extend("ModifiedPrivilegeRequired", {"LOW": D("0.68"), "HIGH": D("0.50")})
171 | privilege = getattr(modified_privilege, ModifiedPrivilegesRequired(privilege).name).value
172 |
173 | modified_exploitability_sub_score = run_calculation(calculate_modified_exploitability_sub_score,
174 | override={ModifiedPrivilegesRequired: privilege})
175 |
176 | if modified_scope == ModifiedScope.UNCHANGED.value:
177 | return roundup(
178 | roundup(min(modified_impact_sub_score + modified_exploitability_sub_score, 10)) *
179 | exploit_code * remediation * confidence
180 | )
181 | else:
182 | return roundup(
183 | roundup(min(D("1.08") * (modified_impact_sub_score + modified_exploitability_sub_score), 10)) *
184 | exploit_code * remediation * confidence
185 | )
186 |
187 |
188 | def calculate(run_calculation, get):
189 | base_score = run_calculation(calculate_base_score)
190 | temporal_score = run_calculation(calculate_temporal_score, base_score)
191 |
192 | override = {}
193 |
194 | for optional_enum in OPTIONAL_VALUES:
195 | set_value = get(optional_enum)
196 |
197 | if isinstance(set_value.value, NotDefined):
198 | # Override the value with the non-optional one
199 | parent_enum_class = optional_enum._parent
200 | parent_enum_value = get(parent_enum_class)
201 | override[optional_enum] = parent_enum_value.value
202 |
203 | environment_score = run_calculation(calculate_environmental_score, override=override)
204 |
205 | return float(base_score), float(temporal_score), float(environment_score)
206 |
--------------------------------------------------------------------------------
/cvsslib/rvss/enums.py:
--------------------------------------------------------------------------------
1 | from decimal import Decimal as D
2 |
3 | from cvsslib.base_enum import BaseEnum, NotDefined
4 |
5 |
6 | # Taken from https://www.first.org/cvss/specification-document#i8.4
7 |
8 | # Exploitability metrics
9 | class AttackVector(BaseEnum):
10 | """
11 | Vector: AV
12 | Mandatory: yes
13 | """
14 | # NETWORK = D("0.85")
15 | # ADJACENT_NETWORK = D("0.62")
16 | # LOCAL = D("0.55")
17 | # PHYSICAL = D("0.2")
18 |
19 | REMOTE_NETWORK = D("0.85")
20 | ADJACENT_NETWORK = D("0.62")
21 | INTERNAL_NETWORK = D("0.4")
22 | LOCAL = D("0.55")
23 | PHYSICAL_PUBLIC = D("0.62")
24 | PHYSICAL_RESTRICTED = D("0.4")
25 | PHYSICAL_ISOLATED = D("0.2")
26 |
27 | # combinations
28 | # REMOTE_NETWORK_AND_PHYSICAL_PUBLIC = D("0.85")*D("0.62")
29 | REMOTE_NETWORK_AND_PHYSICAL_PUBLIC = REMOTE_NETWORK * PHYSICAL_PUBLIC
30 | REMOTE_NETWORK_AND_PHYSICAL_RESTRICTED = REMOTE_NETWORK * PHYSICAL_RESTRICTED
31 | REMOTE_NETWORK_AND_PHYSICAL_ISOLATED = REMOTE_NETWORK * PHYSICAL_ISOLATED
32 |
33 | ADJACENT_NETWORK_AND_PHYSICAL_PUBLIC = ADJACENT_NETWORK * PHYSICAL_PUBLIC
34 | ADJACENT_NETWORK_AND_PHYSICAL_RESTRICTED = ADJACENT_NETWORK * PHYSICAL_RESTRICTED
35 | ADJACENT_NETWORK_AND_PHYSICAL_ISOLATED = ADJACENT_NETWORK * PHYSICAL_ISOLATED
36 |
37 | INTERNAL_NETWORK_AND_PHYSICAL_PUBLIC = INTERNAL_NETWORK * PHYSICAL_PUBLIC
38 | INTERNAL_NETWORK_AND_PHYSICAL_RESTRICTED = INTERNAL_NETWORK * PHYSICAL_RESTRICTED
39 | INTERNAL_NETWORK_AND_PHYSICAL_ISOLATED = INTERNAL_NETWORK * PHYSICAL_ISOLATED
40 |
41 | PHYSICAL_PUBLIC_AND_LOCAL = PHYSICAL_PUBLIC * LOCAL
42 | PHYSICAL_RESTRICTED_AND_LOCAL = PHYSICAL_RESTRICTED * LOCAL
43 | PHYSICAL_ISOLATED_AND_LOCAL = PHYSICAL_ISOLATED * LOCAL
44 |
45 | _vectors = {
46 | "rn": "REMOTE_NETWORK",
47 | "an": "ADJACENT_NETWORK",
48 | "in": "INTERNAL_NETWORK",
49 | "l": "LOCAL",
50 | "pp": "PHYSICAL_PUBLIC",
51 | "pr": "PHYSICAL_RESTRICTED",
52 | "pi": "PHYSICAL_ISOLATED",
53 | # combinations
54 | "rnpp": "REMOTE_NETWORK_AND_PHYSICAL_PUBLIC",
55 | "rnpr": "REMOTE_NETWORK_AND_PHYSICAL_RESTRICTED",
56 | "rnpi": "REMOTE_NETWORK_AND_PHYSICAL_ISOLATED",
57 | "anpp": "ADJACENT_NETWORK_AND_PHYSICAL_PUBLIC",
58 | "anpr": "ADJACENT_NETWORK_AND_PHYSICAL_RESTRICTED",
59 | "anpi": "ADJACENT_NETWORK_AND_PHYSICAL_ISOLATED",
60 | "inpp": "INTERNAL_NETWORK_AND_PHYSICAL_PUBLIC",
61 | "inpr": "INTERNAL_NETWORK_AND_PHYSICAL_RESTRICTED",
62 | "inpi": "INTERNAL_NETWORK_AND_PHYSICAL_ISOLATED",
63 | "ppl": "PHYSICAL_PUBLIC_AND_LOCAL",
64 | "prl": "PHYSICAL_RESTRICTED_AND_LOCAL",
65 | "pil": "PHYSICAL_ISOLATED_AND_LOCAL",
66 | }
67 |
68 | class AttackComplexity(BaseEnum):
69 | """
70 | Vector: AC
71 | Mandatory: yes
72 | """
73 | LOW = D("0.77")
74 | HIGH = D("0.44")
75 |
76 |
77 | class PrivilegeRequired(BaseEnum):
78 | """
79 | Vector: PR
80 | Mandatory: yes
81 | """
82 | NONE = D("0.85")
83 | LOW = D("0.62")
84 | HIGH = D("0.27")
85 |
86 |
87 | class UserInteraction(BaseEnum):
88 | """
89 | Vector: UI
90 | Mandatory: yes
91 | """
92 | NONE = D("0.85")
93 | REQUIRED = D("0.62")
94 |
95 | class Age(BaseEnum):
96 | """
97 | Vector: Y
98 | Mandatory: yes
99 | """
100 | ZERODAY = D("1.0")
101 | ONEYEAR = D("1.1")
102 | THREEYEARS = D("1.3")
103 | MORE3YEARS = D("1.5")
104 | UNKNOWN = D("1.0")
105 |
106 | _vectors = {
107 | "z": "ZERODAY",
108 | "o": "ONEYEAR",
109 | "t": "THREEYEARS",
110 | "m": "MORE3YEARS",
111 | "u": "UNKNOWN",
112 | }
113 |
114 | class Scope(BaseEnum):
115 | """
116 | Vector: S
117 | Mandatory: yes
118 | """
119 | UNCHANGED = D("0")
120 | CHANGED = D("1")
121 |
122 |
123 | # Impacts
124 | class ConfidentialityImpact(BaseEnum):
125 | """
126 | Vector: C
127 | Mandatory: yes
128 | """
129 | HIGH = D("0.56")
130 | LOW = D("0.22")
131 | NONE = D("0")
132 |
133 |
134 | class IntegrityImpact(BaseEnum):
135 | """
136 | Vector: I
137 | Mandatory: yes
138 | """
139 | HIGH = D("0.56")
140 | LOW = D("0.22")
141 | NONE = D("0")
142 |
143 |
144 | class AvailabilityImpact(BaseEnum):
145 | """
146 | Vector: A
147 | Mandatory: yes
148 | """
149 | HIGH = D("0.56")
150 | LOW = D("0.22")
151 | NONE = D("0")
152 |
153 | class SafetyImpact(BaseEnum):
154 | """
155 | Vector: H
156 | Mandatory: yes
157 | """
158 | # # safety setup 1
159 | # NONE = D("0.4")
160 | # UNKNOWN = D("0.5")
161 | # ENVIRONMENTAL = D("0.7")
162 | # HUMAN = D("1.0")
163 |
164 | # safety setup 2
165 | NONE = D("0")
166 | UNKNOWN = D("0")
167 | ENVIRONMENTAL = D("0.15")
168 | HUMAN = D("0.35")
169 |
170 | _vectors = {
171 | "u": "UNKNOWN",
172 | "n": "NONE",
173 | "e": "ENVIRONMENTAL",
174 | "h": "HUMAN",
175 | }
176 |
177 |
178 | # Temporal metrics
179 | class ExploitCodeMaturity(BaseEnum):
180 | """
181 | Vector: E
182 | """
183 | NOT_DEFINED = NotDefined(D("1"))
184 | HIGH = D("1")
185 | FUNCTIONAL = D("0.97")
186 | PROOF_OF_CONCEPT = D("0.94")
187 | UNPROVEN = D("0.91")
188 |
189 |
190 | class RemediationLevel(BaseEnum):
191 | """
192 | Vector: RL
193 | """
194 | NOT_DEFINED = NotDefined(D("1"))
195 | UNAVAILABLE = D("1")
196 | WORKAROUND = D("0.97")
197 | TEMPORARY_FIX = D("0.96")
198 | OFFICIAL_FIX = D("0.95")
199 |
200 |
201 | class ReportConfidence(BaseEnum):
202 | """
203 | Vector: RC
204 | """
205 | NOT_DEFINED = NotDefined(D("1"))
206 | CONFIRMED = D("1")
207 | REASONABLE = D("0.96")
208 | UNKNOWN = D("0.92")
209 |
210 |
211 | class ConfidentialityRequirement(BaseEnum):
212 | """
213 | Vector: CR
214 | """
215 | NOT_DEFINED = NotDefined(D("1"))
216 | HIGH = D("1.5")
217 | MEDIUM = D("1")
218 | LOW = D("0.5")
219 |
220 |
221 | class IntegrityRequirement(BaseEnum):
222 | """
223 | Vector: IR
224 | """
225 | NOT_DEFINED = NotDefined(D("1"))
226 | HIGH = D("1.5")
227 | MEDIUM = D("1")
228 | LOW = D("0.5")
229 |
230 |
231 | class AvailabilityRequirement(BaseEnum):
232 | """
233 | Vector: AR
234 | """
235 | NOT_DEFINED = NotDefined(D("1"))
236 | HIGH = D("1.5")
237 | MEDIUM = D("1")
238 | LOW = D("0.5")
239 |
240 | class SafetyRequirement(BaseEnum):
241 | """
242 | Vector: HR
243 | """
244 | NOT_DEFINED = NotDefined(D("1"))
245 | HIGH = D("1.5")
246 | MEDIUM = D("1")
247 | LOW = D("0.5")
248 |
249 | ModifiedAttackVector = AttackVector.extend("ModifiedAttackVector",
250 | {"NOT_DEFINED": NotDefined()},
251 | "Vector: MAV")
252 |
253 | ModifiedAttackComplexity = AttackComplexity.extend("ModifiedAttackComplexity", {"NOT_DEFINED": NotDefined()},
254 | "Vector: MAC")
255 |
256 | ModifiedPrivilegesRequired = PrivilegeRequired.extend("ModifiedPrivilegesRequired", {"NOT_DEFINED": NotDefined()},
257 | "Vector: MPR")
258 |
259 | ModifiedUserInteraction = UserInteraction.extend("ModifiedUserInteraction", {"NOT_DEFINED": NotDefined()},
260 | "Vector: MUI")
261 |
262 | ModifiedAge = Age.extend("ModifiedAge", {"NOT_DEFINED": NotDefined()},
263 | "Vector: MY")
264 |
265 | ModifiedScope = Scope.extend("ModifiedScope", {"NOT_DEFINED": NotDefined()}, "Vector: MS")
266 |
267 | ModifiedConfidentialityImpact = ConfidentialityImpact.extend("ModifiedConfidentialityImpact",
268 | {"NOT_DEFINED": NotDefined()}, "Vector: MC")
269 |
270 | ModifiedIntegrityImpact = IntegrityImpact.extend("ModifiedIntegrityImpact", {"NOT_DEFINED": NotDefined()}, "Vector: MI")
271 |
272 | ModifiedAvailabilityImpact = AvailabilityImpact.extend("ModifiedAvailabilityImpact", {"NOT_DEFINED": NotDefined()},
273 | "Vector: MA")
274 |
275 | ModifiedSafetyImpact = SafetyImpact.extend("ModifiedSafetyImpact", {"NOT_DEFINED": NotDefined()},
276 | "Vector: MH")
277 |
278 |
279 | OPTIONAL_VALUES = {
280 | ModifiedAttackVector, ModifiedAttackComplexity, ModifiedPrivilegesRequired,
281 | ModifiedUserInteraction, ModifiedAge, ModifiedScope, ModifiedConfidentialityImpact,
282 | ModifiedIntegrityImpact, ModifiedAvailabilityImpact, ModifiedSafetyImpact
283 | }
284 |
285 | ORDERING = (
286 | AttackVector,
287 | AttackComplexity,
288 | PrivilegeRequired,
289 | UserInteraction,
290 | Age,
291 |
292 | Scope,
293 | ConfidentialityImpact,
294 | IntegrityImpact,
295 | AvailabilityImpact,
296 | SafetyImpact,
297 |
298 | ExploitCodeMaturity,
299 | RemediationLevel,
300 | ReportConfidence,
301 |
302 | ConfidentialityRequirement,
303 | IntegrityRequirement,
304 | AvailabilityRequirement,
305 | SafetyRequirement,
306 |
307 | ModifiedAttackVector,
308 | ModifiedAttackComplexity,
309 | ModifiedPrivilegesRequired,
310 | ModifiedUserInteraction,
311 | ModifiedAge,
312 | ModifiedScope,
313 |
314 | ModifiedConfidentialityImpact,
315 | ModifiedIntegrityImpact,
316 | ModifiedAvailabilityImpact,
317 | ModifiedSafetyImpact
318 | )
319 |
--------------------------------------------------------------------------------
/cvsslib/utils.py:
--------------------------------------------------------------------------------
1 | import inspect
2 | from functools import partial
3 | from .base_enum import BaseEnum, NotDefined
4 |
5 | try:
6 | from functools import lru_cache
7 | except ImportError:
8 | from backports.functools_lru_cache import lru_cache
9 |
10 |
11 | @lru_cache(100)
12 | def _cached_get_argspec(func):
13 | return inspect.getfullargspec(func)
14 |
15 |
16 | def get_enums(obj, only_classes=True):
17 | module_members = inspect.getmembers(obj)
18 |
19 | for name, obj in module_members:
20 | if inspect.isclass(obj):
21 | process = issubclass(obj, BaseEnum)
22 | elif not only_classes:
23 | process = isinstance(obj, BaseEnum)
24 | else:
25 | continue
26 |
27 | if process and obj is not BaseEnum:
28 | yield name, obj
29 |
30 |
31 | def run_calc(function, *args, getter=None,
32 | override=None, _parent_override=None,
33 | override_types=None, _parent_override_types=None,
34 | **kwargs):
35 | if getter is None:
36 | raise RuntimeError("Must supply a getter argument!")
37 |
38 | override_types = override_types or {}
39 | override = override or {}
40 |
41 | if _parent_override:
42 | _parent_override.update(override)
43 | override = _parent_override
44 |
45 | if _parent_override_types:
46 | _parent_override_types.update(override_types)
47 | override_types = _parent_override_types
48 |
49 | def argument_getter(*args, **kwargs):
50 | res = getter(*args, **kwargs)
51 | if isinstance(res.value, NotDefined):
52 | return res.value.value
53 | return res.value
54 |
55 | default_args = {
56 | "run_calculation": partial(run_calc, getter=getter,
57 | _parent_override=override,
58 | _parent_override_types=override_types),
59 | "get": getter
60 | }
61 |
62 | extra_args = list(args)
63 | call_args = []
64 | argspec = _cached_get_argspec(function)
65 |
66 | for func_arg in argspec.args:
67 | if func_arg not in argspec.annotations:
68 | if func_arg in default_args:
69 | call_args.append(default_args[func_arg])
70 | elif len(extra_args) == 0:
71 | raise RuntimeError("Not enough arguments passed to {0} ({1})".format(function.__name__, func_arg))
72 | else:
73 | call_args.append(extra_args.pop())
74 | continue
75 |
76 | annotated_type = argspec.annotations[func_arg]
77 | annotated_type_name = annotated_type.__name__
78 |
79 | if annotated_type_name in override_types:
80 | annotated_type = override_types[annotated_type_name]
81 |
82 | if override and annotated_type in override:
83 | value = override[annotated_type]
84 | else:
85 | value = argument_getter(annotated_type)
86 |
87 | call_args.append(
88 | value
89 | )
90 |
91 | result = function(*call_args, **kwargs)
92 | return result
93 |
--------------------------------------------------------------------------------
/cvsslib/vector.py:
--------------------------------------------------------------------------------
1 | import operator
2 |
3 | from cvsslib import cvss3, cvss2, rvss
4 | from cvsslib.utils import get_enums, run_calc
5 |
6 |
7 | class VectorError(ValueError):
8 | def __init__(self, message):
9 | self.message = message
10 |
11 |
12 | def detect_vector(vector):
13 | if vector.startswith("CVSS"):
14 | if vector.startswith("CVSS:3.0"):
15 | module = cvss3
16 | else:
17 | module = cvss2
18 | else:
19 | if vector.startswith("RVSS:1.0"):
20 | module = rvss
21 | else:
22 | module = None
23 |
24 |
25 | return module
26 |
27 |
28 | def to_vector(module, getter):
29 | vectors = []
30 |
31 | ordering = getattr(module, 'ORDERING', None)
32 |
33 | for name, enum in get_enums(module):
34 | enum_attr = getter(enum)
35 | vector = enum_attr.get_options()["vector"]
36 |
37 | key = enum_attr.get_value_key()
38 |
39 | if key is None:
40 | continue
41 |
42 | vectors.append((vector, key, ordering.index(enum) if ordering else None))
43 |
44 | if ordering:
45 | vectors = sorted(vectors, key=operator.itemgetter(2))
46 | vectors = ("{0}:{1}".format(vector, key) for vector, key, _ in vectors)
47 | else:
48 | vectors = ("{0}:{1}".format(vector, key) for vector, key, _ in vectors)
49 | vectors = sorted(vectors)
50 |
51 | res = "/".join(vectors)
52 | if module is cvss3:
53 | res = "CVSS:3.0/" + res
54 |
55 | return res
56 |
57 |
58 | def calculate_vector(vector, module):
59 | vector_values = parse_vector(vector, module)
60 |
61 | def _getter(enum_type):
62 | if enum_type not in vector_values:
63 | ret = enum_type.get_default()
64 | else:
65 | ret = vector_values[enum_type]
66 |
67 | return ret
68 |
69 | return run_calc(module.calculate, getter=_getter)
70 |
71 |
72 | def parse_vector(vector, module=None, mandatory_error=True):
73 | if module is None:
74 | module = detect_vector(vector)
75 |
76 | vector_map, vector_values = {}, {}
77 | mandatory_keys, given_keys = set(), set()
78 | enums = dict(get_enums(module))
79 |
80 | for name, enum in enums.items():
81 | options = enum.get_options()
82 | vector_name = options["vector"]
83 |
84 | vector_map[vector_name] = enum
85 | if options.get("mandatory", "") == "yes":
86 | mandatory_keys.add(vector_name)
87 |
88 | split_vector = vector.split("/")
89 |
90 | for part in split_vector:
91 | if not part:
92 | continue
93 |
94 | key, value = part.split(":")
95 |
96 | if key == "CVSS":
97 | continue # CVSS3 is prefixed with CVSS:3.0/
98 |
99 | if key == "RVSS":
100 | continue # RVSS1 is prefixed with RVSS:1.0/
101 |
102 | if key not in vector_map:
103 | raise VectorError("Unknown key {0} in {1} vector".format(key, module.__name__))
104 |
105 | enum = vector_map[key]
106 | # print(enum)
107 | try:
108 | value_from_key = enum.get_value_from_vector_key(value)
109 | except RuntimeError as e:
110 | raise VectorError(*e.args)
111 | vector_values[enum] = value_from_key
112 | given_keys.add(key)
113 |
114 | required_diff = mandatory_keys.difference(given_keys)
115 |
116 | if required_diff:
117 | if mandatory_error:
118 | raise VectorError("Missing mandatory keys {0}".format(required_diff))
119 |
120 | for enum_key in required_diff:
121 | enum = vector_map[enum_key]
122 | default = enum.get_default()
123 | vector_values[enum] = default
124 |
125 | return vector_values
126 |
--------------------------------------------------------------------------------
/docs/readme.md:
--------------------------------------------------------------------------------
1 | # Code
2 |
3 | I've had the misfortune of having to write several CVSS libraries in Python, this is my latest attempt at one that is tested and re-usable. Due to the nature of the CVSS v2 and v3 specifications (terrible 'reference code', huge amount of state and fiddly maths + corner cases) the current open source Python libraries for manipulating cvss are somewhat terrible and unmaintained. The only current implementation of v3 [has a (broken) 300 line function full of conditionals to handle vectors](https://github.com/toolswatch/pycvss3/blob/master/lib/pycvss3.py#L36), and while [some that implement v2](https://github.com/esn89/cvss-v2-calc) have better code quality they still lack tests and an importable API. There are a couple that are quite nice, including [cvss_util](https://bitbucket.org/asecurityteam/cvss_util)
4 |
5 | There is also a lack of a useful reference implementation. There is an official calculator for v2 and v3, but these are useless for automated testing. The v3 is all in JavaScript (and unpublished I might add, so you have to dig through the undocumented page JS), and you would need to screen-scrape the NIST website to automate the v2 calculator. Eww.
6 |
7 | This library has [30 cvss v2 and v3 vectors](https://github.com/ctxis/cvsslib/blob/master/tests/cvss_scores.py) and their official results to test against. More can be added really easily.
8 |
9 | ## Design
10 |
11 | In the authors experience the large number of CVSS variables that go into the complex calculations leads to messy code with lots of duplication, which is a fantastic place for bugs to hide. `cvsslib` makes heavy use of Python magic to remove as much duplication as possible, allowing it to handle both v2 and v3 calculations with the same API. The core of this is inspired by pytest fixtures and is used in the calculations file of each CVSS versions module. Here is v2's `exploitability` function:
12 |
13 | ```python
14 | def calculate_exploitability(access: AccessVector,
15 | complexity: AccessComplexity,
16 | auth: Authentication):
17 | # Exploitability = 20* AccessVector*AccessComplexity*Authentication
18 | return D("20") * access * complexity * auth
19 | ```
20 |
21 | Each calculation function expresses the enums it needs to do it's calculation as parameter annotations. These values of these are injected by a function called `run_calculation`:
22 |
23 | ```python
24 | def calculate_base_score(run_calculation, impact_function):
25 | # BaseScore = round_to_1_decimal(((0.6*Impact)+(0.4*Exploitability)-1.5)*f(Impact))
26 | # f(impact)= 0 if Impact=0, 1.176 otherwise
27 | impact = run_calculation(impact_function)
28 | exploitability = run_calculation(calculate_exploitability)
29 |
30 | result = (D("0.6") * impact) + (D("0.4") * exploitability) - D("1.5")
31 | f_impact = 0 if impact == 0 else D("1.176")
32 |
33 | return round(result * f_impact, 1)
34 | ```
35 |
36 | There are two alternatives to this: pass each attribute as a normal parameter ([leads to tonnes of parameters](https://github.com/toolswatch/pycvss3/blob/master/lib/formulas.py#L104) and is brittle) or passing a single object around (which is still tied to the attribute name). This way only the enum class is specified, which means it's decoupled from the code that actually gets the value.
37 |
38 | Enums are just normal Python enums:
39 |
40 | ```python
41 | class AvailabilityRequirement(BaseEnum):
42 | """
43 | Vector: AR
44 | """
45 | LOW = D("0.5")
46 | MEDIUM = D("1.0")
47 | HIGH = D("1.51")
48 | NOT_DEFINED = NotDefined(D("1.0"))
49 | ```
50 |
51 | It's necessary to wrap NOT_DEFINED in a NotDefined instance, because otherwise the value ("1.0") clashes with MEDIUM and this causes issues.
52 |
53 | To make a Django model or a normal Python class filled with cvss v2 or v3 attributes (plus functions to calculate, update etc) we make use of a metaclass. There is a function called `class_mixin` that takes a CVSS module and returns a base class you can use. This looks at all the Enums defined within the module and does some magic to dynamically add those attributes to a class and hook up some utility functions.
54 |
55 |
56 | ## Guides
57 |
58 | - https://www.first.org/cvss/v2/guide
59 | - https://www.first.org/cvss/specification-document
60 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Robot Vulnerability Scoring System (RVSS) Python 3 reference implementation.
2 |
3 | *Work inspired by https://github.com/ctxis/cvsslib. Paper available at https://arxiv.org/pdf/1807.10357.pdf*.
4 |
5 | ----
6 |
7 | - **Current version**: 1.0
8 | - **License**: GPLv3
9 |
10 | ----
11 |
12 | 
13 |
14 | This repository provides a Python 3 (*only Python 3*) library for calculating robot vulnerability scores. The library extends `cvsslib` to support the following scoring systems:
15 | - CVSSv2
16 | - CVSSv3
17 | - RVSSv1
18 |
19 | From the original README:
20 |
21 | > Examples on how to use the library is shown below, and there is some documentation on the internals within the `docs` directory. The library is designed to be completely extendable, so it is possible to implement your own custom scoring systems (or those of your clients) and have it work with the same API, and with the same bells and whistles.
22 |
23 | ## How to cite our work
24 |
25 | [](https://arxiv.org/pdf/1807.10357.pdf)
26 | ```
27 | @ARTICLE{2018arXiv180710357M,
28 | author = {{Mayoral Vilches}, V. and {Gil-Uriarte}, E. and {Zamalloa Ugarte}, I. and
29 | {Olalde Mendia}, G. and {Izquierdo Pis{\'o}n}, R. and {Alzola Kirschgens}, L. and
30 | {Bilbao Calvo}, A. and {Hern{\'a}ndez Cordero}, A. and {Apa}, L. and
31 | {Cerrudo}, C.},
32 | title = "{Towards an open standard for assessing the severity of robot security vulnerabilities, the Robot Vulnerability Scoring System (RVSS)}",
33 | journal = {ArXiv e-prints},
34 | archivePrefix = "arXiv",
35 | eprint = {1807.10357},
36 | primaryClass = "cs.RO",
37 | keywords = {Computer Science - Robotics, Computer Science - Cryptography and Security},
38 | year = 2018,
39 | month = jul,
40 | adsurl = {http://adsabs.harvard.edu/abs/2018arXiv180710357M},
41 | adsnote = {Provided by the SAO/NASA Astrophysics Data System}
42 | }
43 | ```
44 |
45 | ## Install
46 | ```bash
47 | python3 setup.py install
48 | ```
49 |
50 | ## Try it out
51 | #### RVSSv1
52 | ```bash
53 | $ rvss RVSS:1.0/AV:AN/AC:L/PR:N/UI:N/Y:O/S:U/C:N/I:L/A:N/H:H
54 | Base Score: 7.3
55 | Temporal: 7.3
56 | Environment: 7.3
57 | ```
58 |
59 | #### CVSSv3
60 | ```bash
61 | $ rvss CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
62 | Base Score: 8.8
63 | Temporal: 8.8
64 | Environment: 8.8
65 | ```
66 |
67 | #### CVSSv2
68 | ```bash
69 | $ rvss CVSS:2.0/AV:L/AC:M/Au:N/C:N/I:P/A:C/E:POC/RL:W/RC:UR/CDP:LM/TD:H/CR:M/IR:L/AR:H
70 | Base Score: 5.4
71 | Temporal: 4.4
72 | Environment: 6.9
73 | ```
74 |
75 |
76 | ## API
77 |
78 | It's pretty simple to use. `cvsslib` has a `cvss2`, `cvss3` and `rvss` sub modules that contains all of the enums and calculation code. There are also some functions to manipulate vectors that take these cvss modules
79 | as arguments. E.G:
80 |
81 | ```python
82 | from cvsslib import cvss2, cvss3, calculate_vector
83 |
84 | vector_v2 = "AV:L/AC:M/Au:S/C:N/I:P/A:C/E:U/RL:OF/RC:UR/CDP:N/TD:L/CR:H/IR:H/AR:H"
85 | calculate_vector(vector_v2, cvss2)
86 | >> (5, 3.5, 1.2)
87 |
88 | vector_v3 = "CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N"
89 | calculate_vector(vector_v3, cvss3)
90 | >> (5.8, 5.8, 7.1)
91 | ```
92 |
93 | You can access every CVSS enum through the `cvss2` or `cvss3` modules:
94 |
95 | ```python
96 | from cvsslib import cvss2
97 | # In this case doing from 'cvsslib.cvss2.enums import *' might be less verbose.
98 | value = cvss2.ReportConfidence.CONFIRMED
99 |
100 | if value != cvss2.ReportConfidence.NOT_DEFINED:
101 | do_something()
102 | ```
103 |
104 | There are some powerful mixin functions if you need a class with CVSS members. These functions
105 | take a cvss version and return a base class you can inherit from. This class hassome utility functions like
106 | `to_vector()` and `from_vector()` you can use.
107 |
108 | ```python
109 | from cvsslib import cvss3, class_mixin
110 |
111 | BaseClass = class_mixin(cvss3) # Can pass cvss2 module instead
112 |
113 | class SomeObject(BaseClass):
114 | def print_stats(self):
115 | for item, value in self.enums:
116 | print("{0} is {1}".format(item, value)
117 |
118 | state = SomeObject()
119 | print("\n".join(state.debug()))
120 | print(state.calculate())
121 | state.from_vector("CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N")
122 | print("Vector: " + state.to_vector())
123 |
124 | # Access members:
125 | if state.report_confidence == ReportConfidence.NOT_DEFINED:
126 | do_something()
127 | ```
128 |
129 | It also supports Django models. Requires the `django-enumfields` package.
130 |
131 | ```python
132 | from cvsslib.contrib.django_model import django_mixin
133 | from cvsslib import cvss2
134 | from django.db import models
135 |
136 | CVSSBase = django_mixin(cvss2)
137 |
138 | class CVSSModel(models.Model, metaclass=CVSSBase)
139 | pass
140 |
141 | # CVSSModel now has lots of enum you can use
142 | x = CVSSModel()
143 | x.save()
144 | x.exploitability
145 | ```
146 |
147 | If you want it to work with django Migrations you need to give an attribute name to the `django_mixin` function. This
148 | should match the attribute name it is being assigned to:
149 |
150 | ```python
151 | CVSSBase = django_mixin(cvss2, attr_name="CVSSBase")
152 | ```
153 |
154 | And there is a command line tool available:
155 |
156 | ```python
157 | > cvss CVSS:3.0/AV:L/AC:H/PR:H/UI:N/S:C/C:N/I:H/A:N/E:P/RL:U/RC:U/CR:H/IR:L/AR:H/MAV:L/MUI:R/MS:C/MC:N/MI:L/MA:N
158 | Base Score: 5.3
159 | Temporal: 4.6
160 | Environment: 1.3
161 | ```
162 |
163 | ## Custom Scoring Systems
164 |
165 | Creating a new scoring system is very simple. First create a Python file with the correct name, e.g `super_scores.py`.
166 | Next create some enums with the correct values for your system:
167 |
168 | ```python
169 | from cvsslib.base_enum import BaseEnum
170 |
171 |
172 | class Risk(BaseEnum):
173 | """
174 | Vector: S
175 | """
176 | HIGH = 1
177 | MEDIUM = 2
178 | LOW = 3
179 |
180 | class Difficulty(BaseEnum):
181 | """
182 | Vector: D
183 | """
184 | DIFFICULT = 1
185 | MODERATE = 2
186 | EASY = 3
187 | ```
188 |
189 | And lastly add a `calculate` function in the module that accepts some vector values and
190 | returns a result of some kind:
191 |
192 | ```python
193 |
194 | def calculate(difficulty: Difficulty, risk: Risk):
195 | if difficulty == Difficulty.EASY and risk == Risk.CRITICAL:
196 | return "oh nuts you're screwed"
197 |
198 | return "You're probs ok m8"
199 | ```
200 |
201 | Once you define this you can pass your `super_scores` module to any
202 | cvsslib function like `calculate_vector` or `django_mixin` and it will
203 | all just work. You can even serialize the data to and from a vector
204 | if you define the correct `vector: X` in the enum docstrings.
205 |
--------------------------------------------------------------------------------
/rvss.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aliasrobotics/RVSS/dc064f0c168df0e382a4673e7087af9bd80277a2/rvss.jpg
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 | import sys
3 |
4 | requirements = []
5 |
6 | # Enum34 fails in Python 3.5 (and not needed in 3.4), so skip it.
7 | if sys.version_info < (3, 4):
8 | requirements.append("enum34")
9 |
10 | if sys.version_info < (3, 2):
11 | requirements.append("backports.functools_lru_cache")
12 |
13 | setup(
14 | name='cvsslib',
15 | version='0.5.5',
16 | packages=['cvsslib', 'cvsslib.cvss2', 'cvsslib.cvss3', 'cvsslib.rvss', 'cvsslib.contrib'],
17 | url='https://github.com/ctxis/cvsslib',
18 | license='GPL',
19 | author='Tom',
20 | author_email='tom.forbes@contextis.co.uk',
21 | description='CVSS 2/3 utilities',
22 | long_description='A library for manipulating CVSS v2 and v3 vectors. Visit the github page '
23 | '(https://github.com/ctxis/cvsslib) for examples and documentation.',
24 | install_requires=requirements,
25 | entry_points={
26 | 'console_scripts': ['cvss=cvsslib.command:main', 'rvss=cvsslib.command2:main'],
27 | },
28 | classifiers=[
29 | 'Framework :: Django',
30 | 'Intended Audience :: Developers',
31 | 'Programming Language :: Python',
32 | 'Programming Language :: Python :: 3',
33 | 'Programming Language :: Python :: 3.2',
34 | 'Programming Language :: Python :: 3.3',
35 | 'Programming Language :: Python :: 3.4',
36 | 'Programming Language :: Python :: 3.5'],
37 | )
38 |
--------------------------------------------------------------------------------
/test_requirements.txt:
--------------------------------------------------------------------------------
1 | django>=1.11.18
2 | django-enumfields
3 | #pytest-pythonpath
4 | pytest-django
5 | pathlib
6 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Tom'
2 |
--------------------------------------------------------------------------------
/tests/django_app/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Tom'
2 |
--------------------------------------------------------------------------------
/tests/django_app/app/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Tom'
2 |
--------------------------------------------------------------------------------
/tests/django_app/app/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | from cvsslib.contrib.django_model import django_mixin
4 | from cvsslib import cvss2, cvss3
5 |
6 | v2Meta = django_mixin(cvss2)
7 | v3Meta = django_mixin(cvss3)
8 |
9 | namedMeta = django_mixin(cvss3, attr_name="namedMeta")
10 |
11 |
12 | class v2Model(models.Model, metaclass=v2Meta):
13 | pass
14 |
15 |
16 | class v3Model(models.Model, metaclass=v3Meta):
17 | pass
18 |
19 |
20 | class namedModel(models.Model, metaclass=namedMeta):
21 | pass
22 |
--------------------------------------------------------------------------------
/tests/django_app/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import sys
3 |
4 | import os
5 |
6 | if __name__ == "__main__":
7 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
8 |
9 | from django.core.management import execute_from_command_line
10 |
11 | execute_from_command_line(sys.argv)
12 |
--------------------------------------------------------------------------------
/tests/django_app/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | DJANGO_SETTINGS_MODULE =tests.django_app.settings
3 | python_paths = django_app/
--------------------------------------------------------------------------------
/tests/django_app/settings.py:
--------------------------------------------------------------------------------
1 | DATABASES = {
2 | 'default': {
3 | 'ENGINE': 'django.db.backends.sqlite3',
4 | 'NAME': 'db.sqlite3',
5 | }
6 | }
7 | INSTALLED_APPS = ["django_app.app"]
8 | DEBUG = True
9 | SECRET_KEY = "not_secret"
10 | ROOT_URLCONF = 'django_app.urls'
11 |
--------------------------------------------------------------------------------
/tests/django_app/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls import patterns
2 |
3 |
4 | urlpatterns = patterns('')
--------------------------------------------------------------------------------
/tests/files/vectors_simple2:
--------------------------------------------------------------------------------
1 | AV:L/AC:H/Au:M/C:N/I:N/A:N - (-0.0, None, None)
2 | AV:L/AC:H/Au:M/C:N/I:N/A:P - (0.8, None, None)
3 | AV:L/AC:H/Au:M/C:N/I:N/A:C - (3.7, None, None)
4 | AV:L/AC:H/Au:M/C:N/I:P/A:N - (0.8, None, None)
5 | AV:L/AC:H/Au:M/C:N/I:P/A:P - (2.3, None, None)
6 | AV:L/AC:H/Au:M/C:N/I:P/A:C - (4.4, None, None)
7 | AV:L/AC:H/Au:M/C:N/I:C/A:N - (3.7, None, None)
8 | AV:L/AC:H/Au:M/C:N/I:C/A:P - (4.4, None, None)
9 | AV:L/AC:H/Au:M/C:N/I:C/A:C - (5.3, None, None)
10 | AV:L/AC:H/Au:M/C:P/I:N/A:N - (0.8, None, None)
11 | AV:L/AC:H/Au:M/C:P/I:N/A:P - (2.3, None, None)
12 | AV:L/AC:H/Au:M/C:P/I:N/A:C - (4.4, None, None)
13 | AV:L/AC:H/Au:M/C:P/I:P/A:N - (2.3, None, None)
14 | AV:L/AC:H/Au:M/C:P/I:P/A:P - (3.4, None, None)
15 | AV:L/AC:H/Au:M/C:P/I:P/A:C - (4.9, None, None)
16 | AV:L/AC:H/Au:M/C:P/I:C/A:N - (4.4, None, None)
17 | AV:L/AC:H/Au:M/C:P/I:C/A:P - (4.9, None, None)
18 | AV:L/AC:H/Au:M/C:P/I:C/A:C - (5.6, None, None)
19 | AV:L/AC:H/Au:M/C:C/I:N/A:N - (3.7, None, None)
20 | AV:L/AC:H/Au:M/C:C/I:N/A:P - (4.4, None, None)
21 | AV:L/AC:H/Au:M/C:C/I:N/A:C - (5.3, None, None)
22 | AV:L/AC:H/Au:M/C:C/I:P/A:N - (4.4, None, None)
23 | AV:L/AC:H/Au:M/C:C/I:P/A:P - (4.9, None, None)
24 | AV:L/AC:H/Au:M/C:C/I:P/A:C - (5.6, None, None)
25 | AV:L/AC:H/Au:M/C:C/I:C/A:N - (5.3, None, None)
26 | AV:L/AC:H/Au:M/C:C/I:C/A:P - (5.6, None, None)
27 | AV:L/AC:H/Au:M/C:C/I:C/A:C - (5.9, None, None)
28 | AV:L/AC:H/Au:S/C:N/I:N/A:N - (-0.0, None, None)
29 | AV:L/AC:H/Au:S/C:N/I:N/A:P - (1.0, None, None)
30 | AV:L/AC:H/Au:S/C:N/I:N/A:C - (3.8, None, None)
31 | AV:L/AC:H/Au:S/C:N/I:P/A:N - (1.0, None, None)
32 | AV:L/AC:H/Au:S/C:N/I:P/A:P - (2.4, None, None)
33 | AV:L/AC:H/Au:S/C:N/I:P/A:C - (4.5, None, None)
34 | AV:L/AC:H/Au:S/C:N/I:C/A:N - (3.8, None, None)
35 | AV:L/AC:H/Au:S/C:N/I:C/A:P - (4.5, None, None)
36 | AV:L/AC:H/Au:S/C:N/I:C/A:C - (5.5, None, None)
37 | AV:L/AC:H/Au:S/C:P/I:N/A:N - (1.0, None, None)
38 | AV:L/AC:H/Au:S/C:P/I:N/A:P - (2.4, None, None)
39 | AV:L/AC:H/Au:S/C:P/I:N/A:C - (4.5, None, None)
40 | AV:L/AC:H/Au:S/C:P/I:P/A:N - (2.4, None, None)
41 | AV:L/AC:H/Au:S/C:P/I:P/A:P - (3.5, None, None)
42 | AV:L/AC:H/Au:S/C:P/I:P/A:C - (5.0, None, None)
43 | AV:L/AC:H/Au:S/C:P/I:C/A:N - (4.5, None, None)
44 | AV:L/AC:H/Au:S/C:P/I:C/A:P - (5.0, None, None)
45 | AV:L/AC:H/Au:S/C:P/I:C/A:C - (5.7, None, None)
46 | AV:L/AC:H/Au:S/C:C/I:N/A:N - (3.8, None, None)
47 | AV:L/AC:H/Au:S/C:C/I:N/A:P - (4.5, None, None)
48 | AV:L/AC:H/Au:S/C:C/I:N/A:C - (5.5, None, None)
49 | AV:L/AC:H/Au:S/C:C/I:P/A:N - (4.5, None, None)
50 | AV:L/AC:H/Au:S/C:C/I:P/A:P - (5.0, None, None)
51 | AV:L/AC:H/Au:S/C:C/I:P/A:C - (5.7, None, None)
52 | AV:L/AC:H/Au:S/C:C/I:C/A:N - (5.5, None, None)
53 | AV:L/AC:H/Au:S/C:C/I:C/A:P - (5.7, None, None)
54 | AV:L/AC:H/Au:S/C:C/I:C/A:C - (6.0, None, None)
55 | AV:L/AC:H/Au:N/C:N/I:N/A:N - (-0.0, None, None)
56 | AV:L/AC:H/Au:N/C:N/I:N/A:P - (1.2, None, None)
57 | AV:L/AC:H/Au:N/C:N/I:N/A:C - (4.0, None, None)
58 | AV:L/AC:H/Au:N/C:N/I:P/A:N - (1.2, None, None)
59 | AV:L/AC:H/Au:N/C:N/I:P/A:P - (2.6, None, None)
60 | AV:L/AC:H/Au:N/C:N/I:P/A:C - (4.7, None, None)
61 | AV:L/AC:H/Au:N/C:N/I:C/A:N - (4.0, None, None)
62 | AV:L/AC:H/Au:N/C:N/I:C/A:P - (4.7, None, None)
63 | AV:L/AC:H/Au:N/C:N/I:C/A:C - (5.6, None, None)
64 | AV:L/AC:H/Au:N/C:P/I:N/A:N - (1.2, None, None)
65 | AV:L/AC:H/Au:N/C:P/I:N/A:P - (2.6, None, None)
66 | AV:L/AC:H/Au:N/C:P/I:N/A:C - (4.7, None, None)
67 | AV:L/AC:H/Au:N/C:P/I:P/A:N - (2.6, None, None)
68 | AV:L/AC:H/Au:N/C:P/I:P/A:P - (3.7, None, None)
69 | AV:L/AC:H/Au:N/C:P/I:P/A:C - (5.2, None, None)
70 | AV:L/AC:H/Au:N/C:P/I:C/A:N - (4.7, None, None)
71 | AV:L/AC:H/Au:N/C:P/I:C/A:P - (5.2, None, None)
72 | AV:L/AC:H/Au:N/C:P/I:C/A:C - (5.9, None, None)
73 | AV:L/AC:H/Au:N/C:C/I:N/A:N - (4.0, None, None)
74 | AV:L/AC:H/Au:N/C:C/I:N/A:P - (4.7, None, None)
75 | AV:L/AC:H/Au:N/C:C/I:N/A:C - (5.6, None, None)
76 | AV:L/AC:H/Au:N/C:C/I:P/A:N - (4.7, None, None)
77 | AV:L/AC:H/Au:N/C:C/I:P/A:P - (5.2, None, None)
78 | AV:L/AC:H/Au:N/C:C/I:P/A:C - (5.9, None, None)
79 | AV:L/AC:H/Au:N/C:C/I:C/A:N - (5.6, None, None)
80 | AV:L/AC:H/Au:N/C:C/I:C/A:P - (5.9, None, None)
81 | AV:L/AC:H/Au:N/C:C/I:C/A:C - (6.2, None, None)
82 | AV:L/AC:M/Au:M/C:N/I:N/A:N - (-0.0, None, None)
83 | AV:L/AC:M/Au:M/C:N/I:N/A:P - (1.3, None, None)
84 | AV:L/AC:M/Au:M/C:N/I:N/A:C - (4.1, None, None)
85 | AV:L/AC:M/Au:M/C:N/I:P/A:N - (1.3, None, None)
86 | AV:L/AC:M/Au:M/C:N/I:P/A:P - (2.7, None, None)
87 | AV:L/AC:M/Au:M/C:N/I:P/A:C - (4.8, None, None)
88 | AV:L/AC:M/Au:M/C:N/I:C/A:N - (4.1, None, None)
89 | AV:L/AC:M/Au:M/C:N/I:C/A:P - (4.8, None, None)
90 | AV:L/AC:M/Au:M/C:N/I:C/A:C - (5.8, None, None)
91 | AV:L/AC:M/Au:M/C:P/I:N/A:N - (1.3, None, None)
92 | AV:L/AC:M/Au:M/C:P/I:N/A:P - (2.7, None, None)
93 | AV:L/AC:M/Au:M/C:P/I:N/A:C - (4.8, None, None)
94 | AV:L/AC:M/Au:M/C:P/I:P/A:N - (2.7, None, None)
95 | AV:L/AC:M/Au:M/C:P/I:P/A:P - (3.8, None, None)
96 | AV:L/AC:M/Au:M/C:P/I:P/A:C - (5.3, None, None)
97 | AV:L/AC:M/Au:M/C:P/I:C/A:N - (4.8, None, None)
98 | AV:L/AC:M/Au:M/C:P/I:C/A:P - (5.3, None, None)
99 | AV:L/AC:M/Au:M/C:P/I:C/A:C - (6.0, None, None)
100 | AV:L/AC:M/Au:M/C:C/I:N/A:N - (4.1, None, None)
101 | AV:L/AC:M/Au:M/C:C/I:N/A:P - (4.8, None, None)
102 | AV:L/AC:M/Au:M/C:C/I:N/A:C - (5.8, None, None)
103 | AV:L/AC:M/Au:M/C:C/I:P/A:N - (4.8, None, None)
104 | AV:L/AC:M/Au:M/C:C/I:P/A:P - (5.3, None, None)
105 | AV:L/AC:M/Au:M/C:C/I:P/A:C - (6.0, None, None)
106 | AV:L/AC:M/Au:M/C:C/I:C/A:N - (5.8, None, None)
107 | AV:L/AC:M/Au:M/C:C/I:C/A:P - (6.0, None, None)
108 | AV:L/AC:M/Au:M/C:C/I:C/A:C - (6.3, None, None)
109 | AV:L/AC:M/Au:S/C:N/I:N/A:N - (-0.0, None, None)
110 | AV:L/AC:M/Au:S/C:N/I:N/A:P - (1.5, None, None)
111 | AV:L/AC:M/Au:S/C:N/I:N/A:C - (4.4, None, None)
112 | AV:L/AC:M/Au:S/C:N/I:P/A:N - (1.5, None, None)
113 | AV:L/AC:M/Au:S/C:N/I:P/A:P - (3.0, None, None)
114 | AV:L/AC:M/Au:S/C:N/I:P/A:C - (5.0, None, None)
115 | AV:L/AC:M/Au:S/C:N/I:C/A:N - (4.4, None, None)
116 | AV:L/AC:M/Au:S/C:N/I:C/A:P - (5.0, None, None)
117 | AV:L/AC:M/Au:S/C:N/I:C/A:C - (6.0, None, None)
118 | AV:L/AC:M/Au:S/C:P/I:N/A:N - (1.5, None, None)
119 | AV:L/AC:M/Au:S/C:P/I:N/A:P - (3.0, None, None)
120 | AV:L/AC:M/Au:S/C:P/I:N/A:C - (5.0, None, None)
121 | AV:L/AC:M/Au:S/C:P/I:P/A:N - (3.0, None, None)
122 | AV:L/AC:M/Au:S/C:P/I:P/A:P - (4.1, None, None)
123 | AV:L/AC:M/Au:S/C:P/I:P/A:C - (5.5, None, None)
124 | AV:L/AC:M/Au:S/C:P/I:C/A:N - (5.0, None, None)
125 | AV:L/AC:M/Au:S/C:P/I:C/A:P - (5.5, None, None)
126 | AV:L/AC:M/Au:S/C:P/I:C/A:C - (6.2, None, None)
127 | AV:L/AC:M/Au:S/C:C/I:N/A:N - (4.4, None, None)
128 | AV:L/AC:M/Au:S/C:C/I:N/A:P - (5.0, None, None)
129 | AV:L/AC:M/Au:S/C:C/I:N/A:C - (6.0, None, None)
130 | AV:L/AC:M/Au:S/C:C/I:P/A:N - (5.0, None, None)
131 | AV:L/AC:M/Au:S/C:C/I:P/A:P - (5.5, None, None)
132 | AV:L/AC:M/Au:S/C:C/I:P/A:C - (6.2, None, None)
133 | AV:L/AC:M/Au:S/C:C/I:C/A:N - (6.0, None, None)
134 | AV:L/AC:M/Au:S/C:C/I:C/A:P - (6.2, None, None)
135 | AV:L/AC:M/Au:S/C:C/I:C/A:C - (6.6, None, None)
136 | AV:L/AC:M/Au:N/C:N/I:N/A:N - (-0.0, None, None)
137 | AV:L/AC:M/Au:N/C:N/I:N/A:P - (1.9, None, None)
138 | AV:L/AC:M/Au:N/C:N/I:N/A:C - (4.7, None, None)
139 | AV:L/AC:M/Au:N/C:N/I:P/A:N - (1.9, None, None)
140 | AV:L/AC:M/Au:N/C:N/I:P/A:P - (3.3, None, None)
141 | AV:L/AC:M/Au:N/C:N/I:P/A:C - (5.4, None, None)
142 | AV:L/AC:M/Au:N/C:N/I:C/A:N - (4.7, None, None)
143 | AV:L/AC:M/Au:N/C:N/I:C/A:P - (5.4, None, None)
144 | AV:L/AC:M/Au:N/C:N/I:C/A:C - (6.3, None, None)
145 | AV:L/AC:M/Au:N/C:P/I:N/A:N - (1.9, None, None)
146 | AV:L/AC:M/Au:N/C:P/I:N/A:P - (3.3, None, None)
147 | AV:L/AC:M/Au:N/C:P/I:N/A:C - (5.4, None, None)
148 | AV:L/AC:M/Au:N/C:P/I:P/A:N - (3.3, None, None)
149 | AV:L/AC:M/Au:N/C:P/I:P/A:P - (4.4, None, None)
150 | AV:L/AC:M/Au:N/C:P/I:P/A:C - (5.9, None, None)
151 | AV:L/AC:M/Au:N/C:P/I:C/A:N - (5.4, None, None)
152 | AV:L/AC:M/Au:N/C:P/I:C/A:P - (5.9, None, None)
153 | AV:L/AC:M/Au:N/C:P/I:C/A:C - (6.6, None, None)
154 | AV:L/AC:M/Au:N/C:C/I:N/A:N - (4.7, None, None)
155 | AV:L/AC:M/Au:N/C:C/I:N/A:P - (5.4, None, None)
156 | AV:L/AC:M/Au:N/C:C/I:N/A:C - (6.3, None, None)
157 | AV:L/AC:M/Au:N/C:C/I:P/A:N - (5.4, None, None)
158 | AV:L/AC:M/Au:N/C:C/I:P/A:P - (5.9, None, None)
159 | AV:L/AC:M/Au:N/C:C/I:P/A:C - (6.6, None, None)
160 | AV:L/AC:M/Au:N/C:C/I:C/A:N - (6.3, None, None)
161 | AV:L/AC:M/Au:N/C:C/I:C/A:P - (6.6, None, None)
162 | AV:L/AC:M/Au:N/C:C/I:C/A:C - (6.9, None, None)
163 | AV:L/AC:L/Au:M/C:N/I:N/A:N - (-0.0, None, None)
164 | AV:L/AC:L/Au:M/C:N/I:N/A:P - (1.4, None, None)
165 | AV:L/AC:L/Au:M/C:N/I:N/A:C - (4.3, None, None)
166 | AV:L/AC:L/Au:M/C:N/I:P/A:N - (1.4, None, None)
167 | AV:L/AC:L/Au:M/C:N/I:P/A:P - (2.9, None, None)
168 | AV:L/AC:L/Au:M/C:N/I:P/A:C - (5.0, None, None)
169 | AV:L/AC:L/Au:M/C:N/I:C/A:N - (4.3, None, None)
170 | AV:L/AC:L/Au:M/C:N/I:C/A:P - (5.0, None, None)
171 | AV:L/AC:L/Au:M/C:N/I:C/A:C - (5.9, None, None)
172 | AV:L/AC:L/Au:M/C:P/I:N/A:N - (1.4, None, None)
173 | AV:L/AC:L/Au:M/C:P/I:N/A:P - (2.9, None, None)
174 | AV:L/AC:L/Au:M/C:P/I:N/A:C - (5.0, None, None)
175 | AV:L/AC:L/Au:M/C:P/I:P/A:N - (2.9, None, None)
176 | AV:L/AC:L/Au:M/C:P/I:P/A:P - (4.0, None, None)
177 | AV:L/AC:L/Au:M/C:P/I:P/A:C - (5.5, None, None)
178 | AV:L/AC:L/Au:M/C:P/I:C/A:N - (5.0, None, None)
179 | AV:L/AC:L/Au:M/C:P/I:C/A:P - (5.5, None, None)
180 | AV:L/AC:L/Au:M/C:P/I:C/A:C - (6.2, None, None)
181 | AV:L/AC:L/Au:M/C:C/I:N/A:N - (4.3, None, None)
182 | AV:L/AC:L/Au:M/C:C/I:N/A:P - (5.0, None, None)
183 | AV:L/AC:L/Au:M/C:C/I:N/A:C - (5.9, None, None)
184 | AV:L/AC:L/Au:M/C:C/I:P/A:N - (5.0, None, None)
185 | AV:L/AC:L/Au:M/C:C/I:P/A:P - (5.5, None, None)
186 | AV:L/AC:L/Au:M/C:C/I:P/A:C - (6.2, None, None)
187 | AV:L/AC:L/Au:M/C:C/I:C/A:N - (5.9, None, None)
188 | AV:L/AC:L/Au:M/C:C/I:C/A:P - (6.2, None, None)
189 | AV:L/AC:L/Au:M/C:C/I:C/A:C - (6.5, None, None)
190 | AV:L/AC:L/Au:S/C:N/I:N/A:N - (-0.0, None, None)
191 | AV:L/AC:L/Au:S/C:N/I:N/A:P - (1.7, None, None)
192 | AV:L/AC:L/Au:S/C:N/I:N/A:C - (4.6, None, None)
193 | AV:L/AC:L/Au:S/C:N/I:P/A:N - (1.7, None, None)
194 | AV:L/AC:L/Au:S/C:N/I:P/A:P - (3.2, None, None)
195 | AV:L/AC:L/Au:S/C:N/I:P/A:C - (5.2, None, None)
196 | AV:L/AC:L/Au:S/C:N/I:C/A:N - (4.6, None, None)
197 | AV:L/AC:L/Au:S/C:N/I:C/A:P - (5.2, None, None)
198 | AV:L/AC:L/Au:S/C:N/I:C/A:C - (6.2, None, None)
199 | AV:L/AC:L/Au:S/C:P/I:N/A:N - (1.7, None, None)
200 | AV:L/AC:L/Au:S/C:P/I:N/A:P - (3.2, None, None)
201 | AV:L/AC:L/Au:S/C:P/I:N/A:C - (5.2, None, None)
202 | AV:L/AC:L/Au:S/C:P/I:P/A:N - (3.2, None, None)
203 | AV:L/AC:L/Au:S/C:P/I:P/A:P - (4.3, None, None)
204 | AV:L/AC:L/Au:S/C:P/I:P/A:C - (5.7, None, None)
205 | AV:L/AC:L/Au:S/C:P/I:C/A:N - (5.2, None, None)
206 | AV:L/AC:L/Au:S/C:P/I:C/A:P - (5.7, None, None)
207 | AV:L/AC:L/Au:S/C:P/I:C/A:C - (6.4, None, None)
208 | AV:L/AC:L/Au:S/C:C/I:N/A:N - (4.6, None, None)
209 | AV:L/AC:L/Au:S/C:C/I:N/A:P - (5.2, None, None)
210 | AV:L/AC:L/Au:S/C:C/I:N/A:C - (6.2, None, None)
211 | AV:L/AC:L/Au:S/C:C/I:P/A:N - (5.2, None, None)
212 | AV:L/AC:L/Au:S/C:C/I:P/A:P - (5.7, None, None)
213 | AV:L/AC:L/Au:S/C:C/I:P/A:C - (6.4, None, None)
214 | AV:L/AC:L/Au:S/C:C/I:C/A:N - (6.2, None, None)
215 | AV:L/AC:L/Au:S/C:C/I:C/A:P - (6.4, None, None)
216 | AV:L/AC:L/Au:S/C:C/I:C/A:C - (6.8, None, None)
217 | AV:L/AC:L/Au:N/C:N/I:N/A:N - (0.0, None, None)
218 | AV:L/AC:L/Au:N/C:N/I:N/A:P - (2.1, None, None)
219 | AV:L/AC:L/Au:N/C:N/I:N/A:C - (4.9, None, None)
220 | AV:L/AC:L/Au:N/C:N/I:P/A:N - (2.1, None, None)
221 | AV:L/AC:L/Au:N/C:N/I:P/A:P - (3.6, None, None)
222 | AV:L/AC:L/Au:N/C:N/I:P/A:C - (5.6, None, None)
223 | AV:L/AC:L/Au:N/C:N/I:C/A:N - (4.9, None, None)
224 | AV:L/AC:L/Au:N/C:N/I:C/A:P - (5.6, None, None)
225 | AV:L/AC:L/Au:N/C:N/I:C/A:C - (6.6, None, None)
226 | AV:L/AC:L/Au:N/C:P/I:N/A:N - (2.1, None, None)
227 | AV:L/AC:L/Au:N/C:P/I:N/A:P - (3.6, None, None)
228 | AV:L/AC:L/Au:N/C:P/I:N/A:C - (5.6, None, None)
229 | AV:L/AC:L/Au:N/C:P/I:P/A:N - (3.6, None, None)
230 | AV:L/AC:L/Au:N/C:P/I:P/A:P - (4.6, None, None)
231 | AV:L/AC:L/Au:N/C:P/I:P/A:C - (6.1, None, None)
232 | AV:L/AC:L/Au:N/C:P/I:C/A:N - (5.6, None, None)
233 | AV:L/AC:L/Au:N/C:P/I:C/A:P - (6.1, None, None)
234 | AV:L/AC:L/Au:N/C:P/I:C/A:C - (6.8, None, None)
235 | AV:L/AC:L/Au:N/C:C/I:N/A:N - (4.9, None, None)
236 | AV:L/AC:L/Au:N/C:C/I:N/A:P - (5.6, None, None)
237 | AV:L/AC:L/Au:N/C:C/I:N/A:C - (6.6, None, None)
238 | AV:L/AC:L/Au:N/C:C/I:P/A:N - (5.6, None, None)
239 | AV:L/AC:L/Au:N/C:C/I:P/A:P - (6.1, None, None)
240 | AV:L/AC:L/Au:N/C:C/I:P/A:C - (6.8, None, None)
241 | AV:L/AC:L/Au:N/C:C/I:C/A:N - (6.6, None, None)
242 | AV:L/AC:L/Au:N/C:C/I:C/A:P - (6.8, None, None)
243 | AV:L/AC:L/Au:N/C:C/I:C/A:C - (7.2, None, None)
244 | AV:A/AC:H/Au:M/C:N/I:N/A:N - (-0.0, None, None)
245 | AV:A/AC:H/Au:M/C:N/I:N/A:P - (1.2, None, None)
246 | AV:A/AC:H/Au:M/C:N/I:N/A:C - (4.0, None, None)
247 | AV:A/AC:H/Au:M/C:N/I:P/A:N - (1.2, None, None)
248 | AV:A/AC:H/Au:M/C:N/I:P/A:P - (2.7, None, None)
249 | AV:A/AC:H/Au:M/C:N/I:P/A:C - (4.7, None, None)
250 | AV:A/AC:H/Au:M/C:N/I:C/A:N - (4.0, None, None)
251 | AV:A/AC:H/Au:M/C:N/I:C/A:P - (4.7, None, None)
252 | AV:A/AC:H/Au:M/C:N/I:C/A:C - (5.7, None, None)
253 | AV:A/AC:H/Au:M/C:P/I:N/A:N - (1.2, None, None)
254 | AV:A/AC:H/Au:M/C:P/I:N/A:P - (2.7, None, None)
255 | AV:A/AC:H/Au:M/C:P/I:N/A:C - (4.7, None, None)
256 | AV:A/AC:H/Au:M/C:P/I:P/A:N - (2.7, None, None)
257 | AV:A/AC:H/Au:M/C:P/I:P/A:P - (3.7, None, None)
258 | AV:A/AC:H/Au:M/C:P/I:P/A:C - (5.2, None, None)
259 | AV:A/AC:H/Au:M/C:P/I:C/A:N - (4.7, None, None)
260 | AV:A/AC:H/Au:M/C:P/I:C/A:P - (5.2, None, None)
261 | AV:A/AC:H/Au:M/C:P/I:C/A:C - (5.9, None, None)
262 | AV:A/AC:H/Au:M/C:C/I:N/A:N - (4.0, None, None)
263 | AV:A/AC:H/Au:M/C:C/I:N/A:P - (4.7, None, None)
264 | AV:A/AC:H/Au:M/C:C/I:N/A:C - (5.7, None, None)
265 | AV:A/AC:H/Au:M/C:C/I:P/A:N - (4.7, None, None)
266 | AV:A/AC:H/Au:M/C:C/I:P/A:P - (5.2, None, None)
267 | AV:A/AC:H/Au:M/C:C/I:P/A:C - (5.9, None, None)
268 | AV:A/AC:H/Au:M/C:C/I:C/A:N - (5.7, None, None)
269 | AV:A/AC:H/Au:M/C:C/I:C/A:P - (5.9, None, None)
270 | AV:A/AC:H/Au:M/C:C/I:C/A:C - (6.2, None, None)
271 | AV:A/AC:H/Au:S/C:N/I:N/A:N - (-0.0, None, None)
272 | AV:A/AC:H/Au:S/C:N/I:N/A:P - (1.4, None, None)
273 | AV:A/AC:H/Au:S/C:N/I:N/A:C - (4.3, None, None)
274 | AV:A/AC:H/Au:S/C:N/I:P/A:N - (1.4, None, None)
275 | AV:A/AC:H/Au:S/C:N/I:P/A:P - (2.9, None, None)
276 | AV:A/AC:H/Au:S/C:N/I:P/A:C - (5.0, None, None)
277 | AV:A/AC:H/Au:S/C:N/I:C/A:N - (4.3, None, None)
278 | AV:A/AC:H/Au:S/C:N/I:C/A:P - (5.0, None, None)
279 | AV:A/AC:H/Au:S/C:N/I:C/A:C - (5.9, None, None)
280 | AV:A/AC:H/Au:S/C:P/I:N/A:N - (1.4, None, None)
281 | AV:A/AC:H/Au:S/C:P/I:N/A:P - (2.9, None, None)
282 | AV:A/AC:H/Au:S/C:P/I:N/A:C - (5.0, None, None)
283 | AV:A/AC:H/Au:S/C:P/I:P/A:N - (2.9, None, None)
284 | AV:A/AC:H/Au:S/C:P/I:P/A:P - (4.0, None, None)
285 | AV:A/AC:H/Au:S/C:P/I:P/A:C - (5.5, None, None)
286 | AV:A/AC:H/Au:S/C:P/I:C/A:N - (5.0, None, None)
287 | AV:A/AC:H/Au:S/C:P/I:C/A:P - (5.5, None, None)
288 | AV:A/AC:H/Au:S/C:P/I:C/A:C - (6.2, None, None)
289 | AV:A/AC:H/Au:S/C:C/I:N/A:N - (4.3, None, None)
290 | AV:A/AC:H/Au:S/C:C/I:N/A:P - (5.0, None, None)
291 | AV:A/AC:H/Au:S/C:C/I:N/A:C - (5.9, None, None)
292 | AV:A/AC:H/Au:S/C:C/I:P/A:N - (5.0, None, None)
293 | AV:A/AC:H/Au:S/C:C/I:P/A:P - (5.5, None, None)
294 | AV:A/AC:H/Au:S/C:C/I:P/A:C - (6.2, None, None)
295 | AV:A/AC:H/Au:S/C:C/I:C/A:N - (5.9, None, None)
296 | AV:A/AC:H/Au:S/C:C/I:C/A:P - (6.2, None, None)
297 | AV:A/AC:H/Au:S/C:C/I:C/A:C - (6.5, None, None)
298 | AV:A/AC:H/Au:N/C:N/I:N/A:N - (-0.0, None, None)
299 | AV:A/AC:H/Au:N/C:N/I:N/A:P - (1.8, None, None)
300 | AV:A/AC:H/Au:N/C:N/I:N/A:C - (4.6, None, None)
301 | AV:A/AC:H/Au:N/C:N/I:P/A:N - (1.8, None, None)
302 | AV:A/AC:H/Au:N/C:N/I:P/A:P - (3.2, None, None)
303 | AV:A/AC:H/Au:N/C:N/I:P/A:C - (5.3, None, None)
304 | AV:A/AC:H/Au:N/C:N/I:C/A:N - (4.6, None, None)
305 | AV:A/AC:H/Au:N/C:N/I:C/A:P - (5.3, None, None)
306 | AV:A/AC:H/Au:N/C:N/I:C/A:C - (6.2, None, None)
307 | AV:A/AC:H/Au:N/C:P/I:N/A:N - (1.8, None, None)
308 | AV:A/AC:H/Au:N/C:P/I:N/A:P - (3.2, None, None)
309 | AV:A/AC:H/Au:N/C:P/I:N/A:C - (5.3, None, None)
310 | AV:A/AC:H/Au:N/C:P/I:P/A:N - (3.2, None, None)
311 | AV:A/AC:H/Au:N/C:P/I:P/A:P - (4.3, None, None)
312 | AV:A/AC:H/Au:N/C:P/I:P/A:C - (5.8, None, None)
313 | AV:A/AC:H/Au:N/C:P/I:C/A:N - (5.3, None, None)
314 | AV:A/AC:H/Au:N/C:P/I:C/A:P - (5.8, None, None)
315 | AV:A/AC:H/Au:N/C:P/I:C/A:C - (6.5, None, None)
316 | AV:A/AC:H/Au:N/C:C/I:N/A:N - (4.6, None, None)
317 | AV:A/AC:H/Au:N/C:C/I:N/A:P - (5.3, None, None)
318 | AV:A/AC:H/Au:N/C:C/I:N/A:C - (6.2, None, None)
319 | AV:A/AC:H/Au:N/C:C/I:P/A:N - (5.3, None, None)
320 | AV:A/AC:H/Au:N/C:C/I:P/A:P - (5.8, None, None)
321 | AV:A/AC:H/Au:N/C:C/I:P/A:C - (6.5, None, None)
322 | AV:A/AC:H/Au:N/C:C/I:C/A:N - (6.2, None, None)
323 | AV:A/AC:H/Au:N/C:C/I:C/A:P - (6.5, None, None)
324 | AV:A/AC:H/Au:N/C:C/I:C/A:C - (6.8, None, None)
325 | AV:A/AC:M/Au:M/C:N/I:N/A:N - (-0.0, None, None)
326 | AV:A/AC:M/Au:M/C:N/I:N/A:P - (1.9, None, None)
327 | AV:A/AC:M/Au:M/C:N/I:N/A:C - (4.8, None, None)
328 | AV:A/AC:M/Au:M/C:N/I:P/A:N - (1.9, None, None)
329 | AV:A/AC:M/Au:M/C:N/I:P/A:P - (3.4, None, None)
330 | AV:A/AC:M/Au:M/C:N/I:P/A:C - (5.4, None, None)
331 | AV:A/AC:M/Au:M/C:N/I:C/A:N - (4.8, None, None)
332 | AV:A/AC:M/Au:M/C:N/I:C/A:P - (5.4, None, None)
333 | AV:A/AC:M/Au:M/C:N/I:C/A:C - (6.4, None, None)
334 | AV:A/AC:M/Au:M/C:P/I:N/A:N - (1.9, None, None)
335 | AV:A/AC:M/Au:M/C:P/I:N/A:P - (3.4, None, None)
336 | AV:A/AC:M/Au:M/C:P/I:N/A:C - (5.4, None, None)
337 | AV:A/AC:M/Au:M/C:P/I:P/A:N - (3.4, None, None)
338 | AV:A/AC:M/Au:M/C:P/I:P/A:P - (4.5, None, None)
339 | AV:A/AC:M/Au:M/C:P/I:P/A:C - (5.9, None, None)
340 | AV:A/AC:M/Au:M/C:P/I:C/A:N - (5.4, None, None)
341 | AV:A/AC:M/Au:M/C:P/I:C/A:P - (5.9, None, None)
342 | AV:A/AC:M/Au:M/C:P/I:C/A:C - (6.6, None, None)
343 | AV:A/AC:M/Au:M/C:C/I:N/A:N - (4.8, None, None)
344 | AV:A/AC:M/Au:M/C:C/I:N/A:P - (5.4, None, None)
345 | AV:A/AC:M/Au:M/C:C/I:N/A:C - (6.4, None, None)
346 | AV:A/AC:M/Au:M/C:C/I:P/A:N - (5.4, None, None)
347 | AV:A/AC:M/Au:M/C:C/I:P/A:P - (5.9, None, None)
348 | AV:A/AC:M/Au:M/C:C/I:P/A:C - (6.6, None, None)
349 | AV:A/AC:M/Au:M/C:C/I:C/A:N - (6.4, None, None)
350 | AV:A/AC:M/Au:M/C:C/I:C/A:P - (6.6, None, None)
351 | AV:A/AC:M/Au:M/C:C/I:C/A:C - (7.0, None, None)
352 | AV:A/AC:M/Au:S/C:N/I:N/A:N - (0.0, None, None)
353 | AV:A/AC:M/Au:S/C:N/I:N/A:P - (2.3, None, None)
354 | AV:A/AC:M/Au:S/C:N/I:N/A:C - (5.2, None, None)
355 | AV:A/AC:M/Au:S/C:N/I:P/A:N - (2.3, None, None)
356 | AV:A/AC:M/Au:S/C:N/I:P/A:P - (3.8, None, None)
357 | AV:A/AC:M/Au:S/C:N/I:P/A:C - (5.8, None, None)
358 | AV:A/AC:M/Au:S/C:N/I:C/A:N - (5.2, None, None)
359 | AV:A/AC:M/Au:S/C:N/I:C/A:P - (5.8, None, None)
360 | AV:A/AC:M/Au:S/C:N/I:C/A:C - (6.8, None, None)
361 | AV:A/AC:M/Au:S/C:P/I:N/A:N - (2.3, None, None)
362 | AV:A/AC:M/Au:S/C:P/I:N/A:P - (3.8, None, None)
363 | AV:A/AC:M/Au:S/C:P/I:N/A:C - (5.8, None, None)
364 | AV:A/AC:M/Au:S/C:P/I:P/A:N - (3.8, None, None)
365 | AV:A/AC:M/Au:S/C:P/I:P/A:P - (4.9, None, None)
366 | AV:A/AC:M/Au:S/C:P/I:P/A:C - (6.3, None, None)
367 | AV:A/AC:M/Au:S/C:P/I:C/A:N - (5.8, None, None)
368 | AV:A/AC:M/Au:S/C:P/I:C/A:P - (6.3, None, None)
369 | AV:A/AC:M/Au:S/C:P/I:C/A:C - (7.0, None, None)
370 | AV:A/AC:M/Au:S/C:C/I:N/A:N - (5.2, None, None)
371 | AV:A/AC:M/Au:S/C:C/I:N/A:P - (5.8, None, None)
372 | AV:A/AC:M/Au:S/C:C/I:N/A:C - (6.8, None, None)
373 | AV:A/AC:M/Au:S/C:C/I:P/A:N - (5.8, None, None)
374 | AV:A/AC:M/Au:S/C:C/I:P/A:P - (6.3, None, None)
375 | AV:A/AC:M/Au:S/C:C/I:P/A:C - (7.0, None, None)
376 | AV:A/AC:M/Au:S/C:C/I:C/A:N - (6.8, None, None)
377 | AV:A/AC:M/Au:S/C:C/I:C/A:P - (7.0, None, None)
378 | AV:A/AC:M/Au:S/C:C/I:C/A:C - (7.4, None, None)
379 | AV:A/AC:M/Au:N/C:N/I:N/A:N - (0.0, None, None)
380 | AV:A/AC:M/Au:N/C:N/I:N/A:P - (2.9, None, None)
381 | AV:A/AC:M/Au:N/C:N/I:N/A:C - (5.7, None, None)
382 | AV:A/AC:M/Au:N/C:N/I:P/A:N - (2.9, None, None)
383 | AV:A/AC:M/Au:N/C:N/I:P/A:P - (4.3, None, None)
384 | AV:A/AC:M/Au:N/C:N/I:P/A:C - (6.4, None, None)
385 | AV:A/AC:M/Au:N/C:N/I:C/A:N - (5.7, None, None)
386 | AV:A/AC:M/Au:N/C:N/I:C/A:P - (6.4, None, None)
387 | AV:A/AC:M/Au:N/C:N/I:C/A:C - (7.3, None, None)
388 | AV:A/AC:M/Au:N/C:P/I:N/A:N - (2.9, None, None)
389 | AV:A/AC:M/Au:N/C:P/I:N/A:P - (4.3, None, None)
390 | AV:A/AC:M/Au:N/C:P/I:N/A:C - (6.4, None, None)
391 | AV:A/AC:M/Au:N/C:P/I:P/A:N - (4.3, None, None)
392 | AV:A/AC:M/Au:N/C:P/I:P/A:P - (5.4, None, None)
393 | AV:A/AC:M/Au:N/C:P/I:P/A:C - (6.9, None, None)
394 | AV:A/AC:M/Au:N/C:P/I:C/A:N - (6.4, None, None)
395 | AV:A/AC:M/Au:N/C:P/I:C/A:P - (6.9, None, None)
396 | AV:A/AC:M/Au:N/C:P/I:C/A:C - (7.6, None, None)
397 | AV:A/AC:M/Au:N/C:C/I:N/A:N - (5.7, None, None)
398 | AV:A/AC:M/Au:N/C:C/I:N/A:P - (6.4, None, None)
399 | AV:A/AC:M/Au:N/C:C/I:N/A:C - (7.3, None, None)
400 | AV:A/AC:M/Au:N/C:C/I:P/A:N - (6.4, None, None)
401 | AV:A/AC:M/Au:N/C:C/I:P/A:P - (6.9, None, None)
402 | AV:A/AC:M/Au:N/C:C/I:P/A:C - (7.6, None, None)
403 | AV:A/AC:M/Au:N/C:C/I:C/A:N - (7.3, None, None)
404 | AV:A/AC:M/Au:N/C:C/I:C/A:P - (7.6, None, None)
405 | AV:A/AC:M/Au:N/C:C/I:C/A:C - (7.9, None, None)
406 | AV:A/AC:L/Au:M/C:N/I:N/A:N - (0.0, None, None)
407 | AV:A/AC:L/Au:M/C:N/I:N/A:P - (2.2, None, None)
408 | AV:A/AC:L/Au:M/C:N/I:N/A:C - (5.0, None, None)
409 | AV:A/AC:L/Au:M/C:N/I:P/A:N - (2.2, None, None)
410 | AV:A/AC:L/Au:M/C:N/I:P/A:P - (3.7, None, None)
411 | AV:A/AC:L/Au:M/C:N/I:P/A:C - (5.7, None, None)
412 | AV:A/AC:L/Au:M/C:N/I:C/A:N - (5.0, None, None)
413 | AV:A/AC:L/Au:M/C:N/I:C/A:P - (5.7, None, None)
414 | AV:A/AC:L/Au:M/C:N/I:C/A:C - (6.7, None, None)
415 | AV:A/AC:L/Au:M/C:P/I:N/A:N - (2.2, None, None)
416 | AV:A/AC:L/Au:M/C:P/I:N/A:P - (3.7, None, None)
417 | AV:A/AC:L/Au:M/C:P/I:N/A:C - (5.7, None, None)
418 | AV:A/AC:L/Au:M/C:P/I:P/A:N - (3.7, None, None)
419 | AV:A/AC:L/Au:M/C:P/I:P/A:P - (4.7, None, None)
420 | AV:A/AC:L/Au:M/C:P/I:P/A:C - (6.2, None, None)
421 | AV:A/AC:L/Au:M/C:P/I:C/A:N - (5.7, None, None)
422 | AV:A/AC:L/Au:M/C:P/I:C/A:P - (6.2, None, None)
423 | AV:A/AC:L/Au:M/C:P/I:C/A:C - (6.9, None, None)
424 | AV:A/AC:L/Au:M/C:C/I:N/A:N - (5.0, None, None)
425 | AV:A/AC:L/Au:M/C:C/I:N/A:P - (5.7, None, None)
426 | AV:A/AC:L/Au:M/C:C/I:N/A:C - (6.7, None, None)
427 | AV:A/AC:L/Au:M/C:C/I:P/A:N - (5.7, None, None)
428 | AV:A/AC:L/Au:M/C:C/I:P/A:P - (6.2, None, None)
429 | AV:A/AC:L/Au:M/C:C/I:P/A:C - (6.9, None, None)
430 | AV:A/AC:L/Au:M/C:C/I:C/A:N - (6.7, None, None)
431 | AV:A/AC:L/Au:M/C:C/I:C/A:P - (6.9, None, None)
432 | AV:A/AC:L/Au:M/C:C/I:C/A:C - (7.2, None, None)
433 | AV:A/AC:L/Au:S/C:N/I:N/A:N - (0.0, None, None)
434 | AV:A/AC:L/Au:S/C:N/I:N/A:P - (2.7, None, None)
435 | AV:A/AC:L/Au:S/C:N/I:N/A:C - (5.5, None, None)
436 | AV:A/AC:L/Au:S/C:N/I:P/A:N - (2.7, None, None)
437 | AV:A/AC:L/Au:S/C:N/I:P/A:P - (4.1, None, None)
438 | AV:A/AC:L/Au:S/C:N/I:P/A:C - (6.2, None, None)
439 | AV:A/AC:L/Au:S/C:N/I:C/A:N - (5.5, None, None)
440 | AV:A/AC:L/Au:S/C:N/I:C/A:P - (6.2, None, None)
441 | AV:A/AC:L/Au:S/C:N/I:C/A:C - (7.1, None, None)
442 | AV:A/AC:L/Au:S/C:P/I:N/A:N - (2.7, None, None)
443 | AV:A/AC:L/Au:S/C:P/I:N/A:P - (4.1, None, None)
444 | AV:A/AC:L/Au:S/C:P/I:N/A:C - (6.2, None, None)
445 | AV:A/AC:L/Au:S/C:P/I:P/A:N - (4.1, None, None)
446 | AV:A/AC:L/Au:S/C:P/I:P/A:P - (5.2, None, None)
447 | AV:A/AC:L/Au:S/C:P/I:P/A:C - (6.7, None, None)
448 | AV:A/AC:L/Au:S/C:P/I:C/A:N - (6.2, None, None)
449 | AV:A/AC:L/Au:S/C:P/I:C/A:P - (6.7, None, None)
450 | AV:A/AC:L/Au:S/C:P/I:C/A:C - (7.4, None, None)
451 | AV:A/AC:L/Au:S/C:C/I:N/A:N - (5.5, None, None)
452 | AV:A/AC:L/Au:S/C:C/I:N/A:P - (6.2, None, None)
453 | AV:A/AC:L/Au:S/C:C/I:N/A:C - (7.1, None, None)
454 | AV:A/AC:L/Au:S/C:C/I:P/A:N - (6.2, None, None)
455 | AV:A/AC:L/Au:S/C:C/I:P/A:P - (6.7, None, None)
456 | AV:A/AC:L/Au:S/C:C/I:P/A:C - (7.4, None, None)
457 | AV:A/AC:L/Au:S/C:C/I:C/A:N - (7.1, None, None)
458 | AV:A/AC:L/Au:S/C:C/I:C/A:P - (7.4, None, None)
459 | AV:A/AC:L/Au:S/C:C/I:C/A:C - (7.7, None, None)
460 | AV:A/AC:L/Au:N/C:N/I:N/A:N - (0.0, None, None)
461 | AV:A/AC:L/Au:N/C:N/I:N/A:P - (3.3, None, None)
462 | AV:A/AC:L/Au:N/C:N/I:N/A:C - (6.1, None, None)
463 | AV:A/AC:L/Au:N/C:N/I:P/A:N - (3.3, None, None)
464 | AV:A/AC:L/Au:N/C:N/I:P/A:P - (4.8, None, None)
465 | AV:A/AC:L/Au:N/C:N/I:P/A:C - (6.8, None, None)
466 | AV:A/AC:L/Au:N/C:N/I:C/A:N - (6.1, None, None)
467 | AV:A/AC:L/Au:N/C:N/I:C/A:P - (6.8, None, None)
468 | AV:A/AC:L/Au:N/C:N/I:C/A:C - (7.8, None, None)
469 | AV:A/AC:L/Au:N/C:P/I:N/A:N - (3.3, None, None)
470 | AV:A/AC:L/Au:N/C:P/I:N/A:P - (4.8, None, None)
471 | AV:A/AC:L/Au:N/C:P/I:N/A:C - (6.8, None, None)
472 | AV:A/AC:L/Au:N/C:P/I:P/A:N - (4.8, None, None)
473 | AV:A/AC:L/Au:N/C:P/I:P/A:P - (5.8, None, None)
474 | AV:A/AC:L/Au:N/C:P/I:P/A:C - (7.3, None, None)
475 | AV:A/AC:L/Au:N/C:P/I:C/A:N - (6.8, None, None)
476 | AV:A/AC:L/Au:N/C:P/I:C/A:P - (7.3, None, None)
477 | AV:A/AC:L/Au:N/C:P/I:C/A:C - (8.0, None, None)
478 | AV:A/AC:L/Au:N/C:C/I:N/A:N - (6.1, None, None)
479 | AV:A/AC:L/Au:N/C:C/I:N/A:P - (6.8, None, None)
480 | AV:A/AC:L/Au:N/C:C/I:N/A:C - (7.8, None, None)
481 | AV:A/AC:L/Au:N/C:C/I:P/A:N - (6.8, None, None)
482 | AV:A/AC:L/Au:N/C:C/I:P/A:P - (7.3, None, None)
483 | AV:A/AC:L/Au:N/C:C/I:P/A:C - (8.0, None, None)
484 | AV:A/AC:L/Au:N/C:C/I:C/A:N - (7.8, None, None)
485 | AV:A/AC:L/Au:N/C:C/I:C/A:P - (8.0, None, None)
486 | AV:A/AC:L/Au:N/C:C/I:C/A:C - (8.3, None, None)
487 | AV:N/AC:H/Au:M/C:N/I:N/A:N - (-0.0, None, None)
488 | AV:N/AC:H/Au:M/C:N/I:N/A:P - (1.7, None, None)
489 | AV:N/AC:H/Au:M/C:N/I:N/A:C - (4.6, None, None)
490 | AV:N/AC:H/Au:M/C:N/I:P/A:N - (1.7, None, None)
491 | AV:N/AC:H/Au:M/C:N/I:P/A:P - (3.2, None, None)
492 | AV:N/AC:H/Au:M/C:N/I:P/A:C - (5.3, None, None)
493 | AV:N/AC:H/Au:M/C:N/I:C/A:N - (4.6, None, None)
494 | AV:N/AC:H/Au:M/C:N/I:C/A:P - (5.3, None, None)
495 | AV:N/AC:H/Au:M/C:N/I:C/A:C - (6.2, None, None)
496 | AV:N/AC:H/Au:M/C:P/I:N/A:N - (1.7, None, None)
497 | AV:N/AC:H/Au:M/C:P/I:N/A:P - (3.2, None, None)
498 | AV:N/AC:H/Au:M/C:P/I:N/A:C - (5.3, None, None)
499 | AV:N/AC:H/Au:M/C:P/I:P/A:N - (3.2, None, None)
500 | AV:N/AC:H/Au:M/C:P/I:P/A:P - (4.3, None, None)
501 | AV:N/AC:H/Au:M/C:P/I:P/A:C - (5.8, None, None)
502 | AV:N/AC:H/Au:M/C:P/I:C/A:N - (5.3, None, None)
503 | AV:N/AC:H/Au:M/C:P/I:C/A:P - (5.8, None, None)
504 | AV:N/AC:H/Au:M/C:P/I:C/A:C - (6.4, None, None)
505 | AV:N/AC:H/Au:M/C:C/I:N/A:N - (4.6, None, None)
506 | AV:N/AC:H/Au:M/C:C/I:N/A:P - (5.3, None, None)
507 | AV:N/AC:H/Au:M/C:C/I:N/A:C - (6.2, None, None)
508 | AV:N/AC:H/Au:M/C:C/I:P/A:N - (5.3, None, None)
509 | AV:N/AC:H/Au:M/C:C/I:P/A:P - (5.8, None, None)
510 | AV:N/AC:H/Au:M/C:C/I:P/A:C - (6.4, None, None)
511 | AV:N/AC:H/Au:M/C:C/I:C/A:N - (6.2, None, None)
512 | AV:N/AC:H/Au:M/C:C/I:C/A:P - (6.4, None, None)
513 | AV:N/AC:H/Au:M/C:C/I:C/A:C - (6.8, None, None)
514 | AV:N/AC:H/Au:S/C:N/I:N/A:N - (0.0, None, None)
515 | AV:N/AC:H/Au:S/C:N/I:N/A:P - (2.1, None, None)
516 | AV:N/AC:H/Au:S/C:N/I:N/A:C - (4.9, None, None)
517 | AV:N/AC:H/Au:S/C:N/I:P/A:N - (2.1, None, None)
518 | AV:N/AC:H/Au:S/C:N/I:P/A:P - (3.6, None, None)
519 | AV:N/AC:H/Au:S/C:N/I:P/A:C - (5.6, None, None)
520 | AV:N/AC:H/Au:S/C:N/I:C/A:N - (4.9, None, None)
521 | AV:N/AC:H/Au:S/C:N/I:C/A:P - (5.6, None, None)
522 | AV:N/AC:H/Au:S/C:N/I:C/A:C - (6.6, None, None)
523 | AV:N/AC:H/Au:S/C:P/I:N/A:N - (2.1, None, None)
524 | AV:N/AC:H/Au:S/C:P/I:N/A:P - (3.6, None, None)
525 | AV:N/AC:H/Au:S/C:P/I:N/A:C - (5.6, None, None)
526 | AV:N/AC:H/Au:S/C:P/I:P/A:N - (3.6, None, None)
527 | AV:N/AC:H/Au:S/C:P/I:P/A:P - (4.6, None, None)
528 | AV:N/AC:H/Au:S/C:P/I:P/A:C - (6.1, None, None)
529 | AV:N/AC:H/Au:S/C:P/I:C/A:N - (5.6, None, None)
530 | AV:N/AC:H/Au:S/C:P/I:C/A:P - (6.1, None, None)
531 | AV:N/AC:H/Au:S/C:P/I:C/A:C - (6.8, None, None)
532 | AV:N/AC:H/Au:S/C:C/I:N/A:N - (4.9, None, None)
533 | AV:N/AC:H/Au:S/C:C/I:N/A:P - (5.6, None, None)
534 | AV:N/AC:H/Au:S/C:C/I:N/A:C - (6.6, None, None)
535 | AV:N/AC:H/Au:S/C:C/I:P/A:N - (5.6, None, None)
536 | AV:N/AC:H/Au:S/C:C/I:P/A:P - (6.1, None, None)
537 | AV:N/AC:H/Au:S/C:C/I:P/A:C - (6.8, None, None)
538 | AV:N/AC:H/Au:S/C:C/I:C/A:N - (6.6, None, None)
539 | AV:N/AC:H/Au:S/C:C/I:C/A:P - (6.8, None, None)
540 | AV:N/AC:H/Au:S/C:C/I:C/A:C - (7.1, None, None)
541 | AV:N/AC:H/Au:N/C:N/I:N/A:N - (0.0, None, None)
542 | AV:N/AC:H/Au:N/C:N/I:N/A:P - (2.6, None, None)
543 | AV:N/AC:H/Au:N/C:N/I:N/A:C - (5.4, None, None)
544 | AV:N/AC:H/Au:N/C:N/I:P/A:N - (2.6, None, None)
545 | AV:N/AC:H/Au:N/C:N/I:P/A:P - (4.0, None, None)
546 | AV:N/AC:H/Au:N/C:N/I:P/A:C - (6.1, None, None)
547 | AV:N/AC:H/Au:N/C:N/I:C/A:N - (5.4, None, None)
548 | AV:N/AC:H/Au:N/C:N/I:C/A:P - (6.1, None, None)
549 | AV:N/AC:H/Au:N/C:N/I:C/A:C - (7.1, None, None)
550 | AV:N/AC:H/Au:N/C:P/I:N/A:N - (2.6, None, None)
551 | AV:N/AC:H/Au:N/C:P/I:N/A:P - (4.0, None, None)
552 | AV:N/AC:H/Au:N/C:P/I:N/A:C - (6.1, None, None)
553 | AV:N/AC:H/Au:N/C:P/I:P/A:N - (4.0, None, None)
554 | AV:N/AC:H/Au:N/C:P/I:P/A:P - (5.1, None, None)
555 | AV:N/AC:H/Au:N/C:P/I:P/A:C - (6.6, None, None)
556 | AV:N/AC:H/Au:N/C:P/I:C/A:N - (6.1, None, None)
557 | AV:N/AC:H/Au:N/C:P/I:C/A:P - (6.6, None, None)
558 | AV:N/AC:H/Au:N/C:P/I:C/A:C - (7.3, None, None)
559 | AV:N/AC:H/Au:N/C:C/I:N/A:N - (5.4, None, None)
560 | AV:N/AC:H/Au:N/C:C/I:N/A:P - (6.1, None, None)
561 | AV:N/AC:H/Au:N/C:C/I:N/A:C - (7.1, None, None)
562 | AV:N/AC:H/Au:N/C:C/I:P/A:N - (6.1, None, None)
563 | AV:N/AC:H/Au:N/C:C/I:P/A:P - (6.6, None, None)
564 | AV:N/AC:H/Au:N/C:C/I:P/A:C - (7.3, None, None)
565 | AV:N/AC:H/Au:N/C:C/I:C/A:N - (7.1, None, None)
566 | AV:N/AC:H/Au:N/C:C/I:C/A:P - (7.3, None, None)
567 | AV:N/AC:H/Au:N/C:C/I:C/A:C - (7.6, None, None)
568 | AV:N/AC:M/Au:M/C:N/I:N/A:N - (0.0, None, None)
569 | AV:N/AC:M/Au:M/C:N/I:N/A:P - (2.8, None, None)
570 | AV:N/AC:M/Au:M/C:N/I:N/A:C - (5.7, None, None)
571 | AV:N/AC:M/Au:M/C:N/I:P/A:N - (2.8, None, None)
572 | AV:N/AC:M/Au:M/C:N/I:P/A:P - (4.3, None, None)
573 | AV:N/AC:M/Au:M/C:N/I:P/A:C - (6.4, None, None)
574 | AV:N/AC:M/Au:M/C:N/I:C/A:N - (5.7, None, None)
575 | AV:N/AC:M/Au:M/C:N/I:C/A:P - (6.4, None, None)
576 | AV:N/AC:M/Au:M/C:N/I:C/A:C - (7.3, None, None)
577 | AV:N/AC:M/Au:M/C:P/I:N/A:N - (2.8, None, None)
578 | AV:N/AC:M/Au:M/C:P/I:N/A:P - (4.3, None, None)
579 | AV:N/AC:M/Au:M/C:P/I:N/A:C - (6.4, None, None)
580 | AV:N/AC:M/Au:M/C:P/I:P/A:N - (4.3, None, None)
581 | AV:N/AC:M/Au:M/C:P/I:P/A:P - (5.4, None, None)
582 | AV:N/AC:M/Au:M/C:P/I:P/A:C - (6.9, None, None)
583 | AV:N/AC:M/Au:M/C:P/I:C/A:N - (6.4, None, None)
584 | AV:N/AC:M/Au:M/C:P/I:C/A:P - (6.9, None, None)
585 | AV:N/AC:M/Au:M/C:P/I:C/A:C - (7.5, None, None)
586 | AV:N/AC:M/Au:M/C:C/I:N/A:N - (5.7, None, None)
587 | AV:N/AC:M/Au:M/C:C/I:N/A:P - (6.4, None, None)
588 | AV:N/AC:M/Au:M/C:C/I:N/A:C - (7.3, None, None)
589 | AV:N/AC:M/Au:M/C:C/I:P/A:N - (6.4, None, None)
590 | AV:N/AC:M/Au:M/C:C/I:P/A:P - (6.9, None, None)
591 | AV:N/AC:M/Au:M/C:C/I:P/A:C - (7.5, None, None)
592 | AV:N/AC:M/Au:M/C:C/I:C/A:N - (7.3, None, None)
593 | AV:N/AC:M/Au:M/C:C/I:C/A:P - (7.5, None, None)
594 | AV:N/AC:M/Au:M/C:C/I:C/A:C - (7.9, None, None)
595 | AV:N/AC:M/Au:S/C:N/I:N/A:N - (0.0, None, None)
596 | AV:N/AC:M/Au:S/C:N/I:N/A:P - (3.5, None, None)
597 | AV:N/AC:M/Au:S/C:N/I:N/A:C - (6.3, None, None)
598 | AV:N/AC:M/Au:S/C:N/I:P/A:N - (3.5, None, None)
599 | AV:N/AC:M/Au:S/C:N/I:P/A:P - (4.9, None, None)
600 | AV:N/AC:M/Au:S/C:N/I:P/A:C - (7.0, None, None)
601 | AV:N/AC:M/Au:S/C:N/I:C/A:N - (6.3, None, None)
602 | AV:N/AC:M/Au:S/C:N/I:C/A:P - (7.0, None, None)
603 | AV:N/AC:M/Au:S/C:N/I:C/A:C - (7.9, None, None)
604 | AV:N/AC:M/Au:S/C:P/I:N/A:N - (3.5, None, None)
605 | AV:N/AC:M/Au:S/C:P/I:N/A:P - (4.9, None, None)
606 | AV:N/AC:M/Au:S/C:P/I:N/A:C - (7.0, None, None)
607 | AV:N/AC:M/Au:S/C:P/I:P/A:N - (4.9, None, None)
608 | AV:N/AC:M/Au:S/C:P/I:P/A:P - (6.0, None, None)
609 | AV:N/AC:M/Au:S/C:P/I:P/A:C - (7.5, None, None)
610 | AV:N/AC:M/Au:S/C:P/I:C/A:N - (7.0, None, None)
611 | AV:N/AC:M/Au:S/C:P/I:C/A:P - (7.5, None, None)
612 | AV:N/AC:M/Au:S/C:P/I:C/A:C - (8.2, None, None)
613 | AV:N/AC:M/Au:S/C:C/I:N/A:N - (6.3, None, None)
614 | AV:N/AC:M/Au:S/C:C/I:N/A:P - (7.0, None, None)
615 | AV:N/AC:M/Au:S/C:C/I:N/A:C - (7.9, None, None)
616 | AV:N/AC:M/Au:S/C:C/I:P/A:N - (7.0, None, None)
617 | AV:N/AC:M/Au:S/C:C/I:P/A:P - (7.5, None, None)
618 | AV:N/AC:M/Au:S/C:C/I:P/A:C - (8.2, None, None)
619 | AV:N/AC:M/Au:S/C:C/I:C/A:N - (7.9, None, None)
620 | AV:N/AC:M/Au:S/C:C/I:C/A:P - (8.2, None, None)
621 | AV:N/AC:M/Au:S/C:C/I:C/A:C - (8.5, None, None)
622 | AV:N/AC:M/Au:N/C:N/I:N/A:N - (0.0, None, None)
623 | AV:N/AC:M/Au:N/C:N/I:N/A:P - (4.3, None, None)
624 | AV:N/AC:M/Au:N/C:N/I:N/A:C - (7.1, None, None)
625 | AV:N/AC:M/Au:N/C:N/I:P/A:N - (4.3, None, None)
626 | AV:N/AC:M/Au:N/C:N/I:P/A:P - (5.8, None, None)
627 | AV:N/AC:M/Au:N/C:N/I:P/A:C - (7.8, None, None)
628 | AV:N/AC:M/Au:N/C:N/I:C/A:N - (7.1, None, None)
629 | AV:N/AC:M/Au:N/C:N/I:C/A:P - (7.8, None, None)
630 | AV:N/AC:M/Au:N/C:N/I:C/A:C - (8.8, None, None)
631 | AV:N/AC:M/Au:N/C:P/I:N/A:N - (4.3, None, None)
632 | AV:N/AC:M/Au:N/C:P/I:N/A:P - (5.8, None, None)
633 | AV:N/AC:M/Au:N/C:P/I:N/A:C - (7.8, None, None)
634 | AV:N/AC:M/Au:N/C:P/I:P/A:N - (5.8, None, None)
635 | AV:N/AC:M/Au:N/C:P/I:P/A:P - (6.8, None, None)
636 | AV:N/AC:M/Au:N/C:P/I:P/A:C - (8.3, None, None)
637 | AV:N/AC:M/Au:N/C:P/I:C/A:N - (7.8, None, None)
638 | AV:N/AC:M/Au:N/C:P/I:C/A:P - (8.3, None, None)
639 | AV:N/AC:M/Au:N/C:P/I:C/A:C - (9.0, None, None)
640 | AV:N/AC:M/Au:N/C:C/I:N/A:N - (7.1, None, None)
641 | AV:N/AC:M/Au:N/C:C/I:N/A:P - (7.8, None, None)
642 | AV:N/AC:M/Au:N/C:C/I:N/A:C - (8.8, None, None)
643 | AV:N/AC:M/Au:N/C:C/I:P/A:N - (7.8, None, None)
644 | AV:N/AC:M/Au:N/C:C/I:P/A:P - (8.3, None, None)
645 | AV:N/AC:M/Au:N/C:C/I:P/A:C - (9.0, None, None)
646 | AV:N/AC:M/Au:N/C:C/I:C/A:N - (8.8, None, None)
647 | AV:N/AC:M/Au:N/C:C/I:C/A:P - (9.0, None, None)
648 | AV:N/AC:M/Au:N/C:C/I:C/A:C - (9.3, None, None)
649 | AV:N/AC:L/Au:M/C:N/I:N/A:N - (0.0, None, None)
650 | AV:N/AC:L/Au:M/C:N/I:N/A:P - (3.3, None, None)
651 | AV:N/AC:L/Au:M/C:N/I:N/A:C - (6.1, None, None)
652 | AV:N/AC:L/Au:M/C:N/I:P/A:N - (3.3, None, None)
653 | AV:N/AC:L/Au:M/C:N/I:P/A:P - (4.7, None, None)
654 | AV:N/AC:L/Au:M/C:N/I:P/A:C - (6.8, None, None)
655 | AV:N/AC:L/Au:M/C:N/I:C/A:N - (6.1, None, None)
656 | AV:N/AC:L/Au:M/C:N/I:C/A:P - (6.8, None, None)
657 | AV:N/AC:L/Au:M/C:N/I:C/A:C - (7.7, None, None)
658 | AV:N/AC:L/Au:M/C:P/I:N/A:N - (3.3, None, None)
659 | AV:N/AC:L/Au:M/C:P/I:N/A:P - (4.7, None, None)
660 | AV:N/AC:L/Au:M/C:P/I:N/A:C - (6.8, None, None)
661 | AV:N/AC:L/Au:M/C:P/I:P/A:N - (4.7, None, None)
662 | AV:N/AC:L/Au:M/C:P/I:P/A:P - (5.8, None, None)
663 | AV:N/AC:L/Au:M/C:P/I:P/A:C - (7.3, None, None)
664 | AV:N/AC:L/Au:M/C:P/I:C/A:N - (6.8, None, None)
665 | AV:N/AC:L/Au:M/C:P/I:C/A:P - (7.3, None, None)
666 | AV:N/AC:L/Au:M/C:P/I:C/A:C - (8.0, None, None)
667 | AV:N/AC:L/Au:M/C:C/I:N/A:N - (6.1, None, None)
668 | AV:N/AC:L/Au:M/C:C/I:N/A:P - (6.8, None, None)
669 | AV:N/AC:L/Au:M/C:C/I:N/A:C - (7.7, None, None)
670 | AV:N/AC:L/Au:M/C:C/I:P/A:N - (6.8, None, None)
671 | AV:N/AC:L/Au:M/C:C/I:P/A:P - (7.3, None, None)
672 | AV:N/AC:L/Au:M/C:C/I:P/A:C - (8.0, None, None)
673 | AV:N/AC:L/Au:M/C:C/I:C/A:N - (7.7, None, None)
674 | AV:N/AC:L/Au:M/C:C/I:C/A:P - (8.0, None, None)
675 | AV:N/AC:L/Au:M/C:C/I:C/A:C - (8.3, None, None)
676 | AV:N/AC:L/Au:S/C:N/I:N/A:N - (0.0, None, None)
677 | AV:N/AC:L/Au:S/C:N/I:N/A:P - (4.0, None, None)
678 | AV:N/AC:L/Au:S/C:N/I:N/A:C - (6.8, None, None)
679 | AV:N/AC:L/Au:S/C:N/I:P/A:N - (4.0, None, None)
680 | AV:N/AC:L/Au:S/C:N/I:P/A:P - (5.5, None, None)
681 | AV:N/AC:L/Au:S/C:N/I:P/A:C - (7.5, None, None)
682 | AV:N/AC:L/Au:S/C:N/I:C/A:N - (6.8, None, None)
683 | AV:N/AC:L/Au:S/C:N/I:C/A:P - (7.5, None, None)
684 | AV:N/AC:L/Au:S/C:N/I:C/A:C - (8.5, None, None)
685 | AV:N/AC:L/Au:S/C:P/I:N/A:N - (4.0, None, None)
686 | AV:N/AC:L/Au:S/C:P/I:N/A:P - (5.5, None, None)
687 | AV:N/AC:L/Au:S/C:P/I:N/A:C - (7.5, None, None)
688 | AV:N/AC:L/Au:S/C:P/I:P/A:N - (5.5, None, None)
689 | AV:N/AC:L/Au:S/C:P/I:P/A:P - (6.5, None, None)
690 | AV:N/AC:L/Au:S/C:P/I:P/A:C - (8.0, None, None)
691 | AV:N/AC:L/Au:S/C:P/I:C/A:N - (7.5, None, None)
692 | AV:N/AC:L/Au:S/C:P/I:C/A:P - (8.0, None, None)
693 | AV:N/AC:L/Au:S/C:P/I:C/A:C - (8.7, None, None)
694 | AV:N/AC:L/Au:S/C:C/I:N/A:N - (6.8, None, None)
695 | AV:N/AC:L/Au:S/C:C/I:N/A:P - (7.5, None, None)
696 | AV:N/AC:L/Au:S/C:C/I:N/A:C - (8.5, None, None)
697 | AV:N/AC:L/Au:S/C:C/I:P/A:N - (7.5, None, None)
698 | AV:N/AC:L/Au:S/C:C/I:P/A:P - (8.0, None, None)
699 | AV:N/AC:L/Au:S/C:C/I:P/A:C - (8.7, None, None)
700 | AV:N/AC:L/Au:S/C:C/I:C/A:N - (8.5, None, None)
701 | AV:N/AC:L/Au:S/C:C/I:C/A:P - (8.7, None, None)
702 | AV:N/AC:L/Au:S/C:C/I:C/A:C - (9.0, None, None)
703 | AV:N/AC:L/Au:N/C:N/I:N/A:N - (0.0, None, None)
704 | AV:N/AC:L/Au:N/C:N/I:N/A:P - (5.0, None, None)
705 | AV:N/AC:L/Au:N/C:N/I:N/A:C - (7.8, None, None)
706 | AV:N/AC:L/Au:N/C:N/I:P/A:N - (5.0, None, None)
707 | AV:N/AC:L/Au:N/C:N/I:P/A:P - (6.4, None, None)
708 | AV:N/AC:L/Au:N/C:N/I:P/A:C - (8.5, None, None)
709 | AV:N/AC:L/Au:N/C:N/I:C/A:N - (7.8, None, None)
710 | AV:N/AC:L/Au:N/C:N/I:C/A:P - (8.5, None, None)
711 | AV:N/AC:L/Au:N/C:N/I:C/A:C - (9.4, None, None)
712 | AV:N/AC:L/Au:N/C:P/I:N/A:N - (5.0, None, None)
713 | AV:N/AC:L/Au:N/C:P/I:N/A:P - (6.4, None, None)
714 | AV:N/AC:L/Au:N/C:P/I:N/A:C - (8.5, None, None)
715 | AV:N/AC:L/Au:N/C:P/I:P/A:N - (6.4, None, None)
716 | AV:N/AC:L/Au:N/C:P/I:P/A:P - (7.5, None, None)
717 | AV:N/AC:L/Au:N/C:P/I:P/A:C - (9.0, None, None)
718 | AV:N/AC:L/Au:N/C:P/I:C/A:N - (8.5, None, None)
719 | AV:N/AC:L/Au:N/C:P/I:C/A:P - (9.0, None, None)
720 | AV:N/AC:L/Au:N/C:P/I:C/A:C - (9.7, None, None)
721 | AV:N/AC:L/Au:N/C:C/I:N/A:N - (7.8, None, None)
722 | AV:N/AC:L/Au:N/C:C/I:N/A:P - (8.5, None, None)
723 | AV:N/AC:L/Au:N/C:C/I:N/A:C - (9.4, None, None)
724 | AV:N/AC:L/Au:N/C:C/I:P/A:N - (8.5, None, None)
725 | AV:N/AC:L/Au:N/C:C/I:P/A:P - (9.0, None, None)
726 | AV:N/AC:L/Au:N/C:C/I:P/A:C - (9.7, None, None)
727 | AV:N/AC:L/Au:N/C:C/I:C/A:N - (9.4, None, None)
728 | AV:N/AC:L/Au:N/C:C/I:C/A:P - (9.7, None, None)
729 | AV:N/AC:L/Au:N/C:C/I:C/A:C - (10.0, None, None)
730 |
--------------------------------------------------------------------------------
/tests/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | DJANGO_SETTINGS_MODULE =django_app.settings
3 | python_paths = django_app/
--------------------------------------------------------------------------------
/tests/test_django.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from django_app.app.models import v2Model, v3Model, namedModel # Ensure you are running py.test in the tests/ directory.
3 |
4 | from cvsslib import cvss2, cvss3, parse_vector
5 | from cvsslib.base_enum import BaseEnum, NotDefined
6 | from cvsslib.contrib.django_model import KeyedEnumField
7 | from cvsslib.example_vectors import v3_vectors, v2_vectors
8 |
9 |
10 | class TempEnum(BaseEnum):
11 | SOME_VALUE = 1
12 | NOT_DEFINED = NotDefined(1)
13 |
14 |
15 | def test_named_metaclass():
16 | base = namedModel.__bases__[0]
17 | assert base.__name__ == "namedMeta.django_utils"
18 | assert base.__module__ == "django_app.app.models"
19 |
20 |
21 | def test_field():
22 | field = KeyedEnumField(TempEnum, default=TempEnum.NOT_DEFINED.name)
23 | assert field.get_default() == TempEnum.NOT_DEFINED.name
24 | assert field.get_prep_value(TempEnum.SOME_VALUE) == TempEnum.SOME_VALUE.name
25 | assert field.to_python(TempEnum.SOME_VALUE.name) == TempEnum.SOME_VALUE
26 | assert field.to_python(TempEnum.NOT_DEFINED.name) == TempEnum.NOT_DEFINED
27 |
28 |
29 | @pytest.mark.django_db
30 | def test_models():
31 | for vectors, module, model in [
32 | (v3_vectors, cvss3, v3Model), (v2_vectors, cvss2, v2Model)
33 | ]:
34 | for vector, expected in vectors:
35 | inst = model()
36 | inst.from_vector(
37 | parse_vector(vector, module)
38 | )
39 | inst.save()
40 |
41 | assert inst.calculate() == expected
42 | assert inst.to_vector() == vector
43 |
44 | assert inst.debug()
--------------------------------------------------------------------------------
/tests/test_enums.py:
--------------------------------------------------------------------------------
1 | from cvsslib.base_enum import BaseEnum, NotDefined
2 |
3 |
4 | class TempEnum(BaseEnum):
5 | SOME_VALUE = 1
6 | NOT_DEFINED = NotDefined(1)
7 |
8 |
9 | new_enum = TempEnum.extend("NewEnum", {
10 | "SOME_OTHER_VALUE": 2,
11 | "_vectors": {
12 | "SOV": "SOME_OTHER_VALUE"
13 | }
14 | })
15 |
16 |
17 | def test_not_defined_value():
18 | assert TempEnum.NOT_DEFINED.name == "NOT_DEFINED"
19 |
20 |
21 | def test_extend_enum():
22 | assert new_enum.SOME_OTHER_VALUE.get_value_key() == "SOV"
23 |
--------------------------------------------------------------------------------
/tests/test_rvss.py:
--------------------------------------------------------------------------------
1 | from cvsslib.vector import calculate_vector
2 | from cvsslib import RVSSState, CVSS3State, rvss, cvss3
3 | from cvsslib.utils import get_enums
4 | # from cvsslib.example_vectors import v3_vectors, rvss_vectors, rvss_comparison_vectors
5 |
6 | # TODO: bring this vector to "example_vectors.py" file, eventually
7 | rvss_vectors = [
8 | # Various tests for the attack vector (AV)
9 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.8, 5.8, 7.1)),
10 | ("RVSS:1.0/AV:RN/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (6.1, 6.1, 8.1)),
11 | ("RVSS:1.0/AV:AN/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.9, 5.9, 7.3)),
12 | ("RVSS:1.0/AV:PP/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.9, 5.9, 7.3)),
13 | ("RVSS:1.0/AV:PI/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.4, 5.4, 5.9)),
14 | # AV combinations
15 | ("RVSS:1.0/AV:ANPR/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.5, 5.5, 6.1)),
16 | ("RVSS:1.0/AV:PPL/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.6, 5.6, 6.4)),
17 | # Age tests
18 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:T/S:U/C:H/I:N/A:H/H:N/MPR:N", (5.9, 5.9, 7.4)),
19 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:O/S:U/C:H/I:N/A:H/H:N/MPR:N", (6.1, 6.1, 8.0)),
20 | ]
21 |
22 | test_rvss_vectors = [
23 | ("RVSS:1.0/AV:PI/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N"),
24 | ("RVSS:1.0/AV:ANPR/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N"),
25 | ("RVSS:1.0/AV:PPL/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N"),
26 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:T/S:U/C:H/I:N/A:H/H:N/MPR:N"),
27 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:O/S:U/C:H/I:N/A:H/H:N/MPR:N"),
28 | ]
29 |
30 | rvss_comparison_vectors = [
31 | ("CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N",
32 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N",
33 | (5.8, 5.8, 7.1)),
34 | ]
35 |
36 | safety_rvss_vectors = [
37 | # none and Unknown (==)
38 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N",
39 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:U"),
40 | # none and environmental (<)
41 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N",
42 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:E"),
43 | # environmental and human (<)
44 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:E",
45 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:H"),
46 | # human and environmental + modified safety: human (==)
47 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:H",
48 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:E/MH:H"),
49 | # human and human + safety requirement: high (<)
50 | ("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:H",
51 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:H/HR:H"),
52 | ]
53 |
54 | def test_safety_rvss():
55 | vector1, vector2 = safety_rvss_vectors[0]
56 | score1 = calculate_vector(vector1, rvss)
57 | score2 = calculate_vector(vector2, rvss)
58 | assert score1 == score2, "Test for NONE and UNKNOWN failed"
59 |
60 | vector1, vector2 = safety_rvss_vectors[1]
61 | score1 = calculate_vector(vector1, rvss)
62 | score2 = calculate_vector(vector2, rvss)
63 | assert score1 < score2, "Test for NONE and ENVIRONMENTAL failed"
64 |
65 | vector1, vector2 = safety_rvss_vectors[2]
66 | score1 = calculate_vector(vector1, rvss)
67 | score2 = calculate_vector(vector2, rvss)
68 | assert score1 < score2, "Test for ENVIRONMENTAL and HUMAN failed"
69 |
70 | vector1, vector2 = safety_rvss_vectors[3]
71 | score1 = calculate_vector(vector1, rvss)
72 | score2 = calculate_vector(vector2, rvss)
73 | assert max(score1) == max(score2), "Test for HUMAN and ENVIRONMENTAL+MODIFIED/HUMAN failed"
74 |
75 | vector1, vector2 = safety_rvss_vectors[4]
76 | score1 = calculate_vector(vector1, rvss)
77 | score2 = calculate_vector(vector2, rvss)
78 | assert max(score1) < max(score2), "Test for HUMAN and HUMAN+SAFETY-REQUIREMENT/HIGH failed"
79 |
80 | def test_v3_vectors():
81 | for vector, results in v3_vectors:
82 | score = calculate_vector(vector, cvss3)
83 | # print(score)
84 | # print(results)
85 | assert results == score, "Vector {0} failed".format(vector)
86 |
87 | def test_rvss_vectors():
88 | for vector, results in rvss_vectors:
89 | score = calculate_vector(vector, rvss)
90 | # print(score)
91 | # print(results)
92 | assert results == score, "Vector {0} failed".format(vector)
93 |
94 | def comparison_rvss_vectors():
95 | for vector1, vector2, results in rvss_comparison_vectors:
96 | score1 = calculate_vector(vector1, cvss3)
97 | score2 = calculate_vector(vector2, rvss)
98 | # print(score)
99 | # print(results)
100 | assert results == score1, "Vector {0} failed".format(vector1)
101 | assert results == score2, "Vector {0} failed".format(vector2)
102 | assert score1 == score2, "CVSS and RVSS vectors' score don't match "
103 |
104 | def test_age_rvss():
105 | score1 = calculate_vector("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:T/S:U/C:H/I:N/A:H/H:N/MPR:N", rvss)
106 | score2 = calculate_vector("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:O/S:U/C:H/I:N/A:H/H:N/MPR:N", rvss)
107 | assert max(score1) < max(score2), "Age test failed, Y:T is not less than Y:O"
108 |
109 | score1 = calculate_vector("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:O/S:U/C:H/I:N/A:H/H:U", rvss)
110 | # print(score1, max(score1))
111 | score2 = calculate_vector("RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:T/S:U/C:H/I:N/A:H/H:U/MY:O", rvss)
112 | # print(score2, max(score2))
113 | assert max(score1) == max(score2), "Age test failed, Y:O is not equal to Y:T/MY:O"
114 |
115 |
116 | ## Run tests
117 | test_rvss_vectors()
118 | comparison_rvss_vectors()
119 | test_age_rvss()
120 | test_safety_rvss()
121 |
122 | ###########
123 | ## Individual tests
124 | ###########
125 |
126 | # vector_v3 = "CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N"
127 | # print(calculate_vector(vector_v3, cvss3))
128 |
--------------------------------------------------------------------------------
/tests/test_vector.py:
--------------------------------------------------------------------------------
1 | from cvsslib.vector import calculate_vector
2 | from cvsslib import CVSS2State, CVSS3State, cvss3, cvss2
3 | from cvsslib.utils import get_enums
4 | from cvsslib.example_vectors import v3_vectors, v2_vectors
5 | import pathlib
6 |
7 |
8 | data_dir = pathlib.Path(__file__).parent / "files"
9 |
10 |
11 | def split_vector(line):
12 | vector, rest = line.split(" - ", 1)
13 | rest = rest.replace("(", "").replace(")", "").strip().split(", ")
14 | score = (float(rest[0]),
15 | float(rest[1]) if rest[1] != 'None' else None,
16 | float(rest[2]) if rest[2] != 'None' else None)
17 |
18 | return vector, score
19 |
20 |
21 | def test_v3_vector_files():
22 | for name in ("vectors_random3", "vectors_simple3"):
23 | with (data_dir / name).open() as fd:
24 | for line in fd:
25 | vector, score = split_vector(line)
26 |
27 | parsed = calculate_vector(vector, cvss3)
28 | assert parsed == score
29 |
30 |
31 | def test_v2_vector_files():
32 | for name in ("vectors_random2", "vectors_simple2"):
33 | with (data_dir / name).open() as fd:
34 | for line in fd:
35 | vector, score = split_vector(line)
36 |
37 | parsed = calculate_vector(vector, cvss2)
38 | assert parsed == score
39 |
40 |
41 | def test_v3_vector():
42 | for vector, results in v3_vectors:
43 | score = calculate_vector(vector, cvss3)
44 |
45 | assert results == score, "Vector {0} failed".format(vector)
46 |
47 |
48 | def test_v2_vector():
49 | for vector, results in v2_vectors:
50 | score = calculate_vector(vector, cvss2)
51 |
52 | assert results == score, "Vector {0} failed".format(vector)
53 |
54 |
55 | def test_cvss_class_mixin():
56 | # Test that an instance of every enum class is present within each of the state classes
57 |
58 | for cls, module, vectors in [(CVSS2State, cvss2, v2_vectors), (CVSS3State, cvss3, v3_vectors)]:
59 | instance = cls()
60 |
61 | enum_classes_in_module = set([x[1] for x in get_enums(module)])
62 | enum_classes_in_class = set([e[1].__class__ for e in get_enums(instance, only_classes=False)])
63 |
64 | assert enum_classes_in_class == enum_classes_in_module
65 |
66 | # For each test vector we parse it into an instance, then output a vector from that instance.
67 | # Then we make a new instance and feed that vector into it, then compare that the resulting calculations
68 | # are all equal.
69 |
70 | for vector, expected in vectors:
71 | instance = cls()
72 | instance.from_vector(vector)
73 |
74 | new_vector = instance.to_vector()
75 |
76 | new_instance = cls()
77 | new_instance.from_vector(new_vector)
78 |
79 | assert vector == new_vector
80 |
81 | assert new_instance.debug() == instance.debug()
82 |
83 | assert instance.calculate() == expected
84 | assert new_instance.calculate() == expected
85 |
86 |
--------------------------------------------------------------------------------
/tests/tests_cvss3_rvss.py:
--------------------------------------------------------------------------------
1 | from cvsslib.vector import calculate_vector
2 | from cvsslib import RVSSState, CVSS3State, rvss, cvss3
3 | from cvsslib.utils import get_enums
4 | # from cvsslib.example_vectors import v3_vectors, rvss_vectors, rvss_comparison_vectors
5 |
6 | rvss_comparison_vectors = [
7 | ("CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N",
8 | "RVSS:1.0/AV:L/AC:L/PR:H/UI:R/Y:U/S:U/C:H/I:N/A:H/H:N/MPR:N",
9 | (5.8, 5.8, 7.1)),
10 | ]
11 |
12 | analysis_vectors = [
13 | ("Missing authentication mechanisms in Robotis RoboPlus protocol allow remote attackers to unauthorizedly control the robot via network communication.",
14 | "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H",
15 | "RVSS:1.0/AV:ANPR/AC:L/PR:N/UI:N/Y:T/S:U/C:N/I:H/A:H/H:E"),
16 | ("An attacker on an adjacent network could perform command injection.",
17 | "CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
18 | "RVSS:1.0/AV:AN/AC:L/PR:N/UI:N/Y:O/S:U/C:H/I:H/A:H/H:E"),
19 | ("An stack-based buffer overflow in Universal Robots Modbus TCP service could allow remote attackers to execute arbitrary code and alter protected settings via specially crafted packets.",
20 | "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
21 | "RVSS:1.0/AV:AN/AC:L/PR:N/UI:N/Y:T/S:C/C:H/I:H/A:H/H:H",
22 | ),
23 | ("Vulnerabilities in robot middleware. Launching on arm64 with Fast-RTPS with fat archive from 2018-06-21 never quits.",
24 | "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N",
25 | "RVSS:1.0/AV:AN/AC:L/PR:N/UI:N/Y:O/S:U/C:N/I:N/A:N/H:H",
26 | ),
27 | ]
28 |
29 | def comparison_rvss_vectors():
30 | for vector1, vector2, results in rvss_comparison_vectors:
31 | score1 = calculate_vector(vector1, cvss3)
32 | score2 = calculate_vector(vector2, rvss)
33 | # print(score)
34 | # print(results)
35 | assert results == score1, "Vector {0} failed".format(vector1)
36 | assert results == score2, "Vector {0} failed".format(vector2)
37 | assert score1 == score2, "CVSS and RVSS vectors' score don't match "
38 |
39 | def analysis_cvss3_rvss_vector():
40 | for description, vector_cvss3, vector_rvss in analysis_vectors:
41 | score_cvss3 = calculate_vector(vector_cvss3, cvss3)
42 | score_rvss = calculate_vector(vector_rvss, rvss)
43 | print("---------------------------------------------------------------")
44 | print(description)
45 | print("CVSSv3: ",score_cvss3)
46 | print("RVSSv1: ",score_rvss)
47 |
48 |
49 | ## Run tests
50 | comparison_rvss_vectors()
51 | analysis_cvss3_rvss_vector()
52 |
53 | ###########
54 | ## Individual tests
55 | ###########
56 |
57 | # vector_v3 = "CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N"
58 | # print(calculate_vector(vector_v3, cvss3))
59 |
--------------------------------------------------------------------------------
/try.py:
--------------------------------------------------------------------------------
1 | from cvsslib import cvss2, cvss3, rvss, calculate_vector
2 |
3 | # vector_v2 = "AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N"
4 | # "AV:L/AC:M/Au:S/C:N/I:P/A:C/E:U/RL:OF/RC:UR/CDP:N/TD:L/CR:H/IR:H/AR:H"
5 | vector = "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N"
6 |
7 | # print(calculate_vector(vector_v2, cvss2))
8 | vector_v3 = "CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:N/A:H/MPR:N"
9 | # print("base_score, temporal_score and environment_score: "+str(calculate_vector(vector, cvss3)))
10 | print("base_score, temporal_score and environment_score: "+str(calculate_vector(vector, rvss)))
11 |
--------------------------------------------------------------------------------