INNER CODE UNIT · Python

stix_representation

mitre-attack/attack-stix-data · util/generate-collection-index.py:9

def stix_representation(timestamp):
    """Returns a string containing a STIX compatible representation of the input timestamp

    :param datetime timestamp:
    """
    return timestamp.isoformat(timespec='milliseconds')[:-6] + "Z"


def generate_collection_index(name, description, root_url, collection_index_id, folders):
    """Generates a collection index from the input data and returns the index as a dictionary

    :param str name: The name of the collection index
    :param str description: The description of the collection index
    :param str root_url: The root URL where the collections can be found; collection file paths will be appended to this to create the collection URL
    :param str collection_index_id: the id to assign to the collection index
    :param list of str folders: List of folders containing the collection JSON files to include in the index; cannot be used with files argument; will only match collections that end with a version number
    """
    version_regex = re.compile("(\w+-)+(\d\.?)+(-beta)?.json")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…