
    <i[/              
          S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	J
r
  SSKJr  SS	KJr  SS
KJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJrJ r   SSK!J"r"  SSK#J$r$J%r%   " S S\"5      r& " S S\"5      r' " S S\"5      r( " S S\"5      r) " S S\"5      r*S4S jr+ " S S\"5      r, " S S\"5      r- " S S\5      r. " S  S!\"\5      r/\,\-S".r0S5S# jr1\/" S$S%S&S'\," S(S)9S*9r2\/" S+S%S&S,\," S-S)9S*9r3\/" S.S%S&S/\," S0S)9S*9r4\/" S1S%S&S2\," S3S)9S*9r5g)6z*STIX 2.1 Common Data Types and Properties.    )OrderedDict   )
_Extension   )_custom_extension_builder_custom_marking_builder)InvalidValueErrorPropertyPresenceError)_MarkingsMixin)check_tlp_marking)BooleanPropertyDictionaryPropertyEnumPropertyExtensionsPropertyHashesProperty
IDPropertyIntegerPropertyListPropertyPropertyReferencePropertySelectorPropertyStringPropertyTimestampPropertyTypeProperty)NOW	_get_dict)_STIXBase21)EXTENSION_TYPEHASHING_ALGORITHMc                      ^  \ rS rSrSr\" S\" SS94S\" 5       4S\" 5       4S\" \S	S
94S\" 5       4/5      r	1 Skr
U 4S jrSrU =r$ )ExternalReference   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_72bcfr3t79jx>`__.
source_nameTrequireddescriptionurlhashes2.1spec_versionexternal_id>   MD5TLSHSSDEEPSHA-1SHA-256SHA-512SHA3-256SHA3-512c                    >^  [         [        T ]  5         T R                  / SQ5        ST ;   a/  [	        U 4S jT S    5       5      (       a  [        [        SS5      eg g )N)r&   r,   r'   r(   c              3   B   >#    U  H  nUTR                   ;  v   M     g 7fN)_LEGAL_HASHES).0hash_selfs     J/home/james-whalen/.local/lib/python3.13/site-packages/stix2/v21/common.py	<genexpr>>ExternalReference._check_object_constraints.<locals>.<genexpr>-   s#      +E T///+s   z9Hash algorithm names must be members of hash-algorithm-ov)superr!   _check_object_constraints_check_at_least_one_propertyanyr	   r;   	__class__s   `r<   r@   +ExternalReference._check_object_constraints(   sg    @B))*OPt !(^   (%xO 	      )__name__
__module____qualname____firstlineno____doc__r   r   r   r   _propertiesr8   r@   __static_attributes____classcell__rD   s   @r<   r!   r!      sh     	56	()	 !	>"3%HI	() KM
 rF   r!   c                   D    \ rS rSrSr\" S\" SS94S\" SS94/5      rSrg)	KillChainPhase7   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_i4tjv75ce50h>`__.
kill_chain_nameTr$   
phase_namerG   N)	rH   rI   rJ   rK   rL   r   r   rM   rN   rG   rF   r<   rR   rR   7   s2     	ND9:	~t45 KrF   rR   c            
       l   ^  \ rS rSrSr\" S\" 5       4S\" SSS94S\" \	S	S
