docstring stringlengths 52 499 | function stringlengths 67 35.2k | __index_level_0__ int64 52.6k 1.16M |
|---|---|---|
Write cache data to the data store.
Args:
rid (str): The record identifier.
data (dict): The record data.
raise_on_error (bool): If True and not r.ok this method will raise a RunTimeError.
Returns:
object : Python request response. | def add(self, rid, data, raise_on_error=True):
cache_data = {'cache-date': self._dt_to_epoch(datetime.now()), 'cache-data': data}
return self.ds.post(rid, cache_data, raise_on_error) | 542,197 |
Write cache data to the data store.
Args:
rid (str): The record identifier.
raise_on_error (bool): If True and not r.ok this method will raise a RunTimeError.
Returns:
object : Python request response. | def delete(self, rid, raise_on_error=True):
return self.ds.delete(rid, raise_on_error) | 542,198 |
Get cached data from the data store.
Args:
rid (str): The record identifier.
data_callback (callable): A method that will return the data.
raise_on_error (bool): If True and not r.ok this method will raise a RunTimeError.
Returns:
object : Python request... | def get(self, rid, data_callback=None, raise_on_error=True):
cached_data = None
ds_data = self.ds.get(rid, raise_on_error=False)
if ds_data is not None:
expired = True
if ds_data.get('found') is True:
if self.ttl < int(ds_data.get('_source', {}).g... | 542,199 |
Write updated cache data to the DataStore.
Args:
rid (str): The record identifier.
data (dict): The record data.
raise_on_error (bool): If True and not r.ok this method will raise a RunTimeError.
Returns:
object : Python request response. | def update(self, rid, data, raise_on_error=True):
cache_data = {'cache-date': self._dt_to_epoch(datetime.now()), 'cache-data': data}
return self.ds.put(rid, cache_data, raise_on_error) | 542,200 |
Application exit method with proper exit code
The method will run the Python standard sys.exit() with the exit code
previously defined via :py:meth:`~tcex.tcex.TcEx.exit_code` or provided
during the call of this method.
Args:
code (Optional [integer]): The exit code value f... | def exit(self, code=None, msg=None):
# add exit message to message.tc file and log
if msg is not None:
if code in [0, 3] or (code is None and self.exit_code in [0, 3]):
self.log.info(msg)
else:
self.log.error(msg)
self.message_... | 542,221 |
Set the App exit code.
For TC Exchange Apps there are 3 supported exit codes.
* 0 indicates a normal exit
* 1 indicates a failure during execution
* 3 indicates a partial failure
Args:
code (integer): The exit code value for the app. | def exit_code(self, code):
if code is not None and code in [0, 1, 3]:
self._exit_code = code
else:
self.log.warning(u'Invalid exit code') | 542,222 |
Process indicators expanding file hashes/custom indicators into multiple entries.
Args:
indicator (string): " : " delimited string
Returns:
(list): a list of indicators split on " : ". | def expand_indicators(indicator):
if indicator.count(' : ') > 0:
# handle all multi-valued indicators types (file hashes and custom indicators)
indicator_list = []
# group 1 - lazy capture everything to first <space>:<space> or end of line
iregx_pattern ... | 542,223 |
Raise RuntimeError
Args:
code (integer): The error code from API or SDK.
message (string): The error message from API or SDK. | def handle_error(self, code, message_values=None, raise_error=True):
try:
if message_values is None:
message_values = []
message = self.error_codes.message(code).format(*message_values)
self.log.error('Error code: {}, {}'.format(code, message))
... | 542,224 |
Returns the object type as a string given a api entity.
Args:
api_entity:
Returns: | def get_type_from_api_entity(self, api_entity):
merged = self.group_types_data.copy()
merged.update(self.indicator_types_data)
print(merged)
for (key, value) in merged.items():
if value.get('apiEntity') == api_entity:
return key
return None | 542,225 |
Write data to message_tc file in TcEX specified directory.
This method is used to set and exit message in the ThreatConnect Platform.
ThreatConnect only supports files of max_message_length. Any data exceeding
this limit will be truncated by this method.
Args:
message (str... | def message_tc(self, message, max_length=255):
if os.access(self.default_args.tc_out_path, os.W_OK):
message_file = '{}/message.tc'.format(self.default_args.tc_out_path)
else:
message_file = 'message.tc'
message = '{}\n'.format(message)
if max_length - l... | 542,229 |
Get instance of Resource Class with dynamic type.
Args:
resource_type: The resource type name (e.g Adversary, User Agent, etc).
Returns:
(object): Instance of Resource Object child class. | def resource(self, resource_type):
try:
resource = getattr(self.resources, self.safe_rt(resource_type))(self)
except AttributeError:
self._resources(True)
resource = getattr(self.resources, self.safe_rt(resource_type))(self)
return resource | 542,233 |
Write data to results_tc file in TcEX specified directory.
The TcEx platform support persistent values between executions of the App. This
method will store the values for TC to read and put into the Database.
Args:
key (string): The data key to be stored.
value (strin... | def results_tc(self, key, value):
if os.access(self.default_args.tc_out_path, os.W_OK):
results_file = '{}/results.tc'.format(self.default_args.tc_out_path)
else:
results_file = 'results.tc'
new = True
open(results_file, 'a').close() # ensure file exist... | 542,234 |
Decode value using correct Python 2/3 method.
This method is intended to replace the :py:meth:`~tcex.tcex.TcEx.to_string` method with
better logic to handle poorly encoded unicode data in Python2 and still work in Python3.
Args:
data (any): Data to ve validated and (de)encoded
... | def s(self, data, errors='strict'):
try:
if data is None or isinstance(data, (int, list, dict)):
pass # Do nothing with these types
elif isinstance(data, unicode):
try:
data.decode('utf-8')
except UnicodeEncode... | 542,235 |
Indicator encode value for safe HTTP request.
Args:
indicator (string): Indicator to URL Encode
errors (string): The error handler type.
Returns:
(string): The urlencoded string | def safe_indicator(self, indicator, errors='strict'):
if indicator is not None:
try:
indicator = quote(self.s(str(indicator), errors=errors), safe='~')
except KeyError:
indicator = quote(bytes(indicator), safe='~')
return indicator | 542,236 |
Format the Resource Type.
Takes Custom Indicator types with a space character and return a *safe* string.
(e.g. *User Agent* is converted to User_Agent or user_agent.)
Args:
resource_type (string): The resource type to format.
lower (boolean): Return type in all lower ca... | def safe_rt(resource_type, lower=False):
if resource_type is not None:
resource_type = resource_type.replace(' ', '_')
if lower:
resource_type = resource_type.lower()
return resource_type | 542,237 |
Truncate group name to match limit breaking on space and optionally add an ellipsis.
.. note:: Currently the ThreatConnect group name limit is 100 characters.
Args:
group_name (string): The raw group name to be truncated.
group_max_length (int): The max length of the group name.
... | def safe_group_name(group_name, group_max_length=100, ellipsis=True):
ellipsis_value = ''
if ellipsis:
ellipsis_value = ' ...'
if group_name is not None and len(group_name) > group_max_length:
# split name by spaces and reset group_name
group_name_ar... | 542,238 |
URL Encode and truncate tag to match limit (128 characters) of ThreatConnect API.
Args:
tag (string): The tag to be truncated
Returns:
(string): The truncated tag | def safe_tag(self, tag, errors='strict'):
if tag is not None:
try:
# handle unicode characters and url encode tag value
tag = quote(self.s(tag, errors=errors), safe='~')[:128]
except KeyError as e:
warn = 'Failed converting tag to ... | 542,239 |
URL encode value for safe HTTP request.
Args:
url (string): The string to URL Encode.
Returns:
(string): The urlencoded string. | def safe_url(self, url, errors='strict'):
if url is not None:
url = quote(self.s(url, errors=errors), safe='~')
return url | 542,240 |
Sets the task due_date
Args:
due_date: Converted to %Y-%m-%dT%H:%M:%SZ date format | def due_date(self, due_date):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
due_date = self._utils.format_datetime(due_date, date_format='%Y-%m-%dT%H:%M:%SZ')
self._data['dueDate'] = due_date
request = {'dueDate': due_date}
return self.... | 542,246 |
Sets the task reminder_date
Args:
reminder_date: Converted to %Y-%m-%dT%H:%M:%SZ date format | def reminder_date(self, reminder_date):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
reminder_date = self._utils.format_datetime(reminder_date, date_format='%Y-%m-%dT%H:%M:%SZ')
self._data['reminderDate'] = reminder_date
request = {'reminderDa... | 542,247 |
Sets the task escalation_date
Args:
escalation_date: Converted to %Y-%m-%dT%H:%M:%SZ date format | def escalation_date(self, escalation_date):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
escalation_date = self._utils.format_datetime(
escalation_date, date_format='%Y-%m-%dT%H:%M:%SZ'
)
self._data['escalationDate'] = escalation_d... | 542,248 |
Adds a assignee to the task
Args:
assignee_id: The id of the assignee to be added
action: | def assignee(self, assignee_id, action='ADD'):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
return self.tc_requests.assignee(
self.api_type, self.api_sub_type, self.unique_id, assignee_id, action=action
) | 542,250 |
Adds a assignee to the task
Args:
escalatee_id: The id of the escalatee to be added
action: | def escalatee(self, escalatee_id, action='ADD'):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
return self.tc_requests.escalatee(
self.api_type, self.api_sub_type, self.unique_id, escalatee_id, action=action
) | 542,252 |
Create key/value pair in remote KV store.
Args:
key (string): The key to create in remote KV store.
value (any): The value to store in remote KV store.
Returns:
(string): The response from the API call. | def create(self, key, value):
key = quote(key, safe='~')
headers = {'content-type': 'application/octet-stream'}
url = '/internal/playbooks/keyValue/{}'.format(key)
r = self.tcex.session.put(url, data=value, headers=headers)
return r.content | 542,255 |
Read data from remote KV store for the provided key.
Args:
key (string): The key to read in remote KV store.
Returns:
(any): The response data from the remote KV store. | def read(self, key):
key = quote(key, safe='~')
url = '/internal/playbooks/keyValue/{}'.format(key)
r = self.tcex.session.get(url)
data = r.content
if data is not None and not isinstance(data, str):
data = str(r.content, 'utf-8')
return data | 542,256 |
Initialize the Class properties.
Args:
name (str): The name for the metric.
description (str): The description of the metric.
data_type (str): The type of metric: Sum, Count, Min, Max, First, Last, and Average.
interval (str): The metric interval: Hourly, Daily, ... | def __init__(self, tcex, name, description, data_type, interval, keyed=False):
self.tcex = tcex
self._metric_data_type = data_type
self._metric_description = description
self._metric_id = None
self._metric_interval = interval
self._metric_keyed = keyed
se... | 542,259 |
Add metrics data to collection.
Args:
value (str): The value of the metric.
date (str, optional): The optional date of the metric.
return_value (bool, default:False): Tell the API to return the updates metric value.
key (str, optional): The key value for keyed me... | def add(self, value, date=None, return_value=False, key=None):
data = {}
if self._metric_id is None:
self.tcex.handle_error(715, [self._metric_name])
body = {'value': value}
if date is not None:
body['date'] = self.tcex.utils.format_datetime(date, date_f... | 542,262 |
Add keyed metrics data to collection.
Args:
value (str): The value of the metric.
key (str): The key value for keyed metrics.
date (str, optional): The optional date of the metric.
return_value (bool, default:False): Tell the API to return the updates metric valu... | def add_keyed(self, value, key, date=None, return_value=False):
return self.add(value, date, return_value, key) | 542,263 |
Initialize the Class properties.
Args:
host (string): The Redis host.
port (string): The Redis port.
rhash (string): The rhash value. | def __init__(self, host, port, rhash):
self.hash = rhash
self.r = redis.StrictRedis(host=host, port=port) | 542,264 |
Read data from Redis for the provided key.
Args:
key (string): The key to read in Redis.
Returns:
(any): The response data from Redis. | def hget(self, key):
data = self.r.hget(self.hash, key)
if data is not None and not isinstance(data, str):
data = str(self.r.hget(self.hash, key), 'utf-8')
return data | 542,265 |
Create key/value pair in Redis.
Args:
key (string): The key to create in Redis.
value (any): The value to store in Redis.
Returns:
(string): The response from Redis. | def hset(self, key, value):
return self.r.hset(self.hash, key, value) | 542,266 |
Initialize Class Properties.
Args:
tcex (tcex.TcEx): Instance of TcEx class. | def __init__(self, tcex):
self.tcex = tcex
self._config_data = {}
self._default_args = None
self._default_args_resolved = None
self._parsed = False
self._parsed_resolved = False
self.parser = TcExArgParser() | 542,267 |
Log argparser unknown arguments.
Args:
args (list): List of unknown arguments | def _unknown_args(self, args):
for u in args:
self.tcex.log.warning(u'Unsupported arg found ({}).'.format(u)) | 542,270 |
Load configuration data from provided file and inject values into sys.argv.
Args:
config (str): The configuration file name. | def config_file(self, filename):
if os.path.isfile(filename):
with open(filename, 'r') as fh:
self._config_data = json.load(fh)
else:
self.tcex.log.error('Could not load configuration file "{}".'.format(filename)) | 542,273 |
Inject params into sys.argv from secureParams API, AOT, or user provided.
Args:
params (dict): A dictionary containing all parameters that need to be injected as args. | def inject_params(self, params):
for arg, value in params.items():
cli_arg = '--{}'.format(arg)
if cli_arg in sys.argv:
# arg already passed on the command line
self.tcex.log.debug('skipping existing arg: {}'.format(cli_arg))
cont... | 542,275 |
Initialize Class Properties.
Args:
tcex: | def __init__(self, tcex):
self._tcex = tcex
self._data = {}
self._type = 'Owner'
self._api_type = 'owners'
self._api_entity = 'owner'
self._utils = TcExUtils()
self._tc_requests = TiTcRequest(self._tcex) | 542,279 |
Initialize Class properties.
Args:
_args (namespace): The argparser args Namespace. | def __init__(self, _args):
super(TcExProfile, self).__init__(_args)
# properties
self._input_permutations = []
self._output_permutations = []
self.data_dir = os.path.join(self.args.outdir, 'data')
self.profile_dir = os.path.join(self.args.outdir, 'profiles')
... | 542,285 |
Expand supported playbook variables to their full list.
Args:
valid_values (list): The list of valid values for Choice or MultiChoice inputs.
Returns:
List: An expanded list of valid values for Choice or MultiChoice inputs. | def expand_valid_values(valid_values):
if '${GROUP_TYPES}' in valid_values:
valid_values.remove('${GROUP_TYPES}')
valid_values.extend(
[
'Adversary',
'Campaign',
'Document',
'Email',... | 542,288 |
Iterate recursively over layout.json parameter names.
TODO: Add indicator values.
Args:
index (int, optional): The current index position in the layout names list.
args (list, optional): Defaults to None. The current list of args. | def gen_permutations(self, index=0, args=None):
if args is None:
args = []
try:
name = self.layout_json_names[index]
display = self.layout_json_params.get(name, {}).get('display')
input_type = self.install_json_params().get(name, {}).get('type')
... | 542,289 |
Load profiles from file.
Args:
fqfn (str): Fully qualified file name. | def load_profiles_from_file(self, fqfn):
if self.args.verbose:
print('Loading profiles from File: {}{}{}'.format(c.Style.BRIGHT, c.Fore.MAGENTA, fqfn))
with open(fqfn, 'r+') as fh:
data = json.load(fh)
for profile in data:
# force update old p... | 542,291 |
Load included configuration files.
Args:
include_directory (str): The path of the profile include directory. | def load_profile_include(self, include_directory):
include_directory = os.path.join(self.app_path, include_directory)
if not os.path.isdir(include_directory):
msg = 'Provided include directory does not exist ({}).'.format(include_directory)
sys.exit(msg)
for fi... | 542,292 |
Return args based on install.json or layout.json params.
Args:
ij (dict): The install.json contents.
required (bool): If True only required args will be returned.
Returns:
dict: Dictionary of required or optional App args. | def profile_settings_args(self, ij, required):
if self.args.permutation_id is not None:
if 'sqlite3' not in sys.modules:
print('The sqlite3 module needs to be build-in to Python for this feature.')
sys.exit(1)
profile_args = self.profile_settings_... | 542,297 |
Return args based on install.json params.
Args:
ij (dict): The install.json contents.
required (bool): If True only required args will be returned.
Returns:
dict: Dictionary of required or optional App args. | def profile_settings_args_install_json(self, ij, required):
profile_args = {}
# add App specific args
for p in ij.get('params') or []:
# TODO: fix this required logic
if p.get('required', False) != required and required is not None:
continue
... | 542,298 |
Return args based on layout.json and conditional rendering.
Args:
required (bool): If True only required args will be returned.
Returns:
dict: Dictionary of required or optional App args. | def profile_settings_args_layout_json(self, required):
profile_args = {}
self.db_create_table(self.input_table, self.install_json_params().keys())
self.db_insert_record(self.input_table, self.install_json_params().keys())
self.gen_permutations()
try:
for pn ... | 542,299 |
Build the default args for this profile.
Args:
ij (dict): The install.json contents.
Returns:
dict: The default args for a Job or Playbook App. | def profile_setting_default_args(ij):
# build default args
profile_default_args = OrderedDict()
profile_default_args['api_default_org'] = '$env.API_DEFAULT_ORG'
profile_default_args['api_access_id'] = '$env.API_ACCESS_ID'
profile_default_args['api_secret_key'] = '$envs.... | 542,300 |
Update an existing profile with new parameters or remove deprecated parameters.
Args:
profile (dict): The dictionary containting the profile settings. | def profile_update(self, profile):
# warn about missing install_json parameter
if profile.get('install_json') is None:
print(
'{}{}Missing install_json parameter for profile {}.'.format(
c.Style.BRIGHT, c.Fore.YELLOW, profile.get('profile_name')
... | 542,302 |
Update profile to latest schema.
Args:
profile (dict): The dictionary containting the profile settings. | def profile_update_schema(profile):
# add new "autoclear" field
if profile.get('autoclear') is None:
print(
'{}{}Profile Update: Adding new "autoclear" parameter.'.format(
c.Style.BRIGHT, c.Fore.YELLOW
)
)
... | 542,305 |
Write the profile to the output directory.
Args:
profile (dict): The dictionary containting the profile settings.
outfile (str, optional): Defaults to None. The filename for the profile. | def profile_write(self, profile, outfile=None):
# fully qualified output file
if outfile is None:
outfile = '{}.json'.format(profile.get('profile_name').replace(' ', '_').lower())
fqpn = os.path.join(self.profile_dir, outfile)
if os.path.isfile(fqpn):
#... | 542,306 |
Check to see if any args are "missing" from profile.
Validate all args from install.json are in the profile. This can be helpful to validate
that any new args added to App are included in the profiles.
.. Note:: This method does not work with layout.json Apps.
Args:
profi... | def validate(self, profile):
ij = self.load_install_json(profile.get('install_json'))
print('{}{}Profile: "{}".'.format(c.Style.BRIGHT, c.Fore.BLUE, profile.get('profile_name')))
for arg in self.profile_settings_args_install_json(ij, None):
if profile.get('args', {}).get('a... | 542,308 |
Check to see if the display condition passes.
Args:
table (str): The name of the DB table which hold the App data.
display_condition (str): The "where" clause of the DB SQL statement.
Returns:
bool: True if the row count is greater than 0. | def validate_layout_display(self, table, display_condition):
display = False
if display_condition is None:
display = True
else:
display_query = 'select count(*) from {} where {}'.format(table, display_condition)
try:
cur = self.db_conn... | 542,309 |
Deletes the Indicator/Group/Victim or Security Label
Args:
main_type:
sub_type:
unique_id:
owner: | def delete(self, main_type, sub_type, unique_id, owner=None):
params = {'owner': owner} if owner else {}
if not sub_type:
url = '/v2/{}/{}'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}'.format(main_type, sub_type, unique_id)
return self.tcex.ses... | 542,313 |
Args:
main_type:
sub_type:
unique_id:
owner:
filters:
params:
Returns: | def single(self, main_type, sub_type, unique_id, owner=None, filters=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if filters and filters.filters:
params['filters'] = filters.filters_string
if not sub_type:
url =... | 542,315 |
Args:
main_type:
sub_type:
api_entity:
filters:
owner:
params:
Returns: | def many(self, main_type, sub_type, api_entity, owner=None, filters=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if filters and filters.filters:
params['filters'] = filters.filters_string
if not sub_type:
url = ... | 542,316 |
Args:
url:
params:
api_entity:
Return: | def _iterate(self, url, params, api_entity):
params['resultLimit'] = self.result_limit
should_iterate = True
result_start = 0
while should_iterate:
# params['resultOffset'] = result_offset
params['resultStart'] = result_start
r = self.tcex.ses... | 542,317 |
Args:
main_type:
sub_type:
result_limit:
result_start:
owner:
filters:
params:
Return: | def request(
self, main_type, sub_type, result_limit, result_start, owner=None, filters=None, params=None
):
params = params or {}
if owner:
params['owner'] = owner
if filters and filters.filters:
params['filters'] = filters.filters_string
pa... | 542,318 |
Args:
main_type:
sub_type:
unique_id:
owner:
params:
Return: | def observations(self, main_type, sub_type, unique_id, owner=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if not sub_type:
url = '/v2/{}/{}/observations'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/o... | 542,322 |
Args:
owner:
filters:
main_type:
sub_type:
deleted_since:
params:
Return: | def deleted(self, main_type, sub_type, deleted_since, owner=None, filters=None, params=None):
params = params or {}
if filters and filters.filters:
params['filters'] = filters.filters_string
if owner:
params['owner'] = owner
if deleted_since:
... | 542,325 |
Args:
filters:
target:
tag_name:
params:
Return: | def pivot_from_tag(self, target, tag_name, filters=None, params=None):
sub_type = target.api_sub_type
api_type = target.api_type
api_entity = target.api_entity
params = params or {}
if filters and filters.filters:
params['filters'] = filters.filters_string
... | 542,326 |
Args:
group:
tag_name:
filters:
params:
Return: | def groups_from_tag(self, group, tag_name, filters=None, params=None):
for t in self.pivot_from_tag(group, tag_name, filters=filters, params=params):
yield t | 542,327 |
Args:
indicator:
tag_name:
filters:
params:
Return: | def indicators_from_tag(self, indicator, tag_name, filters=None, params=None):
params = params or {}
for t in self.pivot_from_tag(indicator, tag_name, filters=filters, params=params):
yield t | 542,328 |
Args:
victim:
tag_name:
filters:
params:
Return: | def victims_from_tag(self, victim, tag_name, filters=None, params=None):
for t in self.pivot_from_tag(victim, tag_name, filters=filters, params=params):
yield t | 542,329 |
Args:
owner:
main_type:
sub_type:
unique_id:
params:
Return: | def group_associations(self, main_type, sub_type, unique_id, owner=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if not sub_type:
url = '/v2/{}/{}/groups'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/gr... | 542,330 |
Args:
owner:
main_type:
sub_type:
unique_id:
branch_type:
params:
Return: | def victim_asset_associations(
self, main_type, sub_type, unique_id, branch_type, owner=None, params=None
):
params = params or {}
if owner:
params['owner'] = owner
if not sub_type:
url = '/v2/{}/{}/victimAssets/{}'.format(main_type, unique_id, bran... | 542,331 |
Args:
owner:
main_type:
sub_type:
unique_id:
association_type:
api_branch:
api_entity:
params:
Return: | def indicator_associations_types(
self,
main_type,
sub_type,
unique_id,
association_type,
api_branch=None,
api_entity=None,
owner=None,
params=None,
):
params = params or {}
if owner:
params['owner'] = owner... | 542,332 |
Args:
owner:
main_type:
sub_type:
unique_id:
target:
api_branch:
api_entity:
params:
Return: | def group_associations_types(
self,
main_type,
sub_type,
unique_id,
target,
api_branch=None,
api_entity=None,
owner=None,
params=None,
):
params = params or {}
if owner:
params['owner'] = owner
api_... | 542,333 |
Args:
main_type:
sub_type:
unique_id:
victim_id:
params:
Return: | def victim(self, main_type, sub_type, unique_id, victim_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victims/{}'.format(main_type, unique_id, victim_id)
else:
url = '/v2/{}/{}/{}/victims/{}'.format(main_type, sub_type, unique_id, vic... | 542,341 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victims(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victims'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victims'.format(main_type, sub_type, unique_id)
for v in self._iterat... | 542,342 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets'.format(main_type, sub_type, unique_id)
for v... | 542,343 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_email_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets/emailAddresses'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets/emailAddresses'.format(type, sub_... | 542,344 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_network_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets/networkAccounts'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets/networkAccounts'.format(main_t... | 542,345 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_phone_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets/phoneNumbers'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets/phoneNumbers'.format(main_type, sub... | 542,346 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_social_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets/socialNetworks'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets/socialNetworks'.format(main_type... | 542,347 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def victim_web_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
if not sub_type:
url = '/v2/{}/{}/victimAssets/webSites'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/victimAssets/webSites'.format(main_type, sub_type, uni... | 542,348 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_victim_email_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.victim_email_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,349 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_victim_network_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.victim_network_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,350 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_victim_phone_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.victim_phone_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,351 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_victim_social_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.victim_social_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,352 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_victim_web_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.victim_web_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,353 |
Args:
owner:
main_type:
sub_type:
unique_id:
tag:
action:
params:
Return: | def tag(self, main_type, sub_type, unique_id, tag, action='GET', owner=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
action = action.upper()
if sub_type:
url = '/v2/{}/{}/{}/tags/{}'.format(main_type, sub_type, unique_id, q... | 542,359 |
Args:
owner:
main_type:
sub_type:
unique_id:
tag:
params:
Return: | def get_tag(self, main_type, sub_type, unique_id, tag, owner=None, params=None):
params = params or {}
return self.tag(main_type, sub_type, unique_id, tag, owner=owner, params=params) | 542,362 |
Args:
main_type:
sub_type:
unique_id:
owner:
filters:
params:
Return: | def tags(self, main_type, sub_type, unique_id, owner=None, filters=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if filters and filters.filters:
params['filters'] = filters.filters_string
if not sub_type:
url = '... | 542,363 |
Args:
main_type:
sub_type:
unique_id:
owner:
filters:
params:
Return: | def labels(self, main_type, sub_type, unique_id, owner=None, filters=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if filters and filters.filters:
params['filters'] = filters.filters_string
if not sub_type:
url =... | 542,364 |
Args:
owner:
main_type:
sub_type:
unique_id:
label:
params:
Return: | def get_label(self, main_type, sub_type, unique_id, label, owner=None, params=None):
params = params or {}
return self.label(
main_type, sub_type, unique_id, label, action='GET', owner=owner, params=params
) | 542,366 |
Args:
owner:
main_type:
sub_type:
unique_id:
label:
action:
params:
Return: | def label(self, main_type, sub_type, unique_id, label, action='ADD', owner=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
action = action.upper()
if not sub_type:
url = '/v2/{}/{}/securityLabels/{}'.format(main_type, unique... | 542,368 |
Args:
owner:
main_type:
sub_type:
unique_id:
params:
Return: | def attributes(self, main_type, sub_type, unique_id, owner=None, params=None):
params = params or {}
if owner:
params['owner'] = owner
if not sub_type:
url = '/v2/{}/{}/attributes'.format(main_type, unique_id)
else:
url = '/v2/{}/{}/{}/attr... | 542,369 |
Args:
owner:
main_type:
sub_type:
unique_id:
attribute_id:
action:
params:
Return: | def attribute(
self, main_type, sub_type, unique_id, attribute_id, action='GET', owner=None, params=None
):
params = params or {}
if owner:
params['owner'] = owner
action = action.upper()
if not sub_type:
url = '/v2/{}/{}/attributes/{}'.format... | 542,370 |
Args:
owner:
main_type:
sub_type:
unique_id:
attribute_id:
params:
Return: | def get_attribute(self, main_type, sub_type, unique_id, attribute_id, owner=None, params=None):
return self.attribute(
main_type, sub_type, unique_id, attribute_id, action='GET', owner=owner, params=params
) | 542,371 |
Args:
owner:
main_type:
sub_type:
unique_id:
attribute_id:
params:
Return: | def attribute_labels(
self, main_type, sub_type, unique_id, attribute_id, owner=None, params=None
):
params = params or {}
if owner:
params['owner'] = owner
if not sub_type:
url = '/v2/{}/{}/attributes/{}/securityLabels'.format(
main_... | 542,374 |
Args:
owner:
main_type:
sub_type:
unique_id:
attribute_id:
label:
params:
Return: | def get_attribute_label(
self, main_type, sub_type, unique_id, attribute_id, label, owner=None, params=None
):
return self.attribute_label(
main_type, sub_type, unique_id, attribute_id, label, owner=owner, params=params
) | 542,375 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def adversary_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
url = '/v2/{}/{}/{}/adversaryAssets'.format(main_type, sub_type, unique_id)
for aa in self._iterate(url, params, 'adversaryAsset'):
yield aa | 542,377 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def adversary_handle_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
url = '/v2/{}/{}/{}/adversaryAssets/handles'.format(main_type, sub_type, unique_id)
for aha in self._iterate(url, params, 'adversaryHandle'):
yield aha | 542,378 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def adversary_phone_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
url = '/v2/{}/{}/{}/adversaryAssets/phoneNumbers'.format(main_type, sub_type, unique_id)
for apa in self._iterate(url, params, 'adversaryPhone'):
yield apa | 542,379 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def adversary_url_assets(self, main_type, sub_type, unique_id, params=None):
params = params or {}
url = '/v2/{}/{}/{}/adversaryAssets/urls'.format(main_type, sub_type, unique_id)
for aua in self._iterate(url, params, 'adversaryUrl'):
yield aua | 542,380 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_adversary_url_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
params = params or {}
return self.adversary_url_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,381 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
action:
params:
Return: | def adversary_phone_asset(
self, main_type, sub_type, unique_id, asset_id, action='GET', params=None
):
params = params or {}
url = '/v2/{}/{}/{}/adversaryAssets/phoneNumbers/{}'.format(
main_type, sub_type, unique_id, asset_id
)
if action == 'GET':
... | 542,383 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_adversary_phone_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
return self.adversary_phone_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,384 |
Args:
main_type:
sub_type:
unique_id:
asset_id:
params:
Return: | def get_adversary_handler_asset(self, main_type, sub_type, unique_id, asset_id, params=None):
return self.adversary_handler_asset(main_type, sub_type, unique_id, asset_id, params=params) | 542,386 |
Args:
main_type:
sub_type:
unique_id:
params:
Return: | def assignees(self, main_type, sub_type, unique_id, params=None):
params = params or {}
url = '/v2/{}/{}/{}/assignees'.format(main_type, sub_type, unique_id)
for a in self._iterate(url, params, 'assignee'):
yield a | 542,389 |
Args:
main_type:
sub_type:
unique_id:
assignee_id:
action:
params:
Return: | def assignee(self, main_type, sub_type, unique_id, assignee_id, action='ADD', params=None):
params = params or {}
url = '/v2/{}/{}/{}/assignees/{}'.format(main_type, sub_type, unique_id, assignee_id)
if action == 'GET':
return self.tcex.session.get(url, params=params)
... | 542,390 |
Args:
main_type:
sub_type:
unique_id:
assignee_id:
params:
Return: | def get_assignee(self, main_type, sub_type, unique_id, assignee_id, params=None):
params = params or {}
return self.assignee(main_type, sub_type, unique_id, assignee_id, params=params) | 542,391 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.