openc2lib.types.targets.uri
1import rfc3987 2 3from openc2lib.core.target import target 4 5@target('uri') 6class URI: 7 """ OpenC2 URI 8 9 Implements the `uri` target (Section 3.4.1.17). 10 A uniform resource identifier (URI) - RFC 3986. 11 """ 12 13 def __init__(self, uri): 14 self.set(uri) 15 16 def set(self, uri): 17 """ Value must be an Uniform Resource Identifier (URI) as defined in [RFC3986] """ 18 if rfc3987.parse(uri, rule="URI_reference") is not None: 19 self.__uri = str(uri) 20 else: 21 raise ValueError("Invalid URI -- not compliant to RFC 3986") 22 23 def get(self): 24 """ Returns the uri as string """ 25 return self.__uri 26 27 def __str__(self): 28 return self.__uri
@target('uri')
class
URI:
6@target('uri') 7class URI: 8 """ OpenC2 URI 9 10 Implements the `uri` target (Section 3.4.1.17). 11 A uniform resource identifier (URI) - RFC 3986. 12 """ 13 14 def __init__(self, uri): 15 self.set(uri) 16 17 def set(self, uri): 18 """ Value must be an Uniform Resource Identifier (URI) as defined in [RFC3986] """ 19 if rfc3987.parse(uri, rule="URI_reference") is not None: 20 self.__uri = str(uri) 21 else: 22 raise ValueError("Invalid URI -- not compliant to RFC 3986") 23 24 def get(self): 25 """ Returns the uri as string """ 26 return self.__uri 27 28 def __str__(self): 29 return self.__uri
OpenC2 URI
Implements the uri target (Section 3.4.1.17).
A uniform resource identifier (URI) - RFC 3986.
def
set(self, uri):
17 def set(self, uri): 18 """ Value must be an Uniform Resource Identifier (URI) as defined in [RFC3986] """ 19 if rfc3987.parse(uri, rule="URI_reference") is not None: 20 self.__uri = str(uri) 21 else: 22 raise ValueError("Invalid URI -- not compliant to RFC 3986")
Value must be an Uniform Resource Identifier (URI) as defined in [RFC3986]