94/5      r
U 4S jrSrU =r$ )GranularMarkingB   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_robezi5egfdr>`__.
langmarking_refmarking-definitionr)   valid_typesr+   	selectorsTr$   c                 P   > [         [        U ]  5         U R                  SS/5        g )NrY   rZ   )r?   rW   r@   rA   rC   s    r<   r@   )GranularMarking._check_object_constraintsM   s#    ot>@))6=*ABrF   rG   )rH   rI   rJ   rK   rL   r   r   r   r   r   rM   r@   rN   rO   rP   s   @r<   rW   rW   B   sR     	!"	)6JY^_`	l#3dCD KC CrF   rW   c                   F   \ rS rSrSrSr\" S\" \SS94S\" SS94S	\	" \SS94S
\
" SSS94S\" S SSS94S\" S SSS94S\
" / SQSSS94S\" SS94S\" SSS94S\" S S94S\" \5      4S \" 5       4S!\" \5      4S"\" \
" S#SS95      4S$\" \5      4S%\" SS94/5      rS&rg')(LanguageContentR   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_z9r1cwtu8jja>`__.
zlanguage-contenttyper)   r*   r+   fixedidcreated_by_refidentityr\   createdc                      [         $ r7   r   rG   rF   r<   <lambda>LanguageContent.<lambda>]       crF   millisecondmindefault	precisionprecision_constraintmodifiedc                      [         $ r7   rl   rG   rF   r<   rm   rn   ^       srF   
object_ref)SCOSDOSROTr]   r+   r%   object_modified)rt   contents)r+   r%   revokedc                      gNFrG   rG   rF   r<   rm   rn   d       ErF   rs   labels
confidenceexternal_referencesobject_marking_refsr[   granular_markings
extensionsrG   N)rH   rI   rJ   rK   rL   _typer   r   r   r   r   r   r   r   r   r   r!   rW   r   rM   rN   rG   rF   r<   rb   rb   R   s    E	e%89	e45	z%e45	,RWXY	%k]inop	&{mjopq	(5JY^imno	-FG	'UTJK	OM:;	</0	()	-> ?@	->K_ns-t uv	l?;<	)u=>% KrF   rb   c                   Z   \ rS rSrSrSr\" S\" \SS94S\" SS94S	\	" \SS94S
\
" SSSS94S\" S SSS94S\" S SSS94S\" SS94S\" 5       4S\" SS94S\" SS94S\" \" \S9SS94S\" \5      4S\" S S94S \" \5      4S!\" \5      4S"\" \
" S#SS$95      4S%\" \5      4/5      rS&rg')(ExtensionDefinitionn   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_32j232tfvtly>`__.
zextension-definitionrd   r)   r*   r+   re   rg   rh   ri   Tr}   rj   c                      [         $ r7   rl   rG   rF   r<   rm   ExtensionDefinition.<lambda>y   ro   rF   rp   rq   rr   rv   c                      [         $ r7   rl   rG   rF   r<   rm   r   z   rx   rF   namer$   r&   schemaversionextension_types)allowedextension_propertiesr   c                      gr   rG   rG   rF   r<   rm   r      r   rF   r   r   r   r   r[   r\   r   rG   N)rH   rI   rJ   rK   rL   r   r   r   r   r   r   r   r   r   r   r   r!   rW   rM   rN   rG   rF   r<   r   r   n   s,    #E	e%89	e45	z%e45	,RWbfgh	%k]inop	&{mjopq	./	()	>401	ND12|*  	
 
 n!=>	OM:;	</0	-> ?@	->K_ns-t uv	l?;</ KrF   r   Nc                    ^ ^ UU 4S jnU$ )z,Custom STIX Object Extension decorator.
    c                 *   > [        U TTS[        5      $ Nr)   )r   r   cls
