Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Official low-level client for Intel 471's Titan API. It aims at providing common
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.20.0
- Package version: 1.20.0.12
- Package version: 1.20.0.13
- Build package: org.openapitools.codegen.languages.PythonLegacyClientCodegen

## Requirements.
Expand Down
2 changes: 1 addition & 1 deletion docs/FullReportSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Name | Type | Description | Notes
**uid** | **str** | Unique report identifier. |
**victims** | [**list[SimpleReportSchemaVictimsInner]**](SimpleReportSchemaVictimsInner.md) | Purported victims list. | [optional]
**executive_summary** | **str** | Executive summary in HTML format. | [optional]
**raw_text** | **str** | Raw text in HTML format. |
**raw_text** | **str** | Raw text in HTML format. | [optional]
**raw_text_translated** | **str** | Translated text in HTML format. | [optional]
**researcher_comments** | **str** | Researcher's comments in HTML format. | [optional]

Expand Down
2 changes: 1 addition & 1 deletion docs/FullReportSchemaAllOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**executive_summary** | **str** | Executive summary in HTML format. | [optional]
**raw_text** | **str** | Raw text in HTML format. |
**raw_text** | **str** | Raw text in HTML format. | [optional]
**raw_text_translated** | **str** | Translated text in HTML format. | [optional]
**researcher_comments** | **str** | Researcher's comments in HTML format. | [optional]

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

Official low-level client for Intel 471's Titan API. It aims at providing common ground for all the endpoints in Python.

The version of the OpenAPI document: 1.20.0.12
The version of the OpenAPI document: 1.20.0.13
Generated by: https://openapi-generator.tech
"""

from pkg_resources import parse_requirements
from setuptools import setup, find_packages # noqa: H301

NAME = "Titan Client"
VERSION = "1.20.0.12"
VERSION = "1.20.0.13"
# To install the library, run the following
#
# python setup.py install
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/report_inforep_stix.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"marking-definition--f88d31f6-486f-44da-b317-01333bde0b82"
],
"content": "<h1>Source Characterization</h1>\nLorem ipsum",
"x_intel471_com_uid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"x_intel471_com_uid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"x_opencti_reliability": "C - Fairly reliable"
}
]
}
2 changes: 1 addition & 1 deletion titan_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from __future__ import absolute_import

__version__ = "1.20.0.12"
__version__ = "1.20.0.13"

# import apis into sdk package
from titan_client.api.actors_api import ActorsApi
Expand Down
2 changes: 1 addition & 1 deletion titan_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/1.20.0.12/python'
self.user_agent = 'OpenAPI-Generator/1.20.0.13/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion titan_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.20.0\n"\
"SDK Package Version: 10".\
"SDK Package Version: 1.20.0.13".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
5 changes: 2 additions & 3 deletions titan_client/models/full_report_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def __init__(self, actor_handle=None, actor_subject_of_report=None, admiralty_co
self.victims = victims
if executive_summary is not None:
self.executive_summary = executive_summary
self.raw_text = raw_text
if raw_text is not None:
self.raw_text = raw_text
if raw_text_translated is not None:
self.raw_text_translated = raw_text_translated
if researcher_comments is not None:
Expand Down Expand Up @@ -762,8 +763,6 @@ def raw_text(self, raw_text):
:param raw_text: The raw_text of this FullReportSchema. # noqa: E501
:type raw_text: str
"""
if self.local_vars_configuration.client_side_validation and raw_text is None: # noqa: E501
raise ValueError("Invalid value for `raw_text`, must not be `None`") # noqa: E501

self._raw_text = raw_text

Expand Down
5 changes: 2 additions & 3 deletions titan_client/models/full_report_schema_all_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def __init__(self, executive_summary=None, raw_text=None, raw_text_translated=No

if executive_summary is not None:
self.executive_summary = executive_summary
self.raw_text = raw_text
if raw_text is not None:
self.raw_text = raw_text
if raw_text_translated is not None:
self.raw_text_translated = raw_text_translated
if researcher_comments is not None:
Expand Down Expand Up @@ -114,8 +115,6 @@ def raw_text(self, raw_text):
:param raw_text: The raw_text of this FullReportSchemaAllOf. # noqa: E501
:type raw_text: str
"""
if self.local_vars_configuration.client_side_validation and raw_text is None: # noqa: E501
raise ValueError("Invalid value for `raw_text`, must not be `None`") # noqa: E501

self._raw_text = raw_text

Expand Down
1 change: 1 addition & 0 deletions titan_client/titan_stix/mappers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def map_confidence(self, confidence: Union[str, None]):
def map_tactic(self, tactic: str):
if tactic and len(tactic) > 0:
return tactic.replace("_", "-").replace(" ", "-").lower()
return None

@staticmethod
def shorten(text: str, limit: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion titan_client/titan_stix/mappers/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def map(self, type: str, value: str, *args, **kwargs): # noqa need `type` here
value = value_extractor(value)
try:
return mapper_config.mapper(value, type=type, *args, **kwargs)
except InvalidValueError as e:
except (InvalidValueError, ValueError) as e:
log.info(f"Skipping entity. {e}")
return
log.info(f"Skipping entity. No suitable mapper. type=`{type}` value=`{value}`")
16 changes: 16 additions & 0 deletions titan_client/titan_stix/mappers/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def _map_report(self, source: dict, object_refs: StixObjects = None) -> StixObje
"content": self._get_opencti_content(source)
}
}
if report_type == ReportType.INFOREP:
if source_reliability := self._map_source_reliability(source.get("admiraltyCode")):
report_kwargs["custom_properties"]["x_opencti_reliability"] = source_reliability
report = Report(**report_kwargs)
stix_objects.add(report)
return stix_objects
Expand Down Expand Up @@ -390,3 +393,16 @@ def _get_opencti_content(self, source: dict):
content_bits.append(f"<h1>{heading}</h1>")
content_bits.append(value)
return "\n".join(content_bits)

def _map_source_reliability(self, admiralty_code: Union[str, None]):
if admiralty_code and len(admiralty_code) > 0:
reliability_code = admiralty_code[0].upper()
return {
"A": "A - Completely reliable",
"B": "B - Usually reliable",
"C": "C - Fairly reliable",
"D": "D - Not usually reliable",
"E": "E - Unreliable",
"F": "F - Reliability cannot be judged"
}.get(reliability_code)
return None