Search is not available for this dataset
text stringlengths 75 104k |
|---|
def pub(self, topic=b'', embed_topic=False):
"""
Returns a callable that can be used to transmit a message, with a given
``topic``, in a publisher-subscriber fashion. Note that the sender
function has a ``print`` like signature, with an infinite number of
arguments. Each one bein... |
def sub(self, topics=(b'',)):
"""
Returns an iterable that can be used to iterate over incoming messages,
that were published with one of the topics specified in ``topics``. Note
that the iterable returns as many parts as sent by subscribed publishers.
:param topics: a list of t... |
def push(self):
"""
Returns a callable that can be used to transmit a message in a push-pull
fashion. Note that the sender function has a ``print`` like signature,
with an infinite number of arguments. Each one being a part of the
complete message.
:rtype: function
... |
def pull(self):
"""
Returns an iterable that can be used to iterate over incoming messages,
that were pushed by a push socket. Note that the iterable returns as
many parts as sent by pushers.
:rtype: generator
"""
sock = self.__sock(zmq.PULL)
return self.... |
def request(self):
"""
Returns a callable and an iterable respectively. Those can be used to
both transmit a message and/or iterate over incoming messages,
that were replied by a reply socket. Note that the iterable returns
as many parts as sent by repliers. Also, the sender func... |
def reply(self):
"""
Returns a callable and an iterable respectively. Those can be used to
both transmit a message and/or iterate over incoming messages,
that were requested by a request socket. Note that the iterable returns
as many parts as sent by requesters. Also, the sender ... |
def pair(self):
"""
Returns a callable and an iterable respectively. Those can be used to
both transmit a message and/or iterate over incoming messages, that were
sent by a pair socket. Note that the iterable returns as many parts as
sent by a pair. Also, the sender function has ... |
def connect(self, ip, port):
"""
Connects to a server at the specified ip and port.
:param ip: an IP address
:type ip: str or unicode
:param port: port number from 1024 up to 65535
:type port: int
:rtype: self
"""
_check_valid_port_range(port)
... |
def disconnect(self, ip, port):
"""
Disconnects from a server at the specified ip and port.
:param ip: an IP address
:type ip: str or unicode
:param port: port number from 1024 up to 65535
:type port: int
:rtype: self
"""
_check_valid_port_range(p... |
def disconnect_all(self):
"""
Disconnects from all connected servers.
:rtype: self
"""
addresses = deepcopy(self._addresses)
for ip, port in addresses:
self.disconnect(ip, port)
return self |
def remove_exponent(d):
"""Remove exponent."""
return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize() |
def millify(n, precision=0, drop_nulls=True, prefixes=[]):
"""Humanize number."""
millnames = ['', 'k', 'M', 'B', 'T', 'P', 'E', 'Z', 'Y']
if prefixes:
millnames = ['']
millnames.extend(prefixes)
n = float(n)
millidx = max(0, min(len(millnames) - 1,
int(math.... |
def prettify(amount, separator=','):
"""Separate with predefined separator."""
orig = str(amount)
new = re.sub("^(-?\d+)(\d{3})", "\g<1>{0}\g<2>".format(separator), str(amount))
if orig == new:
return new
else:
return prettify(new) |
def load_json(json_data, decoder=None):
"""
Load data from json string
:param json_data: Stringified json object
:type json_data: str | unicode
:param decoder: Use custom json decoder
:type decoder: T <= DateTimeDecoder
:return: Json data
:rtype: None | int | float | str | list | dict
... |
def load_json_file(file, decoder=None):
"""
Load data from json file
:param file: Readable object or path to file
:type file: FileIO | str
:param decoder: Use custom json decoder
:type decoder: T <= DateTimeDecoder
:return: Json data
:rtype: None | int | float | str | list | dict
""... |
def save_json(val, pretty=False, sort=True, encoder=None):
"""
Save data to json string
:param val: Value or struct to save
:type val: None | int | float | str | list | dict
:param pretty: Format data to be readable (default: False)
otherwise going to be compact
:type pretty... |
def save_json_file(
file, val,
pretty=False, compact=True, sort=True, encoder=None
):
"""
Save data to json file
:param file: Writable object or path to file
:type file: FileIO | str | unicode
:param val: Value or struct to save
:type val: None | int | float | str | list | dict
... |
def load_yaml_file(file):
"""
Load data from yaml file
:param file: Readable object or path to file
:type file: FileIO | str | unicode
:return: Yaml data
:rtype: None | int | float | str | unicode | list | dict
"""
if not hasattr(file, "read"):
with io.open(file, "r", encoding="... |
def save_yaml_file(file, val):
"""
Save data to yaml file
:param file: Writable object or path to file
:type file: FileIO | str | unicode
:param val: Value or struct to save
:type val: None | int | float | str | unicode | list | dict
"""
opened = False
if not hasattr(file, "write")... |
def load_file(path):
"""
Load file
:param path: Path to file
:type path: str | unicode
:return: Loaded data
:rtype: None | int | float | str | unicode | list | dict
:raises IOError: If file not found or error accessing file
"""
res = {}
if not path:
IOError("No path spe... |
def save_file(path, data, readable=False):
"""
Save to file
:param path: File path to save
:type path: str | unicode
:param data: Data to save
:type data: None | int | float | str | unicode | list | dict
:param readable: Format file to be human readable (default: False)
:type readable: ... |
def join_path_prefix(path, pre_path=None):
"""
If path set and not absolute, append it to pre path (if used)
:param path: path to append
:type path: str | None
:param pre_path: Base path to append to (default: None)
:type pre_path: None | str
:return: Path or appended path
:rtype: str |... |
def _load_json_file(self, file, decoder=None):
"""
Load data from json file
:param file: Readable file or path to file
:type file: FileIO | str | unicode
:param decoder: Use custom json decoder
:type decoder: T <= flotils.loadable.DateTimeDecoder
:return: Json da... |
def _save_json_file(
self, file, val,
pretty=False, compact=True, sort=True, encoder=None
):
"""
Save data to json file
:param file: Writable file or path to file
:type file: FileIO | str | unicode
:param val: Value or struct to save
:type val: None |... |
def _load_yaml_file(self, file):
"""
Load data from yaml file
:param file: Readable object or path to file
:type file: FileIO | str | unicode
:return: Yaml data
:rtype: None | int | float | str | unicode | list | dict
:raises IOError: Failed to load
"""
... |
def _save_yaml_file(self, file, val):
"""
Save data to yaml file
:param file: Writable object or path to file
:type file: FileIO | str | unicode
:param val: Value or struct to save
:type val: None | int | float | str | unicode | list | dict
:raises IOError: Faile... |
def load_settings(self, path):
"""
Load settings dict
:param path: Path to settings file
:type path: str | unicode
:return: Loaded settings
:rtype: dict
:raises IOError: If file not found or error accessing file
:raises TypeError: Settings file does not c... |
def save_settings(self, path, settings, readable=False):
"""
Save settings to file
:param path: File path to save
:type path: str | unicode
:param settings: Settings to save
:type settings: dict
:param readable: Format file to be human readable (default: False)
... |
def load_file(self, path):
"""
Load file
:param path: Path to file
:type path: str | unicode
:return: Loaded settings
:rtype: None | str | unicode | int | list | dict
:raises IOError: If file not found or error accessing file
"""
res = None
... |
def save_file(self, path, data, readable=False):
"""
Save to file
:param path: File path to save
:type path: str | unicode
:param data: To save
:type data: None | str | unicode | int | list | dict
:param readable: Format file to be human readable (default: False)... |
def name(self):
"""
Get the module name
:return: Module name
:rtype: str | unicode
"""
res = type(self).__name__
if self._id:
res += ".{}".format(self._id)
return res |
def _get_function_name(self):
"""
Get function name of calling method
:return: The name of the calling function
(expected to be called in self.error/debug/..)
:rtype: str | unicode
"""
fname = inspect.getframeinfo(inspect.stack()[2][0]).function
if fn... |
def start(self, blocking=False):
"""
Start the interface
:param blocking: Should the call block until stop() is called
(default: False)
:type blocking: bool
:rtype: None
"""
super(StartStopable, self).start()
self._is_running = True
# ... |
def get_embedded_yara(self, iocid):
"""
Extract YARA signatures embedded in Yara/Yara indicatorItem nodes.
This is done regardless of logic structure in the OpenIOC.
"""
ioc_obj = self.iocs[iocid]
ids_to_process = set([])
signatures = ''
for elem in ioc_ob... |
def get_yara_condition_string(self, indicator_node, parameters_node, ids_to_process, condition_string='',
joining_value='or'):
"""
get_yara_condition_string
input
indicator_node: this is the node we walk down
parameters_node: this contai... |
def write_yara(self, output_file):
"""
Write out yara signatures to a file.
"""
fout = open(output_file, 'wb')
fout.write('\n')
for iocid in self.yara_signatures:
signature = self.yara_signatures[iocid]
fout.write(signature)
fout.write... |
def safe_makedirs(fdir):
"""
Make an arbitrary directory. This is safe to call for Python 2 users.
:param fdir: Directory path to make.
:return:
"""
if os.path.isdir(fdir):
pass
# print 'dir already exists: %s' % str(dir)
else:
try:
os.makedirs(fdir)
... |
def convert_to_10(self):
"""
converts the iocs in self.iocs from openioc 1.1 to openioc 1.0 format.
the converted iocs are stored in the dictionary self.iocs_10
:return: A list of iocid values which had errors downgrading.
"""
if len(self) < 1:
log.error('no i... |
def convert_branch(self, old_node, new_node, ids_to_skip, comment_dict=None):
"""
Recursively walk a indicator logic tree, starting from a Indicator node.
Converts OpenIOC 1.1 Indicator/IndicatorItems to Openioc 1.0 and preserves order.
:param old_node: An Indicator node, which we walk... |
def write_iocs(self, directory=None, source=None):
"""
Serializes IOCs to a directory.
:param directory: Directory to write IOCs to. If not provided, the current working directory is used.
:param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.iocs_10. This is not... |
def write_pruned_iocs(self, directory=None, pruned_source=None):
"""
Writes IOCs to a directory that have been pruned of some or all IOCs.
:param directory: Directory to write IOCs to. If not provided, the current working directory is used.
:param pruned_source: Iterable containing a s... |
def make_dnsentryitem_recordname(dns_name, condition='contains', negate=False, preserve_case=False):
"""
Create a node for DnsEntryItem/RecordName
:return: A IndicatorItem represented as an Element node
"""
document = 'DnsEntryItem'
search = 'DnsEntryItem/RecordName'
content_type = 'str... |
def make_driveritem_deviceitem_devicename(device_name, condition='is', negate=False, preserve_case=False):
"""
Create a node for DriverItem/DeviceItem/DeviceName
:return: A IndicatorItem represented as an Element node
"""
document = 'DriverItem'
search = 'DriverItem/DeviceItem/DeviceName'
... |
def make_driveritem_drivername(driver_name, condition='contains', negate=False, preserve_case=False):
"""
Create a node for DriverItem/DriverName
:return: A IndicatorItem represented as an Element node
"""
document = 'DriverItem'
search = 'DriverItem/DriverName'
content_type = 'string'
... |
def make_eventlogitem_eid(eid, condition='is', negate=False):
"""
Create a node for EventLogItem/EID
:return: A IndicatorItem represented as an Element node
"""
document = 'EventLogItem'
search = 'EventLogItem/EID'
content_type = 'int'
content = eid
ii_node = ioc_api.make_indica... |
def make_eventlogitem_log(log, condition='is', negate=False, preserve_case=False):
"""
Create a node for EventLogItem/log
:return: A IndicatorItem represented as an Element node
"""
document = 'EventLogItem'
search = 'EventLogItem/log'
content_type = 'string'
content = log
ii_no... |
def make_eventlogitem_message(message, condition='contains', negate=False, preserve_case=False):
"""
Create a node for EventLogItem/message
:return: A IndicatorItem represented as an Element node
"""
document = 'EventLogItem'
search = 'EventLogItem/message'
content_type = 'string'
c... |
def make_fileitem_fileattributes(attributes, condition='contains', negate=False, preserve_case=False):
"""
Create a node for FileItem/FileAttributes
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FileAttributes'
content_type = 'strin... |
def make_fileitem_fileextension(extension, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/FileExtension
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FileExtension'
content_type = 'string'
con... |
def make_fileitem_filename(filename, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/FileName
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FileName'
content_type = 'string'
content = filename
... |
def make_fileitem_filepath(filepath, condition='contains', negate=False, preserve_case=False):
"""
Create a node for FileItem/FilePath
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FilePath'
content_type = 'string'
content = fil... |
def make_fileitem_fullpath(fullpath, condition='contains', negate=False, preserve_case=False):
"""
Create a node for FileItem/FullPath
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FullPath'
content_type = 'string'
content = ful... |
def make_fileitem_md5sum(md5, condition='is', negate=False):
"""
Create a node for FileItem/Md5sum
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/Md5sum'
content_type = 'md5'
content = md5
ii_node = ioc_api.make_indicatoritem... |
def make_fileitem_peinfo_detectedanomalies_string(anomaly, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/PEInfo/DetectedAnomalies/string
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/DetectedA... |
def make_fileitem_peinfo_detectedentrypointsignature_name(entrypoint_name, condition='is', negate=False,
preserve_case=False):
"""
Create a node for FileItem/PEInfo/DetectedEntryPointSignature/Name
:return: A IndicatorItem represented as an Elem... |
def make_fileitem_peinfo_digitalsignature_signatureexists(sig_exists, condition='is', negate=False):
"""
Create a node for FileItem/PEInfo/DigitalSignature/SignatureExists
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/DigitalSign... |
def make_fileitem_peinfo_digitalsignature_signatureverified(sig_verified, condition='is', negate=False):
"""
Create a node for FileItem/PEInfo/DigitalSignature/SignatureVerified
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/Digit... |
def make_fileitem_peinfo_exports_dllname(dll_name, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/PEInfo/Exports/DllName
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/Exports/DllName'
conte... |
def make_fileitem_peinfo_exports_numberoffunctions(function_count, condition='is', negate=False):
"""
Create a node for FileItem/PEInfo/Exports/NumberOfFunctions
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/Exports/NumberOfFunct... |
def make_fileitem_peinfo_importedmodules_module_importedfunctions_string(imported_function, condition='is',
negate=False, preserve_case=False):
"""
Create a node for FileItem/PEInfo/ImportedModules/Module/ImportedFunctions/string
... |
def make_fileitem_peinfo_importedmodules_module_name(imported_module, condition='is', negate=False,
preserve_case=False):
"""
Create a node for FileItem/PEInfo/ImportedModules/Module/Name
:return: A IndicatorItem represented as an Element node
""... |
def make_fileitem_peinfo_petimestamp(compile_time, condition='is', negate=False):
"""
Create a node for FileItem/PEInfo/PETimeStamp
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/PETimeStamp'
content_type = 'date'
content ... |
def make_fileitem_peinfo_resourceinfolist_resourceinfoitem_name(resource_name, condition='is', negate=False,
preserve_case=False):
"""
Create a node for FileItem/PEInfo/ResourceInfoList/ResourceInfoItem/Name
:return: A IndicatorItem repres... |
def make_fileitem_peinfo_type(petype, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/PEInfo/Type
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/PEInfo/Type'
content_type = 'string'
content = pe... |
def make_fileitem_sizeinbytes(filesize, condition='is', negate=False):
"""
Create a node for FileItem/SizeInBytes
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/SizeInBytes'
content_type = 'int'
content = filesize
ii_node = i... |
def make_fileitem_streamlist_stream_name(stream_name, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/StreamList/Stream/Name
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/StreamList/Stream/Name'
co... |
def make_fileitem_stringlist_string(file_string, condition='contains', negate=False, preserve_case=False):
"""
Create a node for FileItem/StringList/string
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/StringList/string'
content_typ... |
def make_fileitem_username(file_owner, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/Username
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/Username'
content_type = 'string'
content = file_ow... |
def make_hookitem_hookedfunction(hooked_function, condition='is', negate=False, preserve_case=False):
"""
Create a node for HookItem/HookedFunction
:return: A IndicatorItem represented as an Element node
"""
document = 'HookItem'
search = 'HookItem/HookedFunction'
content_type = 'string... |
def make_hookitem_hookingmodule(hooking_module, condition='contains', negate=False, preserve_case=False):
"""
Create a node for HookItem/HookingModule
:return: A IndicatorItem represented as an Element node
"""
document = 'HookItem'
search = 'HookItem/HookingModule'
content_type = 'stri... |
def make_portitem_remoteport(remote_port, condition='is', negate=False):
"""
Create a node for PortItem/remotePort
:return: A IndicatorItem represented as an Element node
"""
document = 'PortItem'
search = 'PortItem/remotePort'
content_type = 'int'
content = remote_port
ii_node ... |
def make_prefetchitem_accessedfilelist_accessedfile(accessed_file, condition='contains', negate=False,
preserve_case=False):
"""
Create a node for PrefetchItem/AccessedFileList/AccessedFile
:return: A IndicatorItem represented as an Element node
"... |
def make_prefetchitem_applicationfilename(application_filename, condition='is', negate=False, preserve_case=False):
"""
Create a node for PrefetchItem/ApplicationFileName
:return: A IndicatorItem represented as an Element node
"""
document = 'PrefetchItem'
search = 'PrefetchItem/Application... |
def make_prefetchitem_applicationfullpath(application_fullpath, condition='contains', negate=False,
preserve_case=False):
"""
Create a node for PrefetchItem/ApplicationFullPath
:return: A IndicatorItem represented as an Element node
"""
document = 'Pref... |
def make_processitem_handlelist_handle_name(handle_name, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ProcessItem/HandleList/Handle/Name
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/HandleList/H... |
def make_processitem_portlist_portitem_remoteip(remote_ip, condition='is', negate=False):
"""
Create a node for ProcessItem/PortList/PortItem/remoteIP
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/PortList/PortItem/remoteIP'
c... |
def make_processitem_sectionlist_memorysection_name(section_name, condition='contains', negate=False,
preserve_case=False):
"""
Create a node for ProcessItem/SectionList/MemorySection/Name
:return: A IndicatorItem represented as an Element node
""... |
def make_processitem_sectionlist_memorysection_peinfo_exports_exportedfunctions_string(export_function, condition='is',
negate=False,
preserve_cas... |
def make_processitem_stringlist_string(string, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ProcessItem/StringList/string
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/StringList/string'
cont... |
def make_processitem_username(username, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ProcessItem/Username
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/Username'
content_type = 'string'
c... |
def make_processitem_arguments(arguments, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ProcessItem/arguments
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/arguments'
content_type = 'string'
... |
def make_processitem_path(path, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ProcessItem/path
:return: A IndicatorItem represented as an Element node
"""
document = 'ProcessItem'
search = 'ProcessItem/path'
content_type = 'string'
content = path
... |
def make_registryitem_keypath(keypath, condition='contains', negate=False, preserve_case=False):
"""
Create a node for RegistryItem/KeyPath
:return: A IndicatorItem represented as an Element node
"""
document = 'RegistryItem'
search = 'RegistryItem/KeyPath'
content_type = 'string'
c... |
def make_registryitem_text(text, condition='contains', negate=False, preserve_case=False):
"""
Create a node for RegistryItem/Text
:return: A IndicatorItem represented as an Element node
"""
document = 'RegistryItem'
search = 'RegistryItem/Text'
content_type = 'string'
content = tex... |
def make_registryitem_valuename(valuename, condition='is', negate=False, preserve_case=False):
"""
Create a node for RegistryItem/ValueName
:return: A IndicatorItem represented as an Element node
"""
document = 'RegistryItem'
search = 'RegistryItem/ValueName'
content_type = 'string'
... |
def make_serviceitem_description(description, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ServiceItem/description
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/description'
content_type = 's... |
def make_serviceitem_descriptivename(descriptive_name, condition='is', negate=False, preserve_case=False):
"""
Create a node for ServiceItem/descriptiveName
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/descriptiveName'
conten... |
def make_serviceitem_name(name, condition='is', negate=False, preserve_case=False):
"""
Create a node for ServiceItem/name
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/name'
content_type = 'string'
content = name
ii_n... |
def make_serviceitem_pathmd5sum(path_md5, condition='is', negate=False):
"""
Create a node for ServiceItem/pathmd5sum
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/pathmd5sum'
content_type = 'md5'
content = path_md5
ii... |
def make_serviceitem_servicedll(servicedll, condition='contains', negate=False, preserve_case=False):
"""
Create a node for ServiceItem/serviceDLL
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/serviceDLL'
content_type = 'strin... |
def make_serviceitem_servicedllsignatureexists(dll_sig_exists, condition='is', negate=False):
"""
Create a node for ServiceItem/serviceDLLSignatureExists
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/serviceDLLSignatureExists'
... |
def make_serviceitem_servicedllsignatureverified(dll_sig_verified, condition='is', negate=False):
"""
Create a node for ServiceItem/serviceDLLSignatureVerified
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/serviceDLLSignatureVerif... |
def make_serviceitem_servicedllmd5sum(servicedll_md5, condition='is', negate=False):
"""
Create a node for ServiceItem/serviceDLLmd5sum
:return: A IndicatorItem represented as an Element node
"""
document = 'ServiceItem'
search = 'ServiceItem/serviceDLLmd5sum'
content_type = 'md5'
c... |
def make_systeminfoitem_hostname(hostname, condition='contains', negate=False, preserve_case=False):
"""
Create a node for SystemInfoItem/hostname
:return: A IndicatorItem represented as an Element node
"""
document = 'SystemInfoItem'
search = 'SystemInfoItem/hostname'
content_type = 's... |
def make_systemrestoreitem_originalfilename(original_filename, condition='contains', negate=False, preserve_case=False):
"""
Create a node for SystemRestoreItem/OriginalFileName
:return: A IndicatorItem represented as an Element node
"""
document = 'SystemRestoreItem'
search = 'SystemRestor... |
def make_fileitem_peinfo_versioninfoitem(key, value, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/PEInfo/VersionInfoList/VersionInfoItem/ + key name
No validation of the key is performed.
:return: A IndicatorItem represented as an Element node
"""
... |
def fix_schema_node_ordering(parent):
"""
Fix the ordering of children under the criteria node to ensure that IndicatorItem/Indicator order
is preserved, as per XML Schema.
:return:
"""
children = parent.getchildren()
i_nodes = [node for node in children if node.... |
def make_indicator_node(operator, nid=None):
"""
This makes a Indicator node element. These allow the construction of a logic tree within the IOC.
:param operator: String 'AND' or 'OR'. The constants ioc_api.OR and ioc_api.AND may be used as well.
:param nid: This is used to provide a GUID for the In... |
def make_indicatoritem_node(condition,
document,
search,
content_type,
content,
preserve_case=False,
negate=False,
context_t... |
def get_top_level_indicator_node(root_node):
"""
This returns the first top level Indicator node under the criteria node.
:param root_node: Root node of an etree.
:return: an elementTree Element item, or None if no item is found.
"""
if root_node.tag != 'OpenIOC':
raise IOCParseError('R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.