repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun._vars_match
def _vars_match(self): """Regular expression to match playbook variable.""" return re.compile( r'#([A-Za-z]+)' # match literal (#App) at beginning of String r':([\d]+)' # app id (:7979) r':([A-Za-z0-9_\.\-\[\]]+)' # variable name (:variable_name) r'!(St...
python
def _vars_match(self): """Regular expression to match playbook variable.""" return re.compile( r'#([A-Za-z]+)' # match literal (#App) at beginning of String r':([\d]+)' # app id (:7979) r':([A-Za-z0-9_\.\-\[\]]+)' # variable name (:variable_name) r'!(St...
[ "def", "_vars_match", "(", "self", ")", ":", "return", "re", ".", "compile", "(", "r'#([A-Za-z]+)'", "# match literal (#App) at beginning of String", "r':([\\d]+)'", "# app id (:7979)", "r':([A-Za-z0-9_\\.\\-\\[\\]]+)'", "# variable name (:variable_name)", "r'!(StringArray|BinaryAr...
Regular expression to match playbook variable.
[ "Regular", "expression", "to", "match", "playbook", "variable", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L199-L211
train
27,400
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.autoclear
def autoclear(self): """Clear Redis and ThreatConnect data from staging data.""" for sd in self.staging_data: data_type = sd.get('data_type', 'redis') if data_type == 'redis': self.clear_redis(sd.get('variable'), 'auto-clear') elif data_type == 'redis-...
python
def autoclear(self): """Clear Redis and ThreatConnect data from staging data.""" for sd in self.staging_data: data_type = sd.get('data_type', 'redis') if data_type == 'redis': self.clear_redis(sd.get('variable'), 'auto-clear') elif data_type == 'redis-...
[ "def", "autoclear", "(", "self", ")", ":", "for", "sd", "in", "self", ".", "staging_data", ":", "data_type", "=", "sd", ".", "get", "(", "'data_type'", ",", "'redis'", ")", "if", "data_type", "==", "'redis'", ":", "self", ".", "clear_redis", "(", "sd",...
Clear Redis and ThreatConnect data from staging data.
[ "Clear", "Redis", "and", "ThreatConnect", "data", "from", "staging", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L213-L241
train
27,401
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.clear
def clear(self): """Clear Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data_type": "redis", "variable": "#App:4768:tc.adversary!TCEntity" } ThreatConnect Data: .. code-block:: j...
python
def clear(self): """Clear Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data_type": "redis", "variable": "#App:4768:tc.adversary!TCEntity" } ThreatConnect Data: .. code-block:: j...
[ "def", "clear", "(", "self", ")", ":", "for", "clear_data", "in", "self", ".", "profile", ".", "get", "(", "'clear'", ")", "or", "[", "]", ":", "if", "clear_data", ".", "get", "(", "'data_type'", ")", "==", "'redis'", ":", "self", ".", "clear_redis",...
Clear Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data_type": "redis", "variable": "#App:4768:tc.adversary!TCEntity" } ThreatConnect Data: .. code-block:: javascript { ...
[ "Clear", "Redis", "and", "ThreatConnect", "data", "defined", "in", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L243-L270
train
27,402
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.clear_redis
def clear_redis(self, variable, clear_type): """Delete Redis data for provided variable. Args: variable (str): The Redis variable to delete. clear_type (str): The type of clear action. """ if variable is None: return if variable in self._clear...
python
def clear_redis(self, variable, clear_type): """Delete Redis data for provided variable. Args: variable (str): The Redis variable to delete. clear_type (str): The type of clear action. """ if variable is None: return if variable in self._clear...
[ "def", "clear_redis", "(", "self", ",", "variable", ",", "clear_type", ")", ":", "if", "variable", "is", "None", ":", "return", "if", "variable", "in", "self", ".", "_clear_redis_tracker", ":", "return", "if", "not", "re", ".", "match", "(", "self", ".",...
Delete Redis data for provided variable. Args: variable (str): The Redis variable to delete. clear_type (str): The type of clear action.
[ "Delete", "Redis", "data", "for", "provided", "variable", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L272-L288
train
27,403
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.clear_tc
def clear_tc(self, owner, data, clear_type): """Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action. """ batch = s...
python
def clear_tc(self, owner, data, clear_type): """Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action. """ batch = s...
[ "def", "clear_tc", "(", "self", ",", "owner", ",", "data", ",", "clear_type", ")", ":", "batch", "=", "self", ".", "tcex", ".", "batch", "(", "owner", ",", "action", "=", "'Delete'", ")", "tc_type", "=", "data", ".", "get", "(", "'type'", ")", "pat...
Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action.
[ "Delete", "threat", "intel", "from", "ThreatConnect", "platform", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L290-L338
train
27,404
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.data_in_db
def data_in_db(db_data, user_data): """Validate db data in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation. """ if isinstance(user_data, list...
python
def data_in_db(db_data, user_data): """Validate db data in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation. """ if isinstance(user_data, list...
[ "def", "data_in_db", "(", "db_data", ",", "user_data", ")", ":", "if", "isinstance", "(", "user_data", ",", "list", ")", ":", "if", "db_data", "in", "user_data", ":", "return", "True", "return", "False" ]
Validate db data in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation.
[ "Validate", "db", "data", "in", "user", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L356-L369
train
27,405
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.data_it
def data_it(db_data, user_type): """Validate data is type. Args: db_data (dict|str|list): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation. """ data_type = { 'arra...
python
def data_it(db_data, user_type): """Validate data is type. Args: db_data (dict|str|list): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation. """ data_type = { 'arra...
[ "def", "data_it", "(", "db_data", ",", "user_type", ")", ":", "data_type", "=", "{", "'array'", ":", "(", "list", ")", ",", "# 'binary': (string_types),", "# 'bytes': (string_types),", "'dict'", ":", "(", "dict", ")", ",", "'entity'", ":", "(", "dict", ")", ...
Validate data is type. Args: db_data (dict|str|list): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation.
[ "Validate", "data", "is", "type", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L387-L425
train
27,406
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.data_not_in
def data_not_in(db_data, user_data): """Validate data not in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation. """ if isinstance(user_data, li...
python
def data_not_in(db_data, user_data): """Validate data not in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation. """ if isinstance(user_data, li...
[ "def", "data_not_in", "(", "db_data", ",", "user_data", ")", ":", "if", "isinstance", "(", "user_data", ",", "list", ")", ":", "if", "db_data", "not", "in", "user_data", ":", "return", "True", "return", "False" ]
Validate data not in user data. Args: db_data (str): The data store in Redis. user_data (list): The user provided data. Returns: bool: True if the data passed validation.
[ "Validate", "data", "not", "in", "user", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L445-L458
train
27,407
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.data_string_compare
def data_string_compare(db_data, user_data): """Validate string removing all white space before comparison. Args: db_data (str): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation. """ ...
python
def data_string_compare(db_data, user_data): """Validate string removing all white space before comparison. Args: db_data (str): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation. """ ...
[ "def", "data_string_compare", "(", "db_data", ",", "user_data", ")", ":", "db_data", "=", "''", ".", "join", "(", "db_data", ".", "split", "(", ")", ")", "user_data", "=", "''", ".", "join", "(", "user_data", ".", "split", "(", ")", ")", "if", "opera...
Validate string removing all white space before comparison. Args: db_data (str): The data store in Redis. user_data (str): The user provided data. Returns: bool: True if the data passed validation.
[ "Validate", "string", "removing", "all", "white", "space", "before", "comparison", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L476-L490
train
27,408
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.included_profiles
def included_profiles(self): """Load all profiles.""" profiles = [] for directory in self.tcex_json.get('profile_include_dirs') or []: profiles.extend(self._load_config_include(directory)) return profiles
python
def included_profiles(self): """Load all profiles.""" profiles = [] for directory in self.tcex_json.get('profile_include_dirs') or []: profiles.extend(self._load_config_include(directory)) return profiles
[ "def", "included_profiles", "(", "self", ")", ":", "profiles", "=", "[", "]", "for", "directory", "in", "self", ".", "tcex_json", ".", "get", "(", "'profile_include_dirs'", ")", "or", "[", "]", ":", "profiles", ".", "extend", "(", "self", ".", "_load_con...
Load all profiles.
[ "Load", "all", "profiles", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L522-L527
train
27,409
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.load_tcex
def load_tcex(self): """Inject required TcEx CLI Args.""" for arg, value in self.profile.get('profile_args', {}).data.items(): if arg not in self._tcex_required_args: continue # add new log file name and level sys.argv.extend(['--tc_log_file', 'tcex.l...
python
def load_tcex(self): """Inject required TcEx CLI Args.""" for arg, value in self.profile.get('profile_args', {}).data.items(): if arg not in self._tcex_required_args: continue # add new log file name and level sys.argv.extend(['--tc_log_file', 'tcex.l...
[ "def", "load_tcex", "(", "self", ")", ":", "for", "arg", ",", "value", "in", "self", ".", "profile", ".", "get", "(", "'profile_args'", ",", "{", "}", ")", ".", "data", ".", "items", "(", ")", ":", "if", "arg", "not", "in", "self", ".", "_tcex_re...
Inject required TcEx CLI Args.
[ "Inject", "required", "TcEx", "CLI", "Args", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L545-L567
train
27,410
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.operators
def operators(self): """Return dict of Validation Operators. + deep-diff (dd): This operator can compare any object that can be represented as JSON. + eq: This operator does a equal to comparison for String and StringArray variables. + ends-with (ew): This operator compares the end of a...
python
def operators(self): """Return dict of Validation Operators. + deep-diff (dd): This operator can compare any object that can be represented as JSON. + eq: This operator does a equal to comparison for String and StringArray variables. + ends-with (ew): This operator compares the end of a...
[ "def", "operators", "(", "self", ")", ":", "return", "{", "'dd'", ":", "self", ".", "deep_diff", ",", "'deep-diff'", ":", "self", ".", "deep_diff", ",", "'eq'", ":", "operator", ".", "eq", ",", "'ew'", ":", "self", ".", "data_endswith", ",", "'ends-wit...
Return dict of Validation Operators. + deep-diff (dd): This operator can compare any object that can be represented as JSON. + eq: This operator does a equal to comparison for String and StringArray variables. + ends-with (ew): This operator compares the end of a String with a user provided val...
[ "Return", "dict", "of", "Validation", "Operators", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L570-L622
train
27,411
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.path_data
def path_data(self, variable_data, path): """Return JMESPath data. Args: variable_data (str): The JSON data to run path expression. path (str): The JMESPath expression. Returns: dict: The resulting data from JMESPath. """ # NOTE: tcex does in...
python
def path_data(self, variable_data, path): """Return JMESPath data. Args: variable_data (str): The JSON data to run path expression. path (str): The JMESPath expression. Returns: dict: The resulting data from JMESPath. """ # NOTE: tcex does in...
[ "def", "path_data", "(", "self", ",", "variable_data", ",", "path", ")", ":", "# NOTE: tcex does include the jmespath library as a dependencies since it is only", "# required for local testing.", "try", ":", "import", "jmespath", "except", "ImportError", ":", "print", "(", ...
Return JMESPath data. Args: variable_data (str): The JSON data to run path expression. path (str): The JMESPath expression. Returns: dict: The resulting data from JMESPath.
[ "Return", "JMESPath", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L624-L653
train
27,412
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.profile
def profile(self, profile): """Set the current profile. Args: profile (dict): The profile data. """ # clear staging data self._staging_data = None # retrieve language from install.json or assume Python lang = profile.get('install_json', {}).get('progr...
python
def profile(self, profile): """Set the current profile. Args: profile (dict): The profile data. """ # clear staging data self._staging_data = None # retrieve language from install.json or assume Python lang = profile.get('install_json', {}).get('progr...
[ "def", "profile", "(", "self", ",", "profile", ")", ":", "# clear staging data", "self", ".", "_staging_data", "=", "None", "# retrieve language from install.json or assume Python", "lang", "=", "profile", ".", "get", "(", "'install_json'", ",", "{", "}", ")", "."...
Set the current profile. Args: profile (dict): The profile data.
[ "Set", "the", "current", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L661-L682
train
27,413
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.profile_args
def profile_args(_args): """Return args for v1, v2, or v3 structure. Args: _args (dict): The args section from the profile. Returns: dict: A collapsed version of the args dict. """ # TODO: clean this up in a way that works for both py2/3 if ( ...
python
def profile_args(_args): """Return args for v1, v2, or v3 structure. Args: _args (dict): The args section from the profile. Returns: dict: A collapsed version of the args dict. """ # TODO: clean this up in a way that works for both py2/3 if ( ...
[ "def", "profile_args", "(", "_args", ")", ":", "# TODO: clean this up in a way that works for both py2/3", "if", "(", "_args", ".", "get", "(", "'app'", ",", "{", "}", ")", ".", "get", "(", "'optional'", ")", "is", "not", "None", "or", "_args", ".", "get", ...
Return args for v1, v2, or v3 structure. Args: _args (dict): The args section from the profile. Returns: dict: A collapsed version of the args dict.
[ "Return", "args", "for", "v1", "v2", "or", "v3", "structure", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L685-L715
train
27,414
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.profiles
def profiles(self): """Return all selected profiles.""" selected_profiles = [] for config in self.included_profiles: profile_selected = False profile_name = config.get('profile_name') if profile_name == self.args.profile: profile_selected = Tr...
python
def profiles(self): """Return all selected profiles.""" selected_profiles = [] for config in self.included_profiles: profile_selected = False profile_name = config.get('profile_name') if profile_name == self.args.profile: profile_selected = Tr...
[ "def", "profiles", "(", "self", ")", ":", "selected_profiles", "=", "[", "]", "for", "config", "in", "self", ".", "included_profiles", ":", "profile_selected", "=", "False", "profile_name", "=", "config", ".", "get", "(", "'profile_name'", ")", "if", "profil...
Return all selected profiles.
[ "Return", "all", "selected", "profiles", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L718-L745
train
27,415
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.report
def report(self): """Format and output report data to screen.""" print('\n{}{}{}'.format(c.Style.BRIGHT, c.Fore.CYAN, 'Report:')) # report headers print('{!s:<85}{!s:<20}'.format('', 'Validations')) print( '{!s:<60}{!s:<25}{!s:<10}{!s:<10}'.format( 'Pr...
python
def report(self): """Format and output report data to screen.""" print('\n{}{}{}'.format(c.Style.BRIGHT, c.Fore.CYAN, 'Report:')) # report headers print('{!s:<85}{!s:<20}'.format('', 'Validations')) print( '{!s:<60}{!s:<25}{!s:<10}{!s:<10}'.format( 'Pr...
[ "def", "report", "(", "self", ")", ":", "print", "(", "'\\n{}{}{}'", ".", "format", "(", "c", ".", "Style", ".", "BRIGHT", ",", "c", ".", "Fore", ".", "CYAN", ",", "'Report:'", ")", ")", "# report headers", "print", "(", "'{!s:<85}{!s:<20}'", ".", "for...
Format and output report data to screen.
[ "Format", "and", "output", "report", "data", "to", "screen", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L747-L794
train
27,416
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run
def run(self): """Run the App using the current profile. The current profile has the install_json and args pre-loaded. """ install_json = self.profile.get('install_json') program_language = self.profile.get('install_json').get('programLanguage', 'python').lower() print(...
python
def run(self): """Run the App using the current profile. The current profile has the install_json and args pre-loaded. """ install_json = self.profile.get('install_json') program_language = self.profile.get('install_json').get('programLanguage', 'python').lower() print(...
[ "def", "run", "(", "self", ")", ":", "install_json", "=", "self", ".", "profile", ".", "get", "(", "'install_json'", ")", "program_language", "=", "self", ".", "profile", ".", "get", "(", "'install_json'", ")", ".", "get", "(", "'programLanguage'", ",", ...
Run the App using the current profile. The current profile has the install_json and args pre-loaded.
[ "Run", "the", "App", "using", "the", "current", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L796-L831
train
27,417
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run_commands
def run_commands(self, program_language, program_main): """Return the run Print Command. Args: program_language (str): The language of the current App/Project. program_main (str): The executable name. Returns: dict: A dictionary containing the run command an...
python
def run_commands(self, program_language, program_main): """Return the run Print Command. Args: program_language (str): The language of the current App/Project. program_main (str): The executable name. Returns: dict: A dictionary containing the run command an...
[ "def", "run_commands", "(", "self", ",", "program_language", ",", "program_main", ")", ":", "# build the command", "if", "program_language", "==", "'python'", ":", "python_exe", "=", "sys", ".", "executable", "ptvsd_host", "=", "'localhost'", "if", "self", ".", ...
Return the run Print Command. Args: program_language (str): The language of the current App/Project. program_main (str): The executable name. Returns: dict: A dictionary containing the run command and a printable version of the command.
[ "Return", "the", "run", "Print", "Command", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L833-L903
train
27,418
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run_local
def run_local(self, commands): """Run the App on local system. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command. """ process = subprocess.Popen( commands.get('cli_command'), ...
python
def run_local(self, commands): """Run the App on local system. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command. """ process = subprocess.Popen( commands.get('cli_command'), ...
[ "def", "run_local", "(", "self", ",", "commands", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "commands", ".", "get", "(", "'cli_command'", ")", ",", "shell", "=", "self", ".", "shell", ",", "stdin", "=", "subprocess", ".", "PIPE", ",", ...
Run the App on local system. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command.
[ "Run", "the", "App", "on", "local", "system", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L905-L929
train
27,419
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run_docker
def run_docker(self, commands): """Run App in Docker Container. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command. """ try: import docker except ImportError: pri...
python
def run_docker(self, commands): """Run App in Docker Container. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command. """ try: import docker except ImportError: pri...
[ "def", "run_docker", "(", "self", ",", "commands", ")", ":", "try", ":", "import", "docker", "except", "ImportError", ":", "print", "(", "'{}{}Could not import docker module (try \"pip install docker\").'", ".", "format", "(", "c", ".", "Style", ".", "BRIGHT", ","...
Run App in Docker Container. Args: commands (dict): A dictionary of the CLI commands. Returns: int: The exit code of the subprocess command.
[ "Run", "App", "in", "Docker", "Container", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L931-L1015
train
27,420
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run_display_app_output
def run_display_app_output(self, out): """Print any App output. Args: out (str): One or more lines of output messages. """ if not self.profile.get('quiet') and not self.args.quiet: print('App Output:') for o in out.decode('utf-8').split('\n'): ...
python
def run_display_app_output(self, out): """Print any App output. Args: out (str): One or more lines of output messages. """ if not self.profile.get('quiet') and not self.args.quiet: print('App Output:') for o in out.decode('utf-8').split('\n'): ...
[ "def", "run_display_app_output", "(", "self", ",", "out", ")", ":", "if", "not", "self", ".", "profile", ".", "get", "(", "'quiet'", ")", "and", "not", "self", ".", "args", ".", "quiet", ":", "print", "(", "'App Output:'", ")", "for", "o", "in", "out...
Print any App output. Args: out (str): One or more lines of output messages.
[ "Print", "any", "App", "output", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1028-L1038
train
27,421
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.run_validate_program_main
def run_validate_program_main(self, program_main): """Validate the program main file exists. Args: program_main (str): The executable name. """ program_language = self.profile.get('install_json').get('programLanguage', 'python').lower() if program_language == 'python...
python
def run_validate_program_main(self, program_main): """Validate the program main file exists. Args: program_main (str): The executable name. """ program_language = self.profile.get('install_json').get('programLanguage', 'python').lower() if program_language == 'python...
[ "def", "run_validate_program_main", "(", "self", ",", "program_main", ")", ":", "program_language", "=", "self", ".", "profile", ".", "get", "(", "'install_json'", ")", ".", "get", "(", "'programLanguage'", ",", "'python'", ")", ".", "lower", "(", ")", "if",...
Validate the program main file exists. Args: program_main (str): The executable name.
[ "Validate", "the", "program", "main", "file", "exists", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1116-L1129
train
27,422
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage
def stage(self): """Stage Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data": [ "This is an example Source #1", "This is an example Source #2" ], "...
python
def stage(self): """Stage Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data": [ "This is an example Source #1", "This is an example Source #2" ], "...
[ "def", "stage", "(", "self", ")", ":", "for", "sd", "in", "self", ".", "staging_data", ":", "if", "not", "isinstance", "(", "sd", ",", "dict", ")", ":", "# reported issue from qa where staging data is invalid", "msg", "=", "'Invalid staging data provided ({}).'", ...
Stage Redis and ThreatConnect data defined in profile. Redis Data: .. code-block:: javascript { "data": [ "This is an example Source #1", "This is an example Source #2" ], "variable": "#App:1234:source...
[ "Stage", "Redis", "and", "ThreatConnect", "data", "defined", "in", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1131-L1261
train
27,423
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.staging_data
def staging_data(self): """Read data files and return all staging data for current profile.""" if self._staging_data is None: staging_data = [] for staging_file in self.profile.get('data_files') or []: if os.path.isfile(staging_file): print( ...
python
def staging_data(self): """Read data files and return all staging data for current profile.""" if self._staging_data is None: staging_data = [] for staging_file in self.profile.get('data_files') or []: if os.path.isfile(staging_file): print( ...
[ "def", "staging_data", "(", "self", ")", ":", "if", "self", ".", "_staging_data", "is", "None", ":", "staging_data", "=", "[", "]", "for", "staging_file", "in", "self", ".", "profile", ".", "get", "(", "'data_files'", ")", "or", "[", "]", ":", "if", ...
Read data files and return all staging data for current profile.
[ "Read", "data", "files", "and", "return", "all", "staging", "data", "for", "current", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1264-L1284
train
27,424
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_redis
def stage_redis(self, variable, data): """Stage data in Redis. Args: variable (str): The Redis variable name. data (dict|list|str): The data to store in Redis. """ if isinstance(data, int): data = str(data) # handle binary if variable....
python
def stage_redis(self, variable, data): """Stage data in Redis. Args: variable (str): The Redis variable name. data (dict|list|str): The data to store in Redis. """ if isinstance(data, int): data = str(data) # handle binary if variable....
[ "def", "stage_redis", "(", "self", ",", "variable", ",", "data", ")", ":", "if", "isinstance", "(", "data", ",", "int", ")", ":", "data", "=", "str", "(", "data", ")", "# handle binary", "if", "variable", ".", "endswith", "(", "'Binary'", ")", ":", "...
Stage data in Redis. Args: variable (str): The Redis variable name. data (dict|list|str): The data to store in Redis.
[ "Stage", "data", "in", "Redis", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1286-L1319
train
27,425
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc
def stage_tc(self, owner, staging_data, variable): """Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", "ownerName"...
python
def stage_tc(self, owner, staging_data, variable): """Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", "ownerName"...
[ "def", "stage_tc", "(", "self", ",", "owner", ",", "staging_data", ",", "variable", ")", ":", "# parse resource_data", "resource_type", "=", "staging_data", ".", "pop", "(", "'type'", ")", "if", "resource_type", "in", "self", ".", "tcex", ".", "indicator_types...
Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", "ownerName": "qa-build", "dateAdded": "2017-08-16T18:35:0...
[ "Stage", "data", "using", "ThreatConnect", "API", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1321-L1408
train
27,426
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc_create_security_label
def stage_tc_create_security_label(self, label, resource): """Add a security label to a resource. Args: label (str): The security label (must exit in ThreatConnect). resource (obj): An instance of tcex resource class. """ sl_resource = resource.security_labels(la...
python
def stage_tc_create_security_label(self, label, resource): """Add a security label to a resource. Args: label (str): The security label (must exit in ThreatConnect). resource (obj): An instance of tcex resource class. """ sl_resource = resource.security_labels(la...
[ "def", "stage_tc_create_security_label", "(", "self", ",", "label", ",", "resource", ")", ":", "sl_resource", "=", "resource", ".", "security_labels", "(", "label", ")", "sl_resource", ".", "http_method", "=", "'POST'", "sl_response", "=", "sl_resource", ".", "r...
Add a security label to a resource. Args: label (str): The security label (must exit in ThreatConnect). resource (obj): An instance of tcex resource class.
[ "Add", "a", "security", "label", "to", "a", "resource", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1436-L1451
train
27,427
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc_create_tag
def stage_tc_create_tag(self, tag, resource): """Add a tag to a resource. Args: tag (str): The tag to be added to the resource. resource (obj): An instance of tcex resource class. """ tag_resource = resource.tags(self.tcex.safetag(tag)) tag_resource.http_...
python
def stage_tc_create_tag(self, tag, resource): """Add a tag to a resource. Args: tag (str): The tag to be added to the resource. resource (obj): An instance of tcex resource class. """ tag_resource = resource.tags(self.tcex.safetag(tag)) tag_resource.http_...
[ "def", "stage_tc_create_tag", "(", "self", ",", "tag", ",", "resource", ")", ":", "tag_resource", "=", "resource", ".", "tags", "(", "self", ".", "tcex", ".", "safetag", "(", "tag", ")", ")", "tag_resource", ".", "http_method", "=", "'POST'", "t_response",...
Add a tag to a resource. Args: tag (str): The tag to be added to the resource. resource (obj): An instance of tcex resource class.
[ "Add", "a", "tag", "to", "a", "resource", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1453-L1466
train
27,428
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc_batch
def stage_tc_batch(self, owner, staging_data): """Stage data in ThreatConnect Platform using batch API. Args: owner (str): The ThreatConnect owner to submit batch job. staging_data (dict): A dict of ThreatConnect batch data. """ batch = self.tcex.batch(owner) ...
python
def stage_tc_batch(self, owner, staging_data): """Stage data in ThreatConnect Platform using batch API. Args: owner (str): The ThreatConnect owner to submit batch job. staging_data (dict): A dict of ThreatConnect batch data. """ batch = self.tcex.batch(owner) ...
[ "def", "stage_tc_batch", "(", "self", ",", "owner", ",", "staging_data", ")", ":", "batch", "=", "self", ".", "tcex", ".", "batch", "(", "owner", ")", "for", "group", "in", "staging_data", ".", "get", "(", "'group'", ")", "or", "[", "]", ":", "# add ...
Stage data in ThreatConnect Platform using batch API. Args: owner (str): The ThreatConnect owner to submit batch job. staging_data (dict): A dict of ThreatConnect batch data.
[ "Stage", "data", "in", "ThreatConnect", "Platform", "using", "batch", "API", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1516-L1561
train
27,429
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc_batch_xid
def stage_tc_batch_xid(xid_type, xid_value, owner): """Create an xid for a batch job. Args: xid_type (str): [description] xid_value (str): [description] owner (str): [description] Returns: [type]: [description] """ xid_string = '{...
python
def stage_tc_batch_xid(xid_type, xid_value, owner): """Create an xid for a batch job. Args: xid_type (str): [description] xid_value (str): [description] owner (str): [description] Returns: [type]: [description] """ xid_string = '{...
[ "def", "stage_tc_batch_xid", "(", "xid_type", ",", "xid_value", ",", "owner", ")", ":", "xid_string", "=", "'{}-{}-{}'", ".", "format", "(", "xid_type", ",", "xid_value", ",", "owner", ")", "hash_object", "=", "hashlib", ".", "sha256", "(", "xid_string", "."...
Create an xid for a batch job. Args: xid_type (str): [description] xid_value (str): [description] owner (str): [description] Returns: [type]: [description]
[ "Create", "an", "xid", "for", "a", "batch", "job", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1564-L1577
train
27,430
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.stage_tc_indicator_entity
def stage_tc_indicator_entity(self, indicator_data): """Convert JSON data to TCEntity. Args: indicator_data (str): [description] Returns: [type]: [description] """ path = '@.{value: summary, ' path += 'type: type, ' path += 'ownerName: ow...
python
def stage_tc_indicator_entity(self, indicator_data): """Convert JSON data to TCEntity. Args: indicator_data (str): [description] Returns: [type]: [description] """ path = '@.{value: summary, ' path += 'type: type, ' path += 'ownerName: ow...
[ "def", "stage_tc_indicator_entity", "(", "self", ",", "indicator_data", ")", ":", "path", "=", "'@.{value: summary, '", "path", "+=", "'type: type, '", "path", "+=", "'ownerName: ownerName, '", "path", "+=", "'confidence: confidence || `0`, '", "path", "+=", "'rating: rat...
Convert JSON data to TCEntity. Args: indicator_data (str): [description] Returns: [type]: [description]
[ "Convert", "JSON", "data", "to", "TCEntity", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1591-L1605
train
27,431
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.validate_log_output
def validate_log_output(self, passed, db_data, user_data, oper): """Format the validation log output to be easier to read. Args: passed (bool): The results of the validation test. db_data (str): The data store in Redis. user_data (str): The user provided data. ...
python
def validate_log_output(self, passed, db_data, user_data, oper): """Format the validation log output to be easier to read. Args: passed (bool): The results of the validation test. db_data (str): The data store in Redis. user_data (str): The user provided data. ...
[ "def", "validate_log_output", "(", "self", ",", "passed", ",", "db_data", ",", "user_data", ",", "oper", ")", ":", "truncate", "=", "self", ".", "args", ".", "truncate", "if", "db_data", "is", "not", "None", "and", "passed", ":", "if", "isinstance", "(",...
Format the validation log output to be easier to read. Args: passed (bool): The results of the validation test. db_data (str): The data store in Redis. user_data (str): The user provided data. oper (str): The comparison operator. Raises: Runt...
[ "Format", "the", "validation", "log", "output", "to", "be", "easier", "to", "read", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1715-L1784
train
27,432
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder._add_arg_python
def _add_arg_python(self, key, value=None, mask=False): """Add CLI Arg formatted specifically for Python. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask val...
python
def _add_arg_python(self, key, value=None, mask=False): """Add CLI Arg formatted specifically for Python. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask val...
[ "def", "_add_arg_python", "(", "self", ",", "key", ",", "value", "=", "None", ",", "mask", "=", "False", ")", ":", "self", ".", "_data", "[", "key", "]", "=", "value", "if", "not", "value", ":", "# both false boolean values (flags) and empty values should not ...
Add CLI Arg formatted specifically for Python. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value.
[ "Add", "CLI", "Arg", "formatted", "specifically", "for", "Python", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1820-L1846
train
27,433
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder._add_arg_java
def _add_arg_java(self, key, value, mask=False): """Add CLI Arg formatted specifically for Java. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value. ...
python
def _add_arg_java(self, key, value, mask=False): """Add CLI Arg formatted specifically for Java. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value. ...
[ "def", "_add_arg_java", "(", "self", ",", "key", ",", "value", ",", "mask", "=", "False", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "value", "=", "int", "(", "value", ")", "self", ".", "_data", "[", "key", "]", "=", "valu...
Add CLI Arg formatted specifically for Java. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value.
[ "Add", "CLI", "Arg", "formatted", "specifically", "for", "Java", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1848-L1863
train
27,434
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder._add_arg
def _add_arg(self, key, value, mask=False): """Add CLI Arg for the correct language. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value. """ ...
python
def _add_arg(self, key, value, mask=False): """Add CLI Arg for the correct language. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value. """ ...
[ "def", "_add_arg", "(", "self", ",", "key", ",", "value", ",", "mask", "=", "False", ")", ":", "if", "self", ".", "lang", "==", "'python'", ":", "self", ".", "_add_arg_python", "(", "key", ",", "value", ",", "mask", ")", "elif", "self", ".", "lang"...
Add CLI Arg for the correct language. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). mask (boolean, default:False): Indicates whether no mask value.
[ "Add", "CLI", "Arg", "for", "the", "correct", "language", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1865-L1876
train
27,435
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder.add
def add(self, key, value): """Add CLI Arg to lists value. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). """ if isinstance(value, list): # TODO: support env vars in list w/masked values ...
python
def add(self, key, value): """Add CLI Arg to lists value. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob). """ if isinstance(value, list): # TODO: support env vars in list w/masked values ...
[ "def", "add", "(", "self", ",", "key", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "# TODO: support env vars in list w/masked values", "for", "val", "in", "value", ":", "self", ".", "_add_arg_python", "(", "key", ",", "...
Add CLI Arg to lists value. Args: key (string): The CLI Args key (e.g., --name). value (string): The CLI Args value (e.g., bob).
[ "Add", "CLI", "Arg", "to", "lists", "value", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1878-L1906
train
27,436
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder.quote
def quote(self, data): """Quote any parameters that contain spaces or special character. Returns: (string): String containing parameters wrapped in double quotes """ if self.lang == 'python': quote_char = "'" elif self.lang == 'java': quote_c...
python
def quote(self, data): """Quote any parameters that contain spaces or special character. Returns: (string): String containing parameters wrapped in double quotes """ if self.lang == 'python': quote_char = "'" elif self.lang == 'java': quote_c...
[ "def", "quote", "(", "self", ",", "data", ")", ":", "if", "self", ".", "lang", "==", "'python'", ":", "quote_char", "=", "\"'\"", "elif", "self", ".", "lang", "==", "'java'", ":", "quote_char", "=", "\"'\"", "if", "re", ".", "findall", "(", "r'[!\\-\...
Quote any parameters that contain spaces or special character. Returns: (string): String containing parameters wrapped in double quotes
[ "Quote", "any", "parameters", "that", "contain", "spaces", "or", "special", "character", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1908-L1922
train
27,437
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
ArgBuilder.load
def load(self, profile_args): """Load provided CLI Args. Args: args (dict): Dictionary of args in key/value format. """ for key, value in profile_args.items(): self.add(key, value)
python
def load(self, profile_args): """Load provided CLI Args. Args: args (dict): Dictionary of args in key/value format. """ for key, value in profile_args.items(): self.add(key, value)
[ "def", "load", "(", "self", ",", "profile_args", ")", ":", "for", "key", ",", "value", "in", "profile_args", ".", "items", "(", ")", ":", "self", ".", "add", "(", "key", ",", "value", ")" ]
Load provided CLI Args. Args: args (dict): Dictionary of args in key/value format.
[ "Load", "provided", "CLI", "Args", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1924-L1931
train
27,438
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
Reports.add_profile
def add_profile(self, profile, selected): """Add profile to report.""" report = Report(profile) report.selected = selected if selected: self.report['settings']['selected_profiles'].append(report.name) self.report['settings']['selected_profile_count'] += 1 ...
python
def add_profile(self, profile, selected): """Add profile to report.""" report = Report(profile) report.selected = selected if selected: self.report['settings']['selected_profiles'].append(report.name) self.report['settings']['selected_profile_count'] += 1 ...
[ "def", "add_profile", "(", "self", ",", "profile", ",", "selected", ")", ":", "report", "=", "Report", "(", "profile", ")", "report", ".", "selected", "=", "selected", "if", "selected", ":", "self", ".", "report", "[", "'settings'", "]", "[", "'selected_...
Add profile to report.
[ "Add", "profile", "to", "report", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L2022-L2031
train
27,439
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
Reports.profile
def profile(self, name): """Return a specific profile.""" self.selected_profile = self.profiles.get(name) return self.profiles.get(name)
python
def profile(self, name): """Return a specific profile.""" self.selected_profile = self.profiles.get(name) return self.profiles.get(name)
[ "def", "profile", "(", "self", ",", "name", ")", ":", "self", ".", "selected_profile", "=", "self", ".", "profiles", ".", "get", "(", "name", ")", "return", "self", ".", "profiles", ".", "get", "(", "name", ")" ]
Return a specific profile.
[ "Return", "a", "specific", "profile", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L2041-L2044
train
27,440
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.add_file
def add_file(self, filename, file_content): """Add a file for Document and Report types. Example:: document = tcex.batch.group('Document', 'My Document') document.add_file('my_file.txt', 'my contents') Args: filename (str): The name of the file. ...
python
def add_file(self, filename, file_content): """Add a file for Document and Report types. Example:: document = tcex.batch.group('Document', 'My Document') document.add_file('my_file.txt', 'my contents') Args: filename (str): The name of the file. ...
[ "def", "add_file", "(", "self", ",", "filename", ",", "file_content", ")", ":", "self", ".", "_group_data", "[", "'fileName'", "]", "=", "filename", "self", ".", "_file_content", "=", "file_content" ]
Add a file for Document and Report types. Example:: document = tcex.batch.group('Document', 'My Document') document.add_file('my_file.txt', 'my contents') Args: filename (str): The name of the file. file_content (bytes|method|str): The contents of the f...
[ "Add", "a", "file", "for", "Document", "and", "Report", "types", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L66-L79
train
27,441
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.add_key_value
def add_key_value(self, key, value): """Add custom field to Group object. .. note:: The key must be the exact name required by the batch schema. Example:: document = tcex.batch.group('Document', 'My Document') document.add_key_value('fileName', 'something.pdf') ...
python
def add_key_value(self, key, value): """Add custom field to Group object. .. note:: The key must be the exact name required by the batch schema. Example:: document = tcex.batch.group('Document', 'My Document') document.add_key_value('fileName', 'something.pdf') ...
[ "def", "add_key_value", "(", "self", ",", "key", ",", "value", ")", ":", "key", "=", "self", ".", "_metadata_map", ".", "get", "(", "key", ",", "key", ")", "if", "key", "in", "[", "'dateAdded'", ",", "'eventDate'", ",", "'firstSeen'", ",", "'publishDat...
Add custom field to Group object. .. note:: The key must be the exact name required by the batch schema. Example:: document = tcex.batch.group('Document', 'My Document') document.add_key_value('fileName', 'something.pdf') Args: key (str): The field key to ...
[ "Add", "custom", "field", "to", "Group", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L81-L104
train
27,442
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.data
def data(self): """Return Group data.""" # add attributes if self._attributes: self._group_data['attribute'] = [] for attr in self._attributes: if attr.valid: self._group_data['attribute'].append(attr.data) # add security labels...
python
def data(self): """Return Group data.""" # add attributes if self._attributes: self._group_data['attribute'] = [] for attr in self._attributes: if attr.valid: self._group_data['attribute'].append(attr.data) # add security labels...
[ "def", "data", "(", "self", ")", ":", "# add attributes", "if", "self", ".", "_attributes", ":", "self", ".", "_group_data", "[", "'attribute'", "]", "=", "[", "]", "for", "attr", "in", "self", ".", "_attributes", ":", "if", "attr", ".", "valid", ":", ...
Return Group data.
[ "Return", "Group", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L156-L175
train
27,443
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.security_label
def security_label(self, name, description=None, color=None): """Return instance of SecurityLabel. .. note:: The provided security label will be create if it doesn't exist. If the security label already exists nothing will be changed. Args: name (str): The value for thi...
python
def security_label(self, name, description=None, color=None): """Return instance of SecurityLabel. .. note:: The provided security label will be create if it doesn't exist. If the security label already exists nothing will be changed. Args: name (str): The value for thi...
[ "def", "security_label", "(", "self", ",", "name", ",", "description", "=", "None", ",", "color", "=", "None", ")", ":", "label", "=", "SecurityLabel", "(", "name", ",", "description", ",", "color", ")", "for", "label_data", "in", "self", ".", "_labels",...
Return instance of SecurityLabel. .. note:: The provided security label will be create if it doesn't exist. If the security label already exists nothing will be changed. Args: name (str): The value for this security label. description (str): A description for this s...
[ "Return", "instance", "of", "SecurityLabel", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L216-L237
train
27,444
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.tag
def tag(self, name, formatter=None): """Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag. """ ...
python
def tag(self, name, formatter=None): """Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag. """ ...
[ "def", "tag", "(", "self", ",", "name", ",", "formatter", "=", "None", ")", ":", "tag", "=", "Tag", "(", "name", ",", "formatter", ")", "for", "tag_data", "in", "self", ".", "_tags", ":", "if", "tag_data", ".", "name", "==", "name", ":", "tag", "...
Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag.
[ "Return", "instance", "of", "Tag", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L239-L257
train
27,445
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Campaign.first_seen
def first_seen(self, first_seen): """Set Document first seen.""" self._group_data['firstSeen'] = self._utils.format_datetime( first_seen, date_format='%Y-%m-%dT%H:%M:%SZ' )
python
def first_seen(self, first_seen): """Set Document first seen.""" self._group_data['firstSeen'] = self._utils.format_datetime( first_seen, date_format='%Y-%m-%dT%H:%M:%SZ' )
[ "def", "first_seen", "(", "self", ",", "first_seen", ")", ":", "self", ".", "_group_data", "[", "'firstSeen'", "]", "=", "self", ".", "_utils", ".", "format_datetime", "(", "first_seen", ",", "date_format", "=", "'%Y-%m-%dT%H:%M:%SZ'", ")" ]
Set Document first seen.
[ "Set", "Document", "first", "seen", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L314-L318
train
27,446
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Event.event_date
def event_date(self, event_date): """Set the Events "event date" value.""" self._group_data['eventDate'] = self._utils.format_datetime( event_date, date_format='%Y-%m-%dT%H:%M:%SZ' )
python
def event_date(self, event_date): """Set the Events "event date" value.""" self._group_data['eventDate'] = self._utils.format_datetime( event_date, date_format='%Y-%m-%dT%H:%M:%SZ' )
[ "def", "event_date", "(", "self", ",", "event_date", ")", ":", "self", ".", "_group_data", "[", "'eventDate'", "]", "=", "self", ".", "_utils", ".", "format_datetime", "(", "event_date", ",", "date_format", "=", "'%Y-%m-%dT%H:%M:%SZ'", ")" ]
Set the Events "event date" value.
[ "Set", "the", "Events", "event", "date", "value", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L471-L475
train
27,447
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Report.publish_date
def publish_date(self, publish_date): """Set Report publish date""" self._group_data['publishDate'] = self._utils.format_datetime( publish_date, date_format='%Y-%m-%dT%H:%M:%SZ' )
python
def publish_date(self, publish_date): """Set Report publish date""" self._group_data['publishDate'] = self._utils.format_datetime( publish_date, date_format='%Y-%m-%dT%H:%M:%SZ' )
[ "def", "publish_date", "(", "self", ",", "publish_date", ")", ":", "self", ".", "_group_data", "[", "'publishDate'", "]", "=", "self", ".", "_utils", ".", "format_datetime", "(", "publish_date", ",", "date_format", "=", "'%Y-%m-%dT%H:%M:%SZ'", ")" ]
Set Report publish date
[ "Set", "Report", "publish", "date" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L616-L620
train
27,448
ThreatConnect-Inc/tcex
app_init/__main__.py
AppLib.find_lib_directory
def find_lib_directory(self): """Find the optimal lib directory.""" lib_directory = None if self.lib_micro_version in self.lib_directories: lib_directory = self.lib_micro_version elif self.lib_minor_version in self.lib_directories: lib_directory = self.lib_minor_v...
python
def find_lib_directory(self): """Find the optimal lib directory.""" lib_directory = None if self.lib_micro_version in self.lib_directories: lib_directory = self.lib_micro_version elif self.lib_minor_version in self.lib_directories: lib_directory = self.lib_minor_v...
[ "def", "find_lib_directory", "(", "self", ")", ":", "lib_directory", "=", "None", "if", "self", ".", "lib_micro_version", "in", "self", ".", "lib_directories", ":", "lib_directory", "=", "self", ".", "lib_micro_version", "elif", "self", ".", "lib_minor_version", ...
Find the optimal lib directory.
[ "Find", "the", "optimal", "lib", "directory", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/app_init/__main__.py#L26-L44
train
27,449
ThreatConnect-Inc/tcex
app_init/__main__.py
AppLib.lib_directories
def lib_directories(self): """Get all "lib" directories.""" if self._lib_directories is None: self._lib_directories = [] app_path = os.getcwd() contents = os.listdir(app_path) for c in contents: # ensure content starts with lib, is director...
python
def lib_directories(self): """Get all "lib" directories.""" if self._lib_directories is None: self._lib_directories = [] app_path = os.getcwd() contents = os.listdir(app_path) for c in contents: # ensure content starts with lib, is director...
[ "def", "lib_directories", "(", "self", ")", ":", "if", "self", ".", "_lib_directories", "is", "None", ":", "self", ".", "_lib_directories", "=", "[", "]", "app_path", "=", "os", ".", "getcwd", "(", ")", "contents", "=", "os", ".", "listdir", "(", "app_...
Get all "lib" directories.
[ "Get", "all", "lib", "directories", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/app_init/__main__.py#L47-L57
train
27,450
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/indicator/indicator_types/file.py
File._set_unique_id
def _set_unique_id(self, json_response): """ Sets the unique_id provided a json response. Args: json_response: """ self.unique_id = ( json_response.get('md5') or json_response.get('sha1') or json_response.get('sha256') ...
python
def _set_unique_id(self, json_response): """ Sets the unique_id provided a json response. Args: json_response: """ self.unique_id = ( json_response.get('md5') or json_response.get('sha1') or json_response.get('sha256') ...
[ "def", "_set_unique_id", "(", "self", ",", "json_response", ")", ":", "self", ".", "unique_id", "=", "(", "json_response", ".", "get", "(", "'md5'", ")", "or", "json_response", ".", "get", "(", "'sha1'", ")", "or", "json_response", ".", "get", "(", "'sha...
Sets the unique_id provided a json response. Args: json_response:
[ "Sets", "the", "unique_id", "provided", "a", "json", "response", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/indicator/indicator_types/file.py#L56-L68
train
27,451
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py
Indicator.rating
def rating(self, value): """ Updates the Indicators rating Args: value: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) request_data = {'rating': value} return self.tc_requests.update( self.api_type, sel...
python
def rating(self, value): """ Updates the Indicators rating Args: value: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) request_data = {'rating': value} return self.tc_requests.update( self.api_type, sel...
[ "def", "rating", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "can_update", "(", ")", ":", "self", ".", "_tcex", ".", "handle_error", "(", "910", ",", "[", "self", ".", "type", "]", ")", "request_data", "=", "{", "'rating'", ":", ...
Updates the Indicators rating Args: value:
[ "Updates", "the", "Indicators", "rating" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py#L197-L209
train
27,452
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py
Indicator.add_observers
def add_observers(self, count, date_observed): """ Adds a Indicator Observation Args: count: date_observed: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) data = { 'count': count, 'dat...
python
def add_observers(self, count, date_observed): """ Adds a Indicator Observation Args: count: date_observed: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) data = { 'count': count, 'dat...
[ "def", "add_observers", "(", "self", ",", "count", ",", "date_observed", ")", ":", "if", "not", "self", ".", "can_update", "(", ")", ":", "self", ".", "_tcex", ".", "handle_error", "(", "910", ",", "[", "self", ".", "type", "]", ")", "data", "=", "...
Adds a Indicator Observation Args: count: date_observed:
[ "Adds", "a", "Indicator", "Observation" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py#L236-L257
train
27,453
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py
Indicator.deleted
def deleted(self, deleted_since, filters=None, params=None): """ Gets the indicators deleted. Args: params: filters: deleted_since: Date since its been deleted """ return self.tc_requests.deleted( self.api_type, self....
python
def deleted(self, deleted_since, filters=None, params=None): """ Gets the indicators deleted. Args: params: filters: deleted_since: Date since its been deleted """ return self.tc_requests.deleted( self.api_type, self....
[ "def", "deleted", "(", "self", ",", "deleted_since", ",", "filters", "=", "None", ",", "params", "=", "None", ")", ":", "return", "self", ".", "tc_requests", ".", "deleted", "(", "self", ".", "api_type", ",", "self", ".", "api_sub_type", ",", "deleted_si...
Gets the indicators deleted. Args: params: filters: deleted_since: Date since its been deleted
[ "Gets", "the", "indicators", "deleted", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py#L296-L314
train
27,454
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py
Indicator.build_summary
def build_summary(val1=None, val2=None, val3=None): """ Constructs the summary given va1, va2, val3 Args: val1: val2: val3: Returns: """ summary = [] if val1 is not None: summary.append(val1) if val2 is no...
python
def build_summary(val1=None, val2=None, val3=None): """ Constructs the summary given va1, va2, val3 Args: val1: val2: val3: Returns: """ summary = [] if val1 is not None: summary.append(val1) if val2 is no...
[ "def", "build_summary", "(", "val1", "=", "None", ",", "val2", "=", "None", ",", "val3", "=", "None", ")", ":", "summary", "=", "[", "]", "if", "val1", "is", "not", "None", ":", "summary", ".", "append", "(", "val1", ")", "if", "val2", "is", "not...
Constructs the summary given va1, va2, val3 Args: val1: val2: val3: Returns:
[ "Constructs", "the", "summary", "given", "va1", "va2", "val3" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/indicator/tcex_ti_indicator.py#L317-L338
train
27,455
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/security_label.py
SecurityLabel.name
def name(self, name): """ Updates the security labels name. Args: name: """ self._data['name'] = name request = self._base_request request['name'] = name return self._tc_requests.update(request, owner=self.owner)
python
def name(self, name): """ Updates the security labels name. Args: name: """ self._data['name'] = name request = self._base_request request['name'] = name return self._tc_requests.update(request, owner=self.owner)
[ "def", "name", "(", "self", ",", "name", ")", ":", "self", ".", "_data", "[", "'name'", "]", "=", "name", "request", "=", "self", ".", "_base_request", "request", "[", "'name'", "]", "=", "name", "return", "self", ".", "_tc_requests", ".", "update", ...
Updates the security labels name. Args: name:
[ "Updates", "the", "security", "labels", "name", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/security_label.py#L60-L70
train
27,456
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/security_label.py
SecurityLabel.color
def color(self, color): """ Updates the security labels color. Args: color: """ self._data['color'] = color request = self._base_request request['color'] = color return self._tc_requests.update(request, owner=self.owner)
python
def color(self, color): """ Updates the security labels color. Args: color: """ self._data['color'] = color request = self._base_request request['color'] = color return self._tc_requests.update(request, owner=self.owner)
[ "def", "color", "(", "self", ",", "color", ")", ":", "self", ".", "_data", "[", "'color'", "]", "=", "color", "request", "=", "self", ".", "_base_request", "request", "[", "'color'", "]", "=", "color", "return", "self", ".", "_tc_requests", ".", "updat...
Updates the security labels color. Args: color:
[ "Updates", "the", "security", "labels", "color", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/security_label.py#L72-L83
train
27,457
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/security_label.py
SecurityLabel.description
def description(self, description): """ Updates the security labels description. Args: description: """ self._data['description'] = description request = self._base_request request['description'] = description return self._tc_requests.update(r...
python
def description(self, description): """ Updates the security labels description. Args: description: """ self._data['description'] = description request = self._base_request request['description'] = description return self._tc_requests.update(r...
[ "def", "description", "(", "self", ",", "description", ")", ":", "self", ".", "_data", "[", "'description'", "]", "=", "description", "request", "=", "self", ".", "_base_request", "request", "[", "'description'", "]", "=", "description", "return", "self", "....
Updates the security labels description. Args: description:
[ "Updates", "the", "security", "labels", "description", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/security_label.py#L85-L95
train
27,458
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/security_label.py
SecurityLabel.date_added
def date_added(self, date_added): """ Updates the security labels date_added Args: date_added: Converted to %Y-%m-%dT%H:%M:%SZ date format """ date_added = self._utils.format_datetime(date_added, date_format='%Y-%m-%dT%H:%M:%SZ') self._data['dateAdded'] = da...
python
def date_added(self, date_added): """ Updates the security labels date_added Args: date_added: Converted to %Y-%m-%dT%H:%M:%SZ date format """ date_added = self._utils.format_datetime(date_added, date_format='%Y-%m-%dT%H:%M:%SZ') self._data['dateAdded'] = da...
[ "def", "date_added", "(", "self", ",", "date_added", ")", ":", "date_added", "=", "self", ".", "_utils", ".", "format_datetime", "(", "date_added", ",", "date_format", "=", "'%Y-%m-%dT%H:%M:%SZ'", ")", "self", ".", "_data", "[", "'dateAdded'", "]", "=", "dat...
Updates the security labels date_added Args: date_added: Converted to %Y-%m-%dT%H:%M:%SZ date format
[ "Updates", "the", "security", "labels", "date_added" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/security_label.py#L97-L109
train
27,459
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/group/group_types/campaign.py
Campaign.first_seen
def first_seen(self, first_seen): """ Updates the campaign with the new first_seen date. Args: first_seen: The first_seen date. Converted to %Y-%m-%dT%H:%M:%SZ date format Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self...
python
def first_seen(self, first_seen): """ Updates the campaign with the new first_seen date. Args: first_seen: The first_seen date. Converted to %Y-%m-%dT%H:%M:%SZ date format Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self...
[ "def", "first_seen", "(", "self", ",", "first_seen", ")", ":", "if", "not", "self", ".", "can_update", "(", ")", ":", "self", ".", "_tcex", ".", "handle_error", "(", "910", ",", "[", "self", ".", "type", "]", ")", "first_seen", "=", "self", ".", "_...
Updates the campaign with the new first_seen date. Args: first_seen: The first_seen date. Converted to %Y-%m-%dT%H:%M:%SZ date format Returns:
[ "Updates", "the", "campaign", "with", "the", "new", "first_seen", "date", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/group/group_types/campaign.py#L20-L36
train
27,460
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/filters.py
Filters.add_filter
def add_filter(self, filter_key, operator, value): """ Adds a filter given a key, operator, and value""" filter_key = self._metadata_map.get(filter_key, filter_key) self.filters.append({'filter': filter_key, 'operator': operator, 'value': value})
python
def add_filter(self, filter_key, operator, value): """ Adds a filter given a key, operator, and value""" filter_key = self._metadata_map.get(filter_key, filter_key) self.filters.append({'filter': filter_key, 'operator': operator, 'value': value})
[ "def", "add_filter", "(", "self", ",", "filter_key", ",", "operator", ",", "value", ")", ":", "filter_key", "=", "self", ".", "_metadata_map", ".", "get", "(", "filter_key", ",", "filter_key", ")", "self", ".", "filters", ".", "append", "(", "{", "'filte...
Adds a filter given a key, operator, and value
[ "Adds", "a", "filter", "given", "a", "key", "operator", "and", "value" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/filters.py#L22-L25
train
27,461
ThreatConnect-Inc/tcex
tcex/tcex_notification_v2.py
TcExNotificationV2.recipients
def recipients(self, notification_type, recipients, priority='Low'): """Set vars for the passed in data. Used for one or more recipient notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "is...
python
def recipients(self, notification_type, recipients, priority='Low'): """Set vars for the passed in data. Used for one or more recipient notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "is...
[ "def", "recipients", "(", "self", ",", "notification_type", ",", "recipients", ",", "priority", "=", "'Low'", ")", ":", "self", ".", "_notification_type", "=", "notification_type", "self", ".", "_recipients", "=", "recipients", "self", ".", "_priority", "=", "...
Set vars for the passed in data. Used for one or more recipient notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "isOrganization": false, "recipients": recipients } ...
[ "Set", "vars", "for", "the", "passed", "in", "data", ".", "Used", "for", "one", "or", "more", "recipient", "notification", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_notification_v2.py#L21-L41
train
27,462
ThreatConnect-Inc/tcex
tcex/tcex_notification_v2.py
TcExNotificationV2.org
def org(self, notification_type, priority='Low'): """Set vars for the passed in data. Used for org notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "isOrganization": true } ...
python
def org(self, notification_type, priority='Low'): """Set vars for the passed in data. Used for org notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "isOrganization": true } ...
[ "def", "org", "(", "self", ",", "notification_type", ",", "priority", "=", "'Low'", ")", ":", "self", ".", "_notification_type", "=", "notification_type", "self", ".", "_recipients", "=", "None", "self", ".", "_priority", "=", "priority", "self", ".", "_is_o...
Set vars for the passed in data. Used for org notification. .. code-block:: javascript { "notificationType": notification_type, "priority": priority "isOrganization": true } Args: notification_type (str): The notifica...
[ "Set", "vars", "for", "the", "passed", "in", "data", ".", "Used", "for", "org", "notification", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_notification_v2.py#L43-L61
train
27,463
ThreatConnect-Inc/tcex
tcex/tcex_notification_v2.py
TcExNotificationV2.send
def send(self, message): """Send our message Args: message (str): The message to be sent. Returns: requests.models.Response: The response from the request. """ body = { 'notificationType': self._notification_type, 'priority': sel...
python
def send(self, message): """Send our message Args: message (str): The message to be sent. Returns: requests.models.Response: The response from the request. """ body = { 'notificationType': self._notification_type, 'priority': sel...
[ "def", "send", "(", "self", ",", "message", ")", ":", "body", "=", "{", "'notificationType'", ":", "self", ".", "_notification_type", ",", "'priority'", ":", "self", ".", "_priority", ",", "'isOrganization'", ":", "self", ".", "_is_organization", ",", "'mess...
Send our message Args: message (str): The message to be sent. Returns: requests.models.Response: The response from the request.
[ "Send", "our", "message" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_notification_v2.py#L63-L105
train
27,464
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/group/group_types/adversarys.py
Adversary.assets
def assets(self, asset_type=None): """ Retrieves all of the assets of a given asset_type Args: asset_type: (str) Either None, PHONE, HANDLER, or URL Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) if not...
python
def assets(self, asset_type=None): """ Retrieves all of the assets of a given asset_type Args: asset_type: (str) Either None, PHONE, HANDLER, or URL Returns: """ if not self.can_update(): self._tcex.handle_error(910, [self.type]) if not...
[ "def", "assets", "(", "self", ",", "asset_type", "=", "None", ")", ":", "if", "not", "self", ".", "can_update", "(", ")", ":", "self", ".", "_tcex", ".", "handle_error", "(", "910", ",", "[", "self", ".", "type", "]", ")", "if", "not", "asset_type"...
Retrieves all of the assets of a given asset_type Args: asset_type: (str) Either None, PHONE, HANDLER, or URL Returns:
[ "Retrieves", "all", "of", "the", "assets", "of", "a", "given", "asset_type" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/group/group_types/adversarys.py#L79-L112
train
27,465
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/group/group_types/adversarys.py
Adversary.delete_asset
def delete_asset(self, asset_id, asset_type): """ Delete the asset with the provided asset_id. Args: asset_id: The id of the asset. asset_type: The asset type. Returns: """ return self.asset(asset_id, asset_type=asset_type, action='DELETE')
python
def delete_asset(self, asset_id, asset_type): """ Delete the asset with the provided asset_id. Args: asset_id: The id of the asset. asset_type: The asset type. Returns: """ return self.asset(asset_id, asset_type=asset_type, action='DELETE')
[ "def", "delete_asset", "(", "self", ",", "asset_id", ",", "asset_type", ")", ":", "return", "self", ".", "asset", "(", "asset_id", ",", "asset_type", "=", "asset_type", ",", "action", "=", "'DELETE'", ")" ]
Delete the asset with the provided asset_id. Args: asset_id: The id of the asset. asset_type: The asset type. Returns:
[ "Delete", "the", "asset", "with", "the", "provided", "asset_id", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/group/group_types/adversarys.py#L127-L138
train
27,466
ThreatConnect-Inc/tcex
tcex/tcex_bin_lib.py
TcExLib._build_command
def _build_command(self, python_executable, lib_dir_fq, proxy_enabled): """Build the pip command for installing dependencies. Args: python_executable (str): The fully qualified path of the Python executable. lib_dir_fq (str): The fully qualified path of the lib directory. ...
python
def _build_command(self, python_executable, lib_dir_fq, proxy_enabled): """Build the pip command for installing dependencies. Args: python_executable (str): The fully qualified path of the Python executable. lib_dir_fq (str): The fully qualified path of the lib directory. ...
[ "def", "_build_command", "(", "self", ",", "python_executable", ",", "lib_dir_fq", ",", "proxy_enabled", ")", ":", "exe_command", "=", "[", "os", ".", "path", ".", "expanduser", "(", "python_executable", ")", ",", "'-m'", ",", "'pip'", ",", "'install'", ",",...
Build the pip command for installing dependencies. Args: python_executable (str): The fully qualified path of the Python executable. lib_dir_fq (str): The fully qualified path of the lib directory. Returns: list: The Python pip command with all required args.
[ "Build", "the", "pip", "command", "for", "installing", "dependencies", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_lib.py#L46-L79
train
27,467
ThreatConnect-Inc/tcex
tcex/tcex_bin_lib.py
TcExLib._configure_proxy
def _configure_proxy(self): """Configure proxy settings using environment variables.""" if os.getenv('HTTP_PROXY') or os.getenv('HTTPS_PROXY'): # TODO: is this appropriate? # don't change proxy settings if the OS already has them configured. return True proxy...
python
def _configure_proxy(self): """Configure proxy settings using environment variables.""" if os.getenv('HTTP_PROXY') or os.getenv('HTTPS_PROXY'): # TODO: is this appropriate? # don't change proxy settings if the OS already has them configured. return True proxy...
[ "def", "_configure_proxy", "(", "self", ")", ":", "if", "os", ".", "getenv", "(", "'HTTP_PROXY'", ")", "or", "os", ".", "getenv", "(", "'HTTPS_PROXY'", ")", ":", "# TODO: is this appropriate?", "# don't change proxy settings if the OS already has them configured.", "ret...
Configure proxy settings using environment variables.
[ "Configure", "proxy", "settings", "using", "environment", "variables", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_lib.py#L81-L111
train
27,468
ThreatConnect-Inc/tcex
tcex/tcex_bin_lib.py
TcExLib._create_temp_requirements
def _create_temp_requirements(self): """Create a temporary requirements.txt. This allows testing again a git branch instead of pulling from pypi. """ self.use_temp_requirements_file = True # Replace tcex version with develop branch of tcex with open(self.requirements_fil...
python
def _create_temp_requirements(self): """Create a temporary requirements.txt. This allows testing again a git branch instead of pulling from pypi. """ self.use_temp_requirements_file = True # Replace tcex version with develop branch of tcex with open(self.requirements_fil...
[ "def", "_create_temp_requirements", "(", "self", ")", ":", "self", ".", "use_temp_requirements_file", "=", "True", "# Replace tcex version with develop branch of tcex", "with", "open", "(", "self", ".", "requirements_file", ",", "'r'", ")", "as", "fh", ":", "current_r...
Create a temporary requirements.txt. This allows testing again a git branch instead of pulling from pypi.
[ "Create", "a", "temporary", "requirements", ".", "txt", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_lib.py#L121-L142
train
27,469
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch._gen_indicator_class
def _gen_indicator_class(self): """Generate Custom Indicator Classes.""" for entry in self.tcex.indicator_types_data.values(): name = entry.get('name') class_name = name.replace(' ', '') # temp fix for API issue where boolean are returned as strings entry...
python
def _gen_indicator_class(self): """Generate Custom Indicator Classes.""" for entry in self.tcex.indicator_types_data.values(): name = entry.get('name') class_name = name.replace(' ', '') # temp fix for API issue where boolean are returned as strings entry...
[ "def", "_gen_indicator_class", "(", "self", ")", ":", "for", "entry", "in", "self", ".", "tcex", ".", "indicator_types_data", ".", "values", "(", ")", ":", "name", "=", "entry", ".", "get", "(", "'name'", ")", "class_name", "=", "name", ".", "replace", ...
Generate Custom Indicator Classes.
[ "Generate", "Custom", "Indicator", "Classes", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L115-L144
train
27,470
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch._group
def _group(self, group_data): """Return previously stored group or new group. Args: group_data (dict|obj): An Group dict or instance of Group object. Returns: dict|obj: The new Group dict/object or the previously stored dict/object. """ if isinstance(gro...
python
def _group(self, group_data): """Return previously stored group or new group. Args: group_data (dict|obj): An Group dict or instance of Group object. Returns: dict|obj: The new Group dict/object or the previously stored dict/object. """ if isinstance(gro...
[ "def", "_group", "(", "self", ",", "group_data", ")", ":", "if", "isinstance", "(", "group_data", ",", "dict", ")", ":", "# get xid from dict", "xid", "=", "group_data", ".", "get", "(", "'xid'", ")", "else", ":", "# get xid from object", "xid", "=", "grou...
Return previously stored group or new group. Args: group_data (dict|obj): An Group dict or instance of Group object. Returns: dict|obj: The new Group dict/object or the previously stored dict/object.
[ "Return", "previously", "stored", "group", "or", "new", "group", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L175-L200
train
27,471
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch._indicator
def _indicator(self, indicator_data): """Return previously stored indicator or new indicator. Args: indicator_data (dict|obj): An Indicator dict or instance of Indicator object. Returns: dict|obj: The new Indicator dict/object or the previously stored dict/object. ...
python
def _indicator(self, indicator_data): """Return previously stored indicator or new indicator. Args: indicator_data (dict|obj): An Indicator dict or instance of Indicator object. Returns: dict|obj: The new Indicator dict/object or the previously stored dict/object. ...
[ "def", "_indicator", "(", "self", ",", "indicator_data", ")", ":", "if", "isinstance", "(", "indicator_data", ",", "dict", ")", ":", "# get xid from dict", "xid", "=", "indicator_data", ".", "get", "(", "'xid'", ")", "else", ":", "# get xid from object", "xid"...
Return previously stored indicator or new indicator. Args: indicator_data (dict|obj): An Indicator dict or instance of Indicator object. Returns: dict|obj: The new Indicator dict/object or the previously stored dict/object.
[ "Return", "previously", "stored", "indicator", "or", "new", "indicator", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L202-L228
train
27,472
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.add_indicator
def add_indicator(self, indicator_data): """Add an indicator to Batch Job. .. code-block:: javascript { "type": "File", "rating": 5.00, "confidence": 50, "summary": "53c3609411c83f363e051d455ade78a7 ...
python
def add_indicator(self, indicator_data): """Add an indicator to Batch Job. .. code-block:: javascript { "type": "File", "rating": 5.00, "confidence": 50, "summary": "53c3609411c83f363e051d455ade78a7 ...
[ "def", "add_indicator", "(", "self", ",", "indicator_data", ")", ":", "if", "indicator_data", ".", "get", "(", "'type'", ")", "not", "in", "[", "'Address'", ",", "'EmailAddress'", ",", "'File'", ",", "'Host'", ",", "'URL'", "]", ":", "# for custom indicator ...
Add an indicator to Batch Job. .. code-block:: javascript { "type": "File", "rating": 5.00, "confidence": 50, "summary": "53c3609411c83f363e051d455ade78a7 : 57a49b478310e4313c54c0fee46e4d70a73dd580 ...
[ "Add", "an", "indicator", "to", "Batch", "Job", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L301-L357
train
27,473
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.address
def address(self, ip, **kwargs): """Add Address data to Batch object. Args: ip (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
def address(self, ip, **kwargs): """Add Address data to Batch object. Args: ip (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
[ "def", "address", "(", "self", ",", "ip", ",", "*", "*", "kwargs", ")", ":", "indicator_obj", "=", "Address", "(", "ip", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_indicator", "(", "indicator_obj", ")" ]
Add Address data to Batch object. Args: ip (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. last_modified (str, kwargs): The date times...
[ "Add", "Address", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L359-L374
train
27,474
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.adversary
def adversary(self, name, **kwargs): """Add Adversary data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns: ...
python
def adversary(self, name, **kwargs): """Add Adversary data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns: ...
[ "def", "adversary", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Adversary", "(", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Adversary data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns: obj: An instance of Adversary.
[ "Add", "Adversary", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L376-L388
train
27,475
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.asn
def asn(self, as_number, **kwargs): """Add ASN data to Batch object. Args: as_number (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
def asn(self, as_number, **kwargs): """Add ASN data to Batch object. Args: as_number (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
[ "def", "asn", "(", "self", ",", "as_number", ",", "*", "*", "kwargs", ")", ":", "indicator_obj", "=", "ASN", "(", "as_number", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_indicator", "(", "indicator_obj", ")" ]
Add ASN data to Batch object. Args: as_number (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. last_modified (str, kwargs): The date ti...
[ "Add", "ASN", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L390-L405
train
27,476
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.campaign
def campaign(self, name, **kwargs): """Add Campaign data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. first_seen (str, kwargs): The first seen datetime expression for this Group. ...
python
def campaign(self, name, **kwargs): """Add Campaign data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. first_seen (str, kwargs): The first seen datetime expression for this Group. ...
[ "def", "campaign", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Campaign", "(", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Campaign data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. first_seen (str, kwargs): The first seen datetime expression for this Group. xid (str, kwargs): The external id f...
[ "Add", "Campaign", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L417-L430
train
27,477
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.cidr
def cidr(self, block, **kwargs): """Add CIDR data to Batch object. Args: block (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
def cidr(self, block, **kwargs): """Add CIDR data to Batch object. Args: block (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. ...
[ "def", "cidr", "(", "self", ",", "block", ",", "*", "*", "kwargs", ")", ":", "indicator_obj", "=", "CIDR", "(", "block", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_indicator", "(", "indicator_obj", ")" ]
Add CIDR data to Batch object. Args: block (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp the Indicator was created. last_modified (str, kwargs): The date times...
[ "Add", "CIDR", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L432-L447
train
27,478
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.close
def close(self): """Cleanup batch job.""" self.groups_shelf.close() self.indicators_shelf.close() if self.debug and self.enable_saved_file: fqfn = os.path.join(self.tcex.args.tc_temp_path, 'xids-saved') if os.path.isfile(fqfn): os.remove(fqfn) # r...
python
def close(self): """Cleanup batch job.""" self.groups_shelf.close() self.indicators_shelf.close() if self.debug and self.enable_saved_file: fqfn = os.path.join(self.tcex.args.tc_temp_path, 'xids-saved') if os.path.isfile(fqfn): os.remove(fqfn) # r...
[ "def", "close", "(", "self", ")", ":", "self", ".", "groups_shelf", ".", "close", "(", ")", "self", ".", "indicators_shelf", ".", "close", "(", ")", "if", "self", ".", "debug", "and", "self", ".", "enable_saved_file", ":", "fqfn", "=", "os", ".", "pa...
Cleanup batch job.
[ "Cleanup", "batch", "job", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L449-L465
train
27,479
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.data
def data(self): """Return the batch data to be sent to the ThreatConnect API. **Processing Order:** * Process groups in memory up to max batch size. * Process groups in shelf to max batch size. * Process indicators in memory up to max batch size. * Process indicators in ...
python
def data(self): """Return the batch data to be sent to the ThreatConnect API. **Processing Order:** * Process groups in memory up to max batch size. * Process groups in shelf to max batch size. * Process indicators in memory up to max batch size. * Process indicators in ...
[ "def", "data", "(", "self", ")", ":", "entity_count", "=", "0", "data", "=", "{", "'group'", ":", "[", "]", ",", "'indicator'", ":", "[", "]", "}", "# process group data", "group_data", ",", "entity_count", "=", "self", ".", "data_groups", "(", "self", ...
Return the batch data to be sent to the ThreatConnect API. **Processing Order:** * Process groups in memory up to max batch size. * Process groups in shelf to max batch size. * Process indicators in memory up to max batch size. * Process indicators in shelf up to max batch size....
[ "Return", "the", "batch", "data", "to", "be", "sent", "to", "the", "ThreatConnect", "API", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L468-L500
train
27,480
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.data_group_association
def data_group_association(self, xid): """Return group dict array following all associations. Args: xid (str): The xid of the group to retrieve associations. Returns: list: A list of group dicts. """ groups = [] group_data = None # get g...
python
def data_group_association(self, xid): """Return group dict array following all associations. Args: xid (str): The xid of the group to retrieve associations. Returns: list: A list of group dicts. """ groups = [] group_data = None # get g...
[ "def", "data_group_association", "(", "self", ",", "xid", ")", ":", "groups", "=", "[", "]", "group_data", "=", "None", "# get group data from one of the arrays", "if", "self", ".", "groups", ".", "get", "(", "xid", ")", "is", "not", "None", ":", "group_data...
Return group dict array following all associations. Args: xid (str): The xid of the group to retrieve associations. Returns: list: A list of group dicts.
[ "Return", "group", "dict", "array", "following", "all", "associations", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L502-L531
train
27,481
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.data_group_type
def data_group_type(self, group_data): """Return dict representation of group data. Args: group_data (dict|obj): The group data dict or object. Returns: dict: The group data in dict format. """ if isinstance(group_data, dict): # process file ...
python
def data_group_type(self, group_data): """Return dict representation of group data. Args: group_data (dict|obj): The group data dict or object. Returns: dict: The group data in dict format. """ if isinstance(group_data, dict): # process file ...
[ "def", "data_group_type", "(", "self", ",", "group_data", ")", ":", "if", "isinstance", "(", "group_data", ",", "dict", ")", ":", "# process file content", "file_content", "=", "group_data", ".", "pop", "(", "'fileContent'", ",", "None", ")", "if", "file_conte...
Return dict representation of group data. Args: group_data (dict|obj): The group data dict or object. Returns: dict: The group data in dict format.
[ "Return", "dict", "representation", "of", "group", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L533-L556
train
27,482
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.data_groups
def data_groups(self, groups, entity_count): """Process Group data. Args: groups (list): The list of groups to process. Returns: list: A list of groups including associations """ data = [] # process group objects for xid in groups.keys():...
python
def data_groups(self, groups, entity_count): """Process Group data. Args: groups (list): The list of groups to process. Returns: list: A list of groups including associations """ data = [] # process group objects for xid in groups.keys():...
[ "def", "data_groups", "(", "self", ",", "groups", ",", "entity_count", ")", ":", "data", "=", "[", "]", "# process group objects", "for", "xid", "in", "groups", ".", "keys", "(", ")", ":", "# get association from group data", "assoc_group_data", "=", "self", "...
Process Group data. Args: groups (list): The list of groups to process. Returns: list: A list of groups including associations
[ "Process", "Group", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L558-L577
train
27,483
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.data_indicators
def data_indicators(self, indicators, entity_count): """Process Indicator data.""" data = [] # process indicator objects for xid, indicator_data in indicators.items(): entity_count += 1 if isinstance(indicator_data, dict): data.append(indicator_dat...
python
def data_indicators(self, indicators, entity_count): """Process Indicator data.""" data = [] # process indicator objects for xid, indicator_data in indicators.items(): entity_count += 1 if isinstance(indicator_data, dict): data.append(indicator_dat...
[ "def", "data_indicators", "(", "self", ",", "indicators", ",", "entity_count", ")", ":", "data", "=", "[", "]", "# process indicator objects", "for", "xid", ",", "indicator_data", "in", "indicators", ".", "items", "(", ")", ":", "entity_count", "+=", "1", "i...
Process Indicator data.
[ "Process", "Indicator", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L579-L592
train
27,484
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.debug
def debug(self): """Return debug setting""" debug = False if os.path.isfile(os.path.join(self.tcex.args.tc_temp_path, 'DEBUG')): debug = True return debug
python
def debug(self): """Return debug setting""" debug = False if os.path.isfile(os.path.join(self.tcex.args.tc_temp_path, 'DEBUG')): debug = True return debug
[ "def", "debug", "(", "self", ")", ":", "debug", "=", "False", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "self", ".", "tcex", ".", "args", ".", "tc_temp_path", ",", "'DEBUG'", ")", ")", ":", "debug", "=", ...
Return debug setting
[ "Return", "debug", "setting" ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L595-L600
train
27,485
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.document
def document(self, name, file_name, **kwargs): """Add Document data to Batch object. Args: name (str): The name for this Group. file_name (str): The name for the attached file for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. ...
python
def document(self, name, file_name, **kwargs): """Add Document data to Batch object. Args: name (str): The name for this Group. file_name (str): The name for the attached file for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. ...
[ "def", "document", "(", "self", ",", "name", ",", "file_name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Document", "(", "name", ",", "file_name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Document data to Batch object. Args: name (str): The name for this Group. file_name (str): The name for the attached file for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. file_content (str;method, kwargs): The file conte...
[ "Add", "Document", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L602-L619
train
27,486
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.email
def email(self, name, subject, header, body, **kwargs): """Add Email data to Batch object. Args: name (str): The name for this Group. subject (str): The subject for this Email. header (str): The header for this Email. body (str): The body for this Email. ...
python
def email(self, name, subject, header, body, **kwargs): """Add Email data to Batch object. Args: name (str): The name for this Group. subject (str): The subject for this Email. header (str): The header for this Email. body (str): The body for this Email. ...
[ "def", "email", "(", "self", ",", "name", ",", "subject", ",", "header", ",", "body", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Email", "(", "name", ",", "subject", ",", "header", ",", "body", ",", "*", "*", "kwargs", ")", "return", "...
Add Email data to Batch object. Args: name (str): The name for this Group. subject (str): The subject for this Email. header (str): The header for this Email. body (str): The body for this Email. date_added (str, kwargs): The date timestamp the Indica...
[ "Add", "Email", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L621-L638
train
27,487
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.errors
def errors(self, batch_id, halt_on_error=True): """Retrieve Batch errors to ThreatConnect API. .. code-block:: javascript [{ "errorReason": "Incident incident-001 has an invalid status.", "errorSource": "incident-001 is not valid." }, { ...
python
def errors(self, batch_id, halt_on_error=True): """Retrieve Batch errors to ThreatConnect API. .. code-block:: javascript [{ "errorReason": "Incident incident-001 has an invalid status.", "errorSource": "incident-001 is not valid." }, { ...
[ "def", "errors", "(", "self", ",", "batch_id", ",", "halt_on_error", "=", "True", ")", ":", "errors", "=", "[", "]", "try", ":", "r", "=", "self", ".", "tcex", ".", "session", ".", "get", "(", "'/v2/batch/{}/errors'", ".", "format", "(", "batch_id", ...
Retrieve Batch errors to ThreatConnect API. .. code-block:: javascript [{ "errorReason": "Incident incident-001 has an invalid status.", "errorSource": "incident-001 is not valid." }, { "errorReason": "Incident incident-002 has an invalid...
[ "Retrieve", "Batch", "errors", "to", "ThreatConnect", "API", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L657-L698
train
27,488
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.event
def event(self, name, **kwargs): """Add Event data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
python
def event(self, name, **kwargs): """Add Event data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
[ "def", "event", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Event", "(", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Event data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. status (str, kwargs): The status for this Gr...
[ "Add", "Event", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L700-L714
train
27,489
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.file
def file(self, md5=None, sha1=None, sha256=None, **kwargs): """Add File data to Batch object. .. note:: A least one file hash value must be specified. Args: md5 (str, optional): The md5 value for this Indicator. sha1 (str, optional): The sha1 value for this Indicator. ...
python
def file(self, md5=None, sha1=None, sha256=None, **kwargs): """Add File data to Batch object. .. note:: A least one file hash value must be specified. Args: md5 (str, optional): The md5 value for this Indicator. sha1 (str, optional): The sha1 value for this Indicator. ...
[ "def", "file", "(", "self", ",", "md5", "=", "None", ",", "sha1", "=", "None", ",", "sha256", "=", "None", ",", "*", "*", "kwargs", ")", ":", "indicator_obj", "=", "File", "(", "md5", ",", "sha1", ",", "sha256", ",", "*", "*", "kwargs", ")", "r...
Add File data to Batch object. .. note:: A least one file hash value must be specified. Args: md5 (str, optional): The md5 value for this Indicator. sha1 (str, optional): The sha1 value for this Indicator. sha256 (str, optional): The sha256 value for this Indicator....
[ "Add", "File", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L716-L737
train
27,490
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.generate_xid
def generate_xid(identifier=None): """Generate xid from provided identifiers. .. Important:: If no identifier is provided a unique xid will be returned, but it will not be reproducible. If a list of identifiers are provided they must be in the same order...
python
def generate_xid(identifier=None): """Generate xid from provided identifiers. .. Important:: If no identifier is provided a unique xid will be returned, but it will not be reproducible. If a list of identifiers are provided they must be in the same order...
[ "def", "generate_xid", "(", "identifier", "=", "None", ")", ":", "if", "identifier", "is", "None", ":", "identifier", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "elif", "isinstance", "(", "identifier", ",", "list", ")", ":", "identifier", "=...
Generate xid from provided identifiers. .. Important:: If no identifier is provided a unique xid will be returned, but it will not be reproducible. If a list of identifiers are provided they must be in the same order to generate a reproducible xid. Args...
[ "Generate", "xid", "from", "provided", "identifiers", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L753-L770
train
27,491
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.group
def group(self, group_type, name, **kwargs): """Add Group data to Batch object. Args: group_type (str): The ThreatConnect define Group type. name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (...
python
def group(self, group_type, name, **kwargs): """Add Group data to Batch object. Args: group_type (str): The ThreatConnect define Group type. name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (...
[ "def", "group", "(", "self", ",", "group_type", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Group", "(", "group_type", ",", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Group data to Batch object. Args: group_type (str): The ThreatConnect define Group type. name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. R...
[ "Add", "Group", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L772-L785
train
27,492
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.group_shelf_fqfn
def group_shelf_fqfn(self): """Return groups shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._group_shelf_fqfn is None: # new shelf file ...
python
def group_shelf_fqfn(self): """Return groups shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._group_shelf_fqfn is None: # new shelf file ...
[ "def", "group_shelf_fqfn", "(", "self", ")", ":", "if", "self", ".", "_group_shelf_fqfn", "is", "None", ":", "# new shelf file", "self", ".", "_group_shelf_fqfn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tcex", ".", "args", ".", "tc_temp_pat...
Return groups shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file.
[ "Return", "groups", "shelf", "fully", "qualified", "filename", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L788-L803
train
27,493
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.groups_shelf
def groups_shelf(self): """Return dictionary of all Groups data.""" if self._groups_shelf is None: self._groups_shelf = shelve.open(self.group_shelf_fqfn, writeback=False) return self._groups_shelf
python
def groups_shelf(self): """Return dictionary of all Groups data.""" if self._groups_shelf is None: self._groups_shelf = shelve.open(self.group_shelf_fqfn, writeback=False) return self._groups_shelf
[ "def", "groups_shelf", "(", "self", ")", ":", "if", "self", ".", "_groups_shelf", "is", "None", ":", "self", ".", "_groups_shelf", "=", "shelve", ".", "open", "(", "self", ".", "group_shelf_fqfn", ",", "writeback", "=", "False", ")", "return", "self", "....
Return dictionary of all Groups data.
[ "Return", "dictionary", "of", "all", "Groups", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L814-L818
train
27,494
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.incident
def incident(self, name, **kwargs): """Add Incident data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
python
def incident(self, name, **kwargs): """Add Incident data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. ...
[ "def", "incident", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "Incident", "(", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Incident data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. event_date (str, kwargs): The event datetime expression for this Group. status (str, kwargs): The status for this...
[ "Add", "Incident", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L891-L905
train
27,495
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.indicator
def indicator(self, indicator_type, summary, **kwargs): """Add Indicator data to Batch object. Args: indicator_type (str): The ThreatConnect define Indicator type. summary (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this I...
python
def indicator(self, indicator_type, summary, **kwargs): """Add Indicator data to Batch object. Args: indicator_type (str): The ThreatConnect define Indicator type. summary (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this I...
[ "def", "indicator", "(", "self", ",", "indicator_type", ",", "summary", ",", "*", "*", "kwargs", ")", ":", "indicator_obj", "=", "Indicator", "(", "indicator_type", ",", "summary", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_indicator", "(", "...
Add Indicator data to Batch object. Args: indicator_type (str): The ThreatConnect define Indicator type. summary (str): The value for this Indicator. confidence (str, kwargs): The threat confidence for this Indicator. date_added (str, kwargs): The date timestamp ...
[ "Add", "Indicator", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L907-L923
train
27,496
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.indicator_shelf_fqfn
def indicator_shelf_fqfn(self): """Return indicator shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._indicator_shelf_fqfn is None: # new shelf ...
python
def indicator_shelf_fqfn(self): """Return indicator shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file. """ if self._indicator_shelf_fqfn is None: # new shelf ...
[ "def", "indicator_shelf_fqfn", "(", "self", ")", ":", "if", "self", ".", "_indicator_shelf_fqfn", "is", "None", ":", "# new shelf file", "self", ".", "_indicator_shelf_fqfn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tcex", ".", "args", ".", ...
Return indicator shelf fully qualified filename. For testing/debugging a previous shelf file can be copied into the tc_temp_path directory instead of creating a new shelf file.
[ "Return", "indicator", "shelf", "fully", "qualified", "filename", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L926-L943
train
27,497
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.indicators_shelf
def indicators_shelf(self): """Return dictionary of all Indicator data.""" if self._indicators_shelf is None: self._indicators_shelf = shelve.open(self.indicator_shelf_fqfn, writeback=False) return self._indicators_shelf
python
def indicators_shelf(self): """Return dictionary of all Indicator data.""" if self._indicators_shelf is None: self._indicators_shelf = shelve.open(self.indicator_shelf_fqfn, writeback=False) return self._indicators_shelf
[ "def", "indicators_shelf", "(", "self", ")", ":", "if", "self", ".", "_indicators_shelf", "is", "None", ":", "self", ".", "_indicators_shelf", "=", "shelve", ".", "open", "(", "self", ".", "indicator_shelf_fqfn", ",", "writeback", "=", "False", ")", "return"...
Return dictionary of all Indicator data.
[ "Return", "dictionary", "of", "all", "Indicator", "data", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L954-L958
train
27,498
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.intrusion_set
def intrusion_set(self, name, **kwargs): """Add Intrusion Set data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns:...
python
def intrusion_set(self, name, **kwargs): """Add Intrusion Set data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns:...
[ "def", "intrusion_set", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "group_obj", "=", "IntrusionSet", "(", "name", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_group", "(", "group_obj", ")" ]
Add Intrusion Set data to Batch object. Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns: obj: An instance of IntrusionSet.
[ "Add", "Intrusion", "Set", "data", "to", "Batch", "object", "." ]
dd4d7a1ef723af1561687120191886b9a2fd4b47
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L960-L972
train
27,499