propertiesrd   s    r<   wrapper CustomExtension.<locals>.wrapper   s    (dJzRRrF   rG   rd   r   r   s   `` r<   CustomExtensionr      s    S NrF   c                   :    \ rS rSrSrSr\" S\" SS94/5      rSr	g)
TLPMarking   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_yd3ar14ekwrs>`__.
tlpTr$   rG   N)
rH   rI   rJ   rK   rL   r   r   r   rM   rN   rG   rF   r<   r   r      s*     E	-. KrF   r   c                   R   ^  \ rS rSrSrSr\" S\" SS94/5      rSU 4S jjr	Sr
U =r$ )	StatementMarking   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_3ru8r05saera>`__.
	statementTr$   c                 p   > U(       a  UR                  S5      (       d  XS'   [        [        U ]  " S0 UD6  g )Nr   rG   )getr?   r   __init__)r;   r   kwargsrD   s      r<   r   StatementMarking.__init__   s/    VZZ44"+;.88rF   rG   r7   )rH   rI   rJ   rK   rL   r   r   r   rM   r   rN   rO   rP   s   @r<   r   r      s5     E	nd34 K9 9rF   r   c                   "    \ rS rSrSrSS jrSrg)MarkingProperty   z\Represent the marking objects in the ``definition`` property of
marking-definition objects.
c                 b    [        U5      [        R                  5       ;   a  US4$ [        S5      e)NFz9must be a Statement, TLP Marking or a registered marking.)rd   OBJ_MAP_MARKINGvalues
ValueError)r;   valueallow_customs      r<   cleanMarkingProperty.clean   s-    ;/0022%<XYYrF   rG   N)F)rH   rI   rJ   rK   rL   r   rN   rG   rF   r<   r   r      s    ZrF   r   c                   ,  ^  \ rS rSrSrSr\" S\" \SS94S\" SS94S	\	" \SS94S
\
" SSS94S\" S SSS94S\" 5       4S\" 5       4S\" 5       4S\" \5      4S\" \
" SSS95      4S\" \5      4S\" SS94/5      rU 4S jrU 4S jrSU 4S jjrSrU =r$ )MarkingDefinition   zFor more detailed information on this object's properties, see
`the STIX 2.1 specification <https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_k5fndj2c7c1k>`__.
r[   rd   r)   r*   r+   re   rg   rh   ri   r\   rj   c                      [         $ r7   rl   rG   rF   r<   rm   MarkingDefinition.<lambda>   ro   rF   rp   rq   rr   definition_typer   
definitionr   r   r   r   c                    > SS1R                  UR                  5       5      (       a:   [        US      n[        US   U5      (       d  [        US   5      nU" S0 UD6US'   [        [        U ]&  " S0 UD6  g ! [         a    [	        S5      ef = f)Nr   r   z,definition_type must be a valid marking typerG   )
issubsetkeysr   KeyErrorr   
isinstancer   r?   r   r   )r;   r   marking_typedefnrD   s       r<   r   MarkingDefinition.__init__   s    |,55fkkmDDQ.v6G/HI f\2LAA !56'3';d';|$/9&9  Q !OPPQs   A7 7Bc                    > [         [        U ]  5         U R                  S5      nU R                  S5      nU R                  S5      nU(       a  U(       d  U(       d  [	        S[        5      e[        U S5        g )Nr   r   r   ztMarkingDefinition objects must have the properties 'definition_type' and 'definition' if 'extensions' is not presentr)   )r?   r   r@   r   r
   r   )r;   r   r   r   rD   s       r<   r@   +MarkingDefinition._check_object_constraints   se    @BXXl+
((#45XXl+
J
'T!  	$&rF   c                 F   > [        U S5        [        [        U ]  " X40 UD6$ r   )r   r?   r   	serialize)r;   prettyinclude_optional_defaultsr   rD   s       r<   r   MarkingDefinition.serialize   s&    $&&7d]cddrF   rG   )FF)rH   rI   rJ   rK   rL   r   r   r   r   r   r   r   r   r   r!   rW   r   rM   r   r@   r   rN   rO   rP   s   @r<   r   r      s     !E	e%89	e45	z%e45	,RWXY	%k]inop	N,-	!"	()	-> ?@	->K_ns-t uv	l?;<	)u=> K:' e erF   r   )r   r   c                    ^ ^ UU 4S jnU$ )at  Custom STIX Marking decorator.

Example:
    >>> from stix2.v21 import CustomMarking
    >>> from stix2.properties import IntegerProperty, StringProperty
    >>> @CustomMarking('x-custom-marking', [
    ...     ('property1', StringProperty(required=True)),
    ...     ('property2', IntegerProperty()),
    ... ])
    ... class MyNewMarkingObjectType():
    ...     pass

c                 *   > [        U TTS[        5      $ r   )r   r   r   s    r<   r   CustomMarking.<locals>.wrapper  s    &sD*e[QQrF   rG   r   s   `` r<   CustomMarkingr      s    RNrF   z8marking-definition--613f2e26-407d-48c7-9eca-b8e91df99dc9z2017-01-20T00:00:00.000Zr   z	TLP:WHITEwhite)r   )rg   rj   r   r   r   z8marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41daz	TLP:GREENgreenz8marking-definition--f88d31f6-486f-44da-b317-01333bde0b82z	TLP:AMBERamberz8marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5edzTLP:REDred)zx-custom-extN)zx-custom-markingN)6rL   collectionsr    r   customr   r   
exceptionsr	   r
   markingsr   markings.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   utilsr   r   baser   vocabr   r   r!   rR   rW   rb   r   r   r   r   r   r   r   r   	TLP_WHITE	TLP_GREEN	TLP_AMBERTLP_REDrG   rF   r<   <module>r      sI   0 #  G A % .    #  4 D[ Ck C k 8+ B 9{ 9$	Zh 	Z5e^ 5er !* A&	g&	 A&	g&	 A&	g&	 A&	e$rF   