_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25300 | WinRegistryParser._ParseKeysFromFindSpecs | train | def _ParseKeysFromFindSpecs(self, parser_mediator, win_registry, find_specs):
"""Parses the Registry keys from FindSpecs.
Args:
parser_mediator (ParserMediator): parser mediator.
win_registry (dfwinreg.WinRegistryKey): root Windows Registry key.
| python | {
"resource": ""
} |
q25301 | WinRegistryParser.ParseFileObject | train | def ParseFileObject(self, parser_mediator, file_object):
"""Parses a Windows Registry file-like object.
Args:
parser_mediator (ParserMediator): parser mediator.
file_object (dfvfs.FileIO): a file-like object.
"""
win_registry_reader = FileObjectWinRegistryFileReader()
try:
regist... | python | {
"resource": ""
} |
q25302 | StorageFactory.CreateStorageReaderForFile | train | def CreateStorageReaderForFile(cls, path):
"""Creates a storage reader based on the file.
Args:
path (str): path to the storage file.
Returns:
StorageReader: a storage reader or None if the storage file cannot be
opened or the storage format is not supported.
"""
| python | {
"resource": ""
} |
q25303 | StorageFactory.CreateStorageWriter | train | def CreateStorageWriter(cls, storage_format, session, path):
"""Creates a storage writer.
Args:
session (Session): session the storage changes are part of.
path (str): path to the storage file.
storage_format (str): storage format.
Returns:
StorageWriter: a storage writer or None i... | python | {
"resource": ""
} |
q25304 | StorageFactory.CreateStorageWriterForFile | train | def CreateStorageWriterForFile(cls, session, path):
"""Creates a storage writer based on the file.
Args:
session (Session): session the storage changes are part of.
path (str): path to the storage file.
Returns:
StorageWriter: a storage writer or None if the storage file cannot be
... | python | {
"resource": ""
} |
q25305 | MySQL4n6TimeOutputModule.SetCredentials | train | def SetCredentials(self, password=None, username=None):
"""Sets the database credentials.
Args:
password (Optional[str]): password to access the database.
username (Optional[str]): username to access the database. | python | {
"resource": ""
} |
q25306 | MySQL4n6TimeOutputModule.SetServerInformation | train | def SetServerInformation(self, server, port):
"""Sets the server information.
Args:
server (str): hostname | python | {
"resource": ""
} |
q25307 | CLITableView._WriteHeader | train | def _WriteHeader(self, output_writer):
"""Writes a header.
Args:
output_writer (OutputWriter): output writer.
"""
header_string = ''
if self._title:
header_string | python | {
"resource": ""
} |
q25308 | CLITableView._WriteRow | train | def _WriteRow(self, output_writer, values):
"""Writes a row of values aligned to the column width.
Args:
output_writer (OutputWriter): output writer.
values (list[object]): values.
"""
maximum_row_width = self._MAXIMUM_WIDTH - self._column_width - 3
# The format string of the first lin... | python | {
"resource": ""
} |
q25309 | ViewsFactory.GetTableView | train | def GetTableView(cls, format_type, column_names=None, title=None):
"""Retrieves a table view.
Args:
format_type (str): table view format type.
column_names (Optional[list[str]]): column names.
title (Optional[str]): title.
Returns:
BaseTableView: table view.
Raises:
Valu... | python | {
"resource": ""
} |
q25310 | DtFabricBasePlistPlugin._GetDataTypeMap | train | def _GetDataTypeMap(self, name):
"""Retrieves a data type map defined by the definition file.
The data type maps are cached for reuse.
Args:
name (str): name of the data type as defined by the definition file.
Returns:
dtfabric.DataTypeMap: data type map which contains a data type definit... | python | {
"resource": ""
} |
q25311 | DtFabricBasePlistPlugin._ReadDefinitionFile | train | def _ReadDefinitionFile(self, filename):
"""Reads a dtFabric definition file.
Args:
filename (str): name of the dtFabric definition file.
Returns:
dtfabric.DataTypeFabric: data type fabric which contains the data format
data type maps of the data type definition, such as a structure,... | python | {
"resource": ""
} |
q25312 | RunSphinxAPIDoc | train | def RunSphinxAPIDoc(_):
"""Runs sphinx-apidoc to auto-generate documentation."""
current_directory = os.path.abspath(os.path.dirname(__file__))
module = os.path.join(current_directory, '..', 'plaso')
| python | {
"resource": ""
} |
q25313 | setup | train | def setup(app):
"""Called at Sphinx initialization."""
# Triggers sphinx-apidoc to generate API documentation.
app.connect('builder-inited', RunSphinxAPIDoc)
app.add_config_value(
'recommonmark_config', {
| python | {
"resource": ""
} |
q25314 | FileHistoryESEDBPlugin._GetDictFromStringsTable | train | def _GetDictFromStringsTable(self, parser_mediator, table):
"""Build a dictionary of the value in the strings table.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
table (pyesedb.table): strings table.
Re... | python | {
"resource": ""
} |
q25315 | FileHistoryESEDBPlugin.ParseNameSpace | train | def ParseNameSpace(
self, parser_mediator, cache=None, database=None, table=None,
**unused_kwargs):
"""Parses the namespace table.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
cache (Optional[ESE... | python | {
"resource": ""
} |
q25316 | AnalysisMediator.GetDisplayNameForPathSpec | train | def GetDisplayNameForPathSpec(self, path_spec):
"""Retrieves the display name for a path specification.
Args:
path_spec (dfvfs.PathSpec): path specification.
Returns:
str: human readable version of the | python | {
"resource": ""
} |
q25317 | AnalysisMediator.ProduceAnalysisReport | train | def ProduceAnalysisReport(self, plugin):
"""Produces an analysis report.
Args:
plugin (AnalysisPlugin): plugin.
"""
analysis_report = plugin.CompileReport(self)
if not analysis_report:
return
analysis_report.time_compiled = timelib.Timestamp.GetNow()
plugin_name = getattr(anal... | python | {
"resource": ""
} |
q25318 | AnalysisMediator.ProduceEventTag | train | def ProduceEventTag(self, event_tag):
"""Produces an event tag.
Args:
event_tag (EventTag): event | python | {
"resource": ""
} |
q25319 | PsortEventHeap._GetEventIdentifiers | train | def _GetEventIdentifiers(self, event):
"""Retrieves different identifiers of the event.
Every event contains event data, which consists of attributes and values.
These attributes and values can be represented as a string and used for
sorting and uniquely identifying events. This function determines mul... | python | {
"resource": ""
} |
q25320 | PsortEventHeap.PopEvents | train | def PopEvents(self):
"""Pops events from the heap.
Yields:
EventObject: event. | python | {
"resource": ""
} |
q25321 | PsortMultiProcessEngine._CheckStatusAnalysisProcess | train | def _CheckStatusAnalysisProcess(self, pid):
"""Checks the status of an analysis process.
Args:
pid (int): process ID (PID) of a registered analysis process.
Raises:
KeyError: if the process is not registered with the engine.
"""
# TODO: Refactor this method, simplify and separate conce... | python | {
"resource": ""
} |
q25322 | PsortMultiProcessEngine._ExportEvent | train | def _ExportEvent(self, output_module, event, deduplicate_events=True):
"""Exports an event using an output module.
Args:
output_module (OutputModule): output module.
event (EventObject): event.
deduplicate_events (Optional[bool]): True if events should be
deduplicated.
"""
i... | python | {
"resource": ""
} |
q25323 | PsortMultiProcessEngine._FlushExportBuffer | train | def _FlushExportBuffer(self, output_module, deduplicate_events=True):
"""Flushes buffered events and writes them to the output module.
Args:
output_module (OutputModule): output module.
deduplicate_events (Optional[bool]): True if events should be
deduplicated.
"""
last_macb_group... | python | {
"resource": ""
} |
q25324 | PsortMultiProcessEngine._MergeEventTag | train | def _MergeEventTag(self, storage_writer, attribute_container):
"""Merges an event tag with the last stored event tag.
If there is an existing event the provided event tag is updated with
the contents of the existing one. After which the event tag index is
updated.
Args:
storage_writer (Stora... | python | {
"resource": ""
} |
q25325 | PsortMultiProcessEngine._StartAnalysisProcesses | train | def _StartAnalysisProcesses(self, storage_writer, analysis_plugins):
"""Starts the analysis processes.
Args:
storage_writer (StorageWriter): storage writer.
analysis_plugins (dict[str, AnalysisPlugin]): analysis plugins that
should be run and their names.
"""
logger.info('Starting... | python | {
"resource": ""
} |
q25326 | PsortMultiProcessEngine._StopAnalysisProcesses | train | def _StopAnalysisProcesses(self, abort=False):
"""Stops the analysis processes.
Args:
abort (bool): True to indicated the stop is issued on abort.
"""
logger.debug('Stopping analysis processes.')
self._StopMonitoringProcesses()
# Note that multiprocessing.Queue is very sensitive regardin... | python | {
"resource": ""
} |
q25327 | PsortMultiProcessEngine._UpdateForemanProcessStatus | train | def _UpdateForemanProcessStatus(self):
"""Update the foreman process status."""
used_memory = self._process_information.GetUsedMemory() or 0
display_name = getattr(self._merge_task, 'identifier', '')
self._processing_status.UpdateForemanStatus(
self._name, self._status, self._pid, used_memory,... | python | {
"resource": ""
} |
q25328 | WinLnkLinkFormatter._GetLinkedPath | train | def _GetLinkedPath(self, event):
"""Determines the linked path.
Args:
event (EventObject): event that contains a linked path.
Returns:
str: linked path.
"""
if hasattr(event, 'local_path'):
return event.local_path
if hasattr(event, 'network_path'):
return event.network... | python | {
"resource": ""
} |
q25329 | BrowserSearchPlugin._DecodeURL | train | def _DecodeURL(self, url):
"""Decodes the URL, replaces %XX to their corresponding characters.
Args:
url (str): encoded URL.
Returns:
str: decoded URL.
"""
if not url:
return ''
decoded_url = urlparse.unquote(url)
if isinstance(decoded_url, py2to3.BYTES_TYPE):
try:... | python | {
"resource": ""
} |
q25330 | BrowserSearchPlugin._ExtractGMailSearchQuery | train | def _ExtractGMailSearchQuery(self, url):
"""Extracts a search query from a GMail search URL.
GMail: https://mail.google.com/mail/u/0/#search/query[/?]
Args:
url (str): URL.
Returns:
str: search query or None if no query was found.
"""
if 'search/' not in | python | {
"resource": ""
} |
q25331 | BrowserSearchPlugin._ExtractGoogleDocsSearchQuery | train | def _ExtractGoogleDocsSearchQuery(self, url):
"""Extracts a search query from a Google docs URL.
Google Docs: https://docs.google.com/.*/u/0/?q=query
Args:
url (str): URL.
Returns:
str: search query or None if no query was found.
"""
| python | {
"resource": ""
} |
q25332 | BrowserSearchPlugin._ExtractGoogleSearchQuery | train | def _ExtractGoogleSearchQuery(self, url):
"""Extracts a search query from a Google URL.
Google Drive: https://drive.google.com/drive/search?q=query
Google Search: https://www.google.com/search?q=query
Google Sites: https://sites.google.com/site/.*/system/app/pages/
| python | {
"resource": ""
} |
q25333 | BrowserSearchPlugin._ExtractYahooSearchQuery | train | def _ExtractYahooSearchQuery(self, url):
"""Extracts a search query from a Yahoo search URL.
Examples:
https://search.yahoo.com/search?p=query
https://search.yahoo.com/search;?p=query
Args:
url (str): URL.
Returns:
str: search query or None if no query was found.
"""
i... | python | {
"resource": ""
} |
q25334 | BrowserSearchPlugin._ExtractYandexSearchQuery | train | def _ExtractYandexSearchQuery(self, url):
"""Extracts a search query from a Yandex search URL.
Yandex: https://www.yandex.com/search/?text=query
Args:
url (str): URL.
Returns:
str: search query or None if no query was found.
"""
if 'text=' not in url:
return None
_, | python | {
"resource": ""
} |
q25335 | BrowserSearchPlugin._GetBetweenQEqualsAndAmpersand | train | def _GetBetweenQEqualsAndAmpersand(self, url):
"""Retrieves the substring between the substrings 'q=' and '&'.
Args:
url (str): URL.
Returns:
str: search query, the value between 'q=' and '&' or None if no query
was found.
"""
# Make sure we're analyzing the query part of the UR... | python | {
"resource": ""
} |
q25336 | TangoAndroidTCPlugin.ParseConversationRow | train | def ParseConversationRow(self, parser_mediator, query, row, **unused_kwargs):
"""Parses a conversation row from the database.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the ... | python | {
"resource": ""
} |
q25337 | TangoAndroidTCPlugin.ParseMessageRow | train | def ParseMessageRow(self, parser_mediator, query, row, **unused_kwargs):
"""Parses a message row from the database.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
... | python | {
"resource": ""
} |
q25338 | NativePythonFormatterHelper.GetFormattedEventObject | train | def GetFormattedEventObject(cls, event):
"""Retrieves a string representation of the event.
Args:
event (EventObject): event.
Returns:
str: string representation of the event.
"""
time_string = timelib.Timestamp.CopyToIsoFormat(event.timestamp)
lines_of_text = [
'+-' * 40,... | python | {
"resource": ""
} |
q25339 | _PendingMergeTaskHeap.PopTask | train | def PopTask(self):
"""Retrieves and removes the first task from the heap.
Returns:
Task: the task or None if the heap is empty.
"""
try:
| python | {
"resource": ""
} |
q25340 | _PendingMergeTaskHeap.PushTask | train | def PushTask(self, task):
"""Pushes a task onto the heap.
Args:
task (Task): task.
Raises:
ValueError: if the size of the storage file is not set in the task.
"""
storage_file_size = getattr(task, 'storage_file_size', None)
if not storage_file_size:
raise ValueError('Task sto... | python | {
"resource": ""
} |
q25341 | TaskManager._AbandonInactiveProcessingTasks | train | def _AbandonInactiveProcessingTasks(self):
"""Marks processing tasks that exceed the inactive time as abandoned.
This method does not lock the manager and should be called by a method
holding the manager lock.
"""
if self._tasks_processing:
inactive_time = time.time() - self._TASK_INACTIVE_TI... | python | {
"resource": ""
} |
q25342 | TaskManager._AbandonQueuedTasks | train | def _AbandonQueuedTasks(self):
"""Marks queued tasks abandoned.
This method does not lock the manager and should be called by a method
holding the manager lock.
"""
# Abandon all tasks after they're identified so as not to modify the
# dict while iterating | python | {
"resource": ""
} |
q25343 | TaskManager.CheckTaskToMerge | train | def CheckTaskToMerge(self, task):
"""Checks if the task should be merged.
Args:
task (Task): task.
Returns:
bool: True if the task should be merged.
Raises:
KeyError: if the task was not queued, processing or abandoned.
"""
with self._lock:
is_abandoned = task.identifi... | python | {
"resource": ""
} |
q25344 | TaskManager.CreateRetryTask | train | def CreateRetryTask(self):
"""Creates a task that to retry a previously abandoned task.
Returns:
Task: a task that was abandoned but should be retried or None if there are
no abandoned tasks that should be retried.
"""
with self._lock:
abandoned_task = self._GetTaskPendingRetry()
... | python | {
"resource": ""
} |
q25345 | TaskManager.CreateTask | train | def CreateTask(self, session_identifier):
"""Creates a task.
Args:
session_identifier (str): the identifier of the session the task is
part of.
Returns:
Task: task attribute container.
"""
task = tasks.Task(session_identifier)
logger.debug('Created | python | {
"resource": ""
} |
q25346 | TaskManager.CompleteTask | train | def CompleteTask(self, task):
"""Completes a task.
The task is complete and can be removed from the task manager.
Args:
task (Task): task.
Raises:
KeyError: if the task was not merging.
"""
with self._lock:
if task.identifier not in self._tasks_merging:
raise KeyErro... | python | {
"resource": ""
} |
q25347 | TaskManager.GetFailedTasks | train | def GetFailedTasks(self):
"""Retrieves all failed tasks.
Failed tasks are tasks that were abandoned and have no retry task once
the foreman is done processing.
| python | {
"resource": ""
} |
q25348 | TaskManager.GetProcessedTaskByIdentifier | train | def GetProcessedTaskByIdentifier(self, task_identifier):
"""Retrieves a task that has been processed.
Args:
task_identifier (str): unique identifier of the task.
Returns:
Task: a task that has been processed.
Raises:
KeyError: if the task was not processing, queued or abandoned.
... | python | {
"resource": ""
} |
q25349 | TaskManager.GetStatusInformation | train | def GetStatusInformation(self):
"""Retrieves status information about the tasks.
Returns:
TasksStatus: tasks status information.
"""
status = processing_status.TasksStatus()
with self._lock:
status.number_of_abandoned_tasks = len(self._tasks_abandoned)
status.number_of_queued_tas... | python | {
"resource": ""
} |
q25350 | TaskManager.GetTaskPendingMerge | train | def GetTaskPendingMerge(self, current_task):
"""Retrieves the first task that is pending merge or has a higher priority.
This function will check if there is a task with a higher merge priority
than the current_task being merged. If so, that task with the higher
priority is returned.
Args:
c... | python | {
"resource": ""
} |
q25351 | TaskManager.HasPendingTasks | train | def HasPendingTasks(self):
"""Determines if there are tasks running or in need of retrying.
Returns:
bool: True if there are tasks that are active, ready to be merged or
need to be retried.
"""
with self._lock:
self._AbandonInactiveProcessingTasks()
if self._tasks_processin... | python | {
"resource": ""
} |
q25352 | TaskManager.RemoveTask | train | def RemoveTask(self, task):
"""Removes an abandoned task.
Args:
task (Task): task.
Raises:
KeyError: if the task was not abandoned or the task was abandoned and
was not retried.
"""
with self._lock:
if task.identifier not in self._tasks_abandoned:
raise KeyError... | python | {
"resource": ""
} |
q25353 | TaskManager.SampleTaskStatus | train | def SampleTaskStatus(self, task, status):
"""Takes a sample of the status of the task for profiling.
Args:
task (Task): a task.
| python | {
"resource": ""
} |
q25354 | TaskManager.UpdateTaskAsPendingMerge | train | def UpdateTaskAsPendingMerge(self, task):
"""Updates the task manager to reflect the task is ready to be merged.
Args:
task (Task): task.
Raises:
KeyError: if the task was not queued, processing or abandoned, or
the task was abandoned and has a retry task.
"""
with self._lock... | python | {
"resource": ""
} |
q25355 | TaskManager.UpdateTaskAsProcessingByIdentifier | train | def UpdateTaskAsProcessingByIdentifier(self, task_identifier):
"""Updates the task manager to reflect the task is processing.
Args:
task_identifier (str): unique identifier of the task.
Raises:
KeyError: if the task is not known to the task manager.
"""
with self._lock:
task_proc... | python | {
"resource": ""
} |
q25356 | AndroidSMSPlugin.ParseSmsRow | train | def ParseSmsRow(self, parser_mediator, query, row, **unused_kwargs):
"""Parses an SMS row.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
row (sqlite3.Row): row.
... | python | {
"resource": ""
} |
q25357 | PstealTool._GenerateStorageFileName | train | def _GenerateStorageFileName(self):
"""Generates a name for the storage file.
The result use a timestamp and the basename of the source path.
Returns:
str: a filename for the storage file in the form <time>-<source>.plaso
Raises:
BadConfigOption: raised if the source path is not set.
... | python | {
"resource": ""
} |
q25358 | PstealTool.AnalyzeEvents | train | def AnalyzeEvents(self):
"""Analyzes events from a plaso storage file and generate a report.
Raises:
BadConfigOption: when a configuration parameter fails validation.
RuntimeError: if a non-recoverable situation is encountered.
"""
session = engine.BaseEngine.CreateSession(
command_... | python | {
"resource": ""
} |
q25359 | PstealTool.ParseOptions | train | def ParseOptions(self, options):
"""Parses tool specific options.
Args:
options (argparse.Namespace): command line arguments.
Raises:
BadConfigOption: if the options are invalid.
"""
# The extraction options are dependent on the data location.
helpers_manager.ArgumentHelperManager.... | python | {
"resource": ""
} |
q25360 | TLNBaseOutputModule._FormatDescription | train | def _FormatDescription(self, event):
"""Formats the description.
Args:
event (EventObject): event.
Returns:
str: formatted description field.
"""
date_time_string = timelib.Timestamp.CopyToIsoFormat(
event.timestamp, timezone=self._output_mediator.timezone)
timestamp_descri... | python | {
"resource": ""
} |
q25361 | L2TTLNOutputModule._FormatNotes | train | def _FormatNotes(self, event):
"""Formats the notes.
Args:
event (EventObject): event.
Returns:
str: formatted notes field.
"""
inode = event.inode
if inode is None:
inode = '-'
notes = getattr(event, 'notes', '')
if not notes:
| python | {
"resource": ""
} |
q25362 | TwitterAndroidPlugin.ParseSearchRow | train | def ParseSearchRow(self, parser_mediator, query, row, **unused_kwargs):
"""Parses a search row from the database.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the row.
r... | python | {
"resource": ""
} |
q25363 | JSONAttributeContainerSerializer._ConvertAttributeContainerToDict | train | def _ConvertAttributeContainerToDict(cls, attribute_container):
"""Converts an attribute container object into a JSON dictionary.
The resulting dictionary of the JSON serialized objects consists of:
{
'__type__': 'AttributeContainer'
'__container_type__': ...
...
}
Here '__... | python | {
"resource": ""
} |
q25364 | JSONAttributeContainerSerializer._ConvertAttributeValueToDict | train | def _ConvertAttributeValueToDict(cls, attribute_value):
"""Converts an attribute value into a JSON dictionary.
Args:
attribute_value (object): an attribute value.
Returns:
dict|list: The JSON serialized object which can be a dictionary or a list.
"""
if isinstance(attribute_value, py2t... | python | {
"resource": ""
} |
q25365 | JSONAttributeContainerSerializer._ConvertCollectionsCounterToDict | train | def _ConvertCollectionsCounterToDict(cls, collections_counter):
"""Converts a collections.Counter object into a JSON dictionary.
The resulting dictionary of the JSON serialized objects consists of:
{
'__type__': 'collections.Counter'
...
}
Here '__type__' indicates the object base ... | python | {
"resource": ""
} |
q25366 | JSONAttributeContainerSerializer._ConvertDictToObject | train | def _ConvertDictToObject(cls, json_dict):
"""Converts a JSON dict into an object.
The dictionary of the JSON serialized objects consists of:
{
'__type__': 'AttributeContainer'
'__container_type__': ...
...
}
Here '__type__' indicates the object base type. In this case
'... | python | {
"resource": ""
} |
q25367 | JSONAttributeContainerSerializer._ConvertDictToCollectionsCounter | train | def _ConvertDictToCollectionsCounter(cls, json_dict):
"""Converts a JSON dict into a collections.Counter.
The dictionary of the JSON serialized objects consists of:
{
'__type__': 'collections.Counter'
...
}
Here '__type__' indicates the object base type. In this case this should
... | python | {
"resource": ""
} |
q25368 | JSONAttributeContainerSerializer._ConvertListToObject | train | def _ConvertListToObject(cls, json_list):
"""Converts a JSON list into an object.
Args:
json_list (list[object]): JSON serialized objects.
Returns:
list[object]: a deserialized list.
"""
list_value = []
| python | {
"resource": ""
} |
q25369 | JSONAttributeContainerSerializer.ReadSerialized | train | def ReadSerialized(cls, json_string): # pylint: disable=arguments-differ
"""Reads an attribute container from serialized form.
Args:
json_string (str): JSON serialized attribute container.
Returns:
AttributeContainer: attribute | python | {
"resource": ""
} |
q25370 | JSONAttributeContainerSerializer.ReadSerializedDict | train | def ReadSerializedDict(cls, json_dict):
"""Reads an attribute container from serialized dictionary form.
Args:
json_dict (dict[str, object]): JSON serialized objects.
Returns:
AttributeContainer: attribute container or None.
Raises:
TypeError: if the serialized dictionary does not c... | python | {
"resource": ""
} |
q25371 | JSONAttributeContainerSerializer.WriteSerialized | train | def WriteSerialized(cls, attribute_container):
"""Writes an attribute container to serialized form.
Args:
attribute_container (AttributeContainer): attribute container.
Returns:
str: A JSON string | python | {
"resource": ""
} |
q25372 | OutputModule._ReportEventError | train | def _ReportEventError(self, event, error_message):
"""Reports an event related error.
Args:
event (EventObject): event.
error_message (str): error message.
"""
event_identifier = event.GetIdentifier()
event_identifier_string = event_identifier.CopyToString()
display_name = getattr(e... | python | {
"resource": ""
} |
q25373 | OutputModule.WriteEvent | train | def WriteEvent(self, event):
"""Writes the event to the output.
Args:
event (EventObject): event.
"""
self.WriteEventStart()
try:
self.WriteEventBody(event)
except errors.NoFormatterFound as exception:
error_message = 'unable to retrieve formatter with error: {0!s}'.format(
... | python | {
"resource": ""
} |
q25374 | DpkgParser.VerifyStructure | train | def VerifyStructure(self, parser_mediator, line):
"""Verifies if a line from a text file is in the expected format.
Args:
parser_mediator (ParserMediator): parser mediator.
line (str): line from a text file.
Returns:
bool: True if the line is in the expected format, False if not.
"""... | python | {
"resource": ""
} |
q25375 | ParserPresetsManager._ReadOperatingSystemArtifactValues | train | def _ReadOperatingSystemArtifactValues(self, operating_system_values):
"""Reads an operating system artifact from a dictionary.
Args:
operating_system_values (dict[str, object]): operating system values.
Returns:
OperatingSystemArtifact: an operating system artifact attribute container.
R... | python | {
"resource": ""
} |
q25376 | ParserPresetsManager._ReadParserPresetValues | train | def _ReadParserPresetValues(self, preset_definition_values):
"""Reads a parser preset from a dictionary.
Args:
preset_definition_values (dict[str, object]): preset definition values.
Returns:
ParserPreset: a parser preset.
Raises:
MalformedPresetError: if the format of the preset de... | python | {
"resource": ""
} |
q25377 | ParserPresetsManager._ReadPresetsFromFileObject | train | def _ReadPresetsFromFileObject(self, file_object):
"""Reads parser and parser plugin presets from a file-like object.
Args:
file_object (file): file-like object containing the parser and parser
plugin presets definitions.
Yields:
ParserPreset: a parser preset.
Raises:
Malf... | python | {
"resource": ""
} |
q25378 | ParserPresetsManager.GetPresetByName | train | def GetPresetByName(self, name):
"""Retrieves a specific preset definition by name.
Args:
name (str): name of the preset.
Returns:
ParserPreset: a | python | {
"resource": ""
} |
q25379 | ParserPresetsManager.GetPresetsByOperatingSystem | train | def GetPresetsByOperatingSystem(self, operating_system):
"""Retrieves preset definitions for a specific operating system.
Args:
operating_system (OperatingSystemArtifact): an operating system artifact
attribute container.
Returns:
list[PresetDefinition]: preset definition that corres... | python | {
"resource": ""
} |
q25380 | ParserPresetsManager.ReadFromFile | train | def ReadFromFile(self, path):
"""Reads parser and parser plugin presets from a file.
Args:
path (str): path of file that contains the the parser and parser plugin
presets configuration.
Raises:
MalformedPresetError: if one or more plugin preset definitions are
malformed.
... | python | {
"resource": ""
} |
q25381 | WorkerProcess._ProcessTask | train | def _ProcessTask(self, task):
"""Processes a task.
Args:
task (Task): task.
"""
logger.debug('Started processing task: {0:s}.'.format(task.identifier))
if self._tasks_profiler:
self._tasks_profiler.Sample(task, 'processing_started')
self._task = task
storage_writer = self._st... | python | {
"resource": ""
} |
q25382 | OperatingSystemArtifact._GetNameFromProduct | train | def _GetNameFromProduct(self):
"""Determines the predefined operating system name from the product.
Returns:
str: operating system name, such as "macOS Mojave" or "Windows XP" or
None if the name cannot be determined. This value is used to
programmatically link a parser preset to an o... | python | {
"resource": ""
} |
q25383 | OperatingSystemArtifact.IsEquivalent | train | def IsEquivalent(self, other):
"""Determines if 2 operating system artifacts are equivalent.
This function compares the operating systems based in order of:
* name derived from product
* family and version
* family
Args:
other (OperatingSystemArtifact): operating system artifact attribut... | python | {
"resource": ""
} |
q25384 | BaseEngine._DetermineOperatingSystem | train | def _DetermineOperatingSystem(self, searcher):
"""Tries to determine the underlying operating system.
Args:
searcher (dfvfs.FileSystemSearcher): file system searcher.
Returns:
str: operating system for example "Windows". This should be one of
the values in definitions.OPERATING_SYSTE... | python | {
"resource": ""
} |
q25385 | BaseEngine.CreateSession | train | def CreateSession(
cls, artifact_filter_names=None, command_line_arguments=None,
debug_mode=False, filter_file_path=None, preferred_encoding='utf-8',
preferred_time_zone=None, preferred_year=None):
"""Creates a session attribute container.
Args:
artifact_filter_names (Optional[list[str]... | python | {
"resource": ""
} |
q25386 | BaseEngine.BuildFilterFindSpecs | train | def BuildFilterFindSpecs(
self, artifact_definitions_path, custom_artifacts_path,
knowledge_base_object, artifact_filter_names=None, filter_file_path=None):
"""Builds find specifications from artifacts or filter file if available.
Args:
artifact_definitions_path (str): path to artifact defini... | python | {
"resource": ""
} |
q25387 | BaseEngine.BuildArtifactsRegistry | train | def BuildArtifactsRegistry(
cls, artifact_definitions_path, custom_artifacts_path):
"""Build Find Specs from artifacts or filter file if available.
Args:
artifact_definitions_path (str): path to artifact definitions file.
custom_artifacts_path (str): path to custom artifact definitions file... | python | {
"resource": ""
} |
q25388 | OLECFPlugin._GetTimestamps | train | def _GetTimestamps(self, olecf_item):
"""Retrieves the timestamps from an OLECF item.
Args:
olecf_item (pyolecf.item): OLECF item.
Returns:
tuple[int, int]: creation and modification FILETIME timestamp.
"""
if not olecf_item:
return None, None
try:
creation_time = olec... | python | {
"resource": ""
} |
q25389 | HashersManager.GetHasherNamesFromString | train | def GetHasherNamesFromString(cls, hasher_names_string):
"""Retrieves a list of a hasher names from a comma separated string.
Takes a string of comma separated hasher names transforms it to a list of
hasher names.
Args:
hasher_names_string (str): comma separated names of hashers to enable,
... | python | {
"resource": ""
} |
q25390 | HashersManager.GetHashersInformation | train | def GetHashersInformation(cls):
"""Retrieves the hashers information.
Returns:
list[tuple]: containing:
str: hasher name.
str: hasher description.
"""
hashers_information = []
for _, | python | {
"resource": ""
} |
q25391 | HashersManager.GetHasher | train | def GetHasher(cls, hasher_name):
"""Retrieves an instance of a specific hasher.
Args:
hasher_name (str): the name of the hasher to retrieve.
Returns:
BaseHasher: hasher.
Raises:
KeyError: if hasher class is not set for the corresponding name.
"""
hasher_name = hasher_name.lo... | python | {
"resource": ""
} |
q25392 | HashersManager.GetHashers | train | def GetHashers(cls, hasher_names):
"""Retrieves instances for all the specified hashers.
Args:
hasher_names (list[str]): names of the hashers to retrieve.
| python | {
"resource": ""
} |
q25393 | HashersManager.GetHasherClasses | train | def GetHasherClasses(cls, hasher_names=None):
"""Retrieves the registered hashers.
Args:
hasher_names (list[str]): names of the hashers to retrieve.
Yields:
tuple: containing:
str: parser name
type: next hasher class. | python | {
"resource": ""
} |
q25394 | HashersManager.RegisterHasher | train | def RegisterHasher(cls, hasher_class):
"""Registers a hasher class.
The hasher classes are identified based on their lower case name.
Args:
hasher_class (type): class object of the hasher.
Raises:
KeyError: if hasher class is already set for the corresponding name.
"""
hasher_name... | python | {
"resource": ""
} |
q25395 | SCCMParser._GetISO8601String | train | def _GetISO8601String(self, structure):
"""Retrieves an ISO8601 date time string from the structure.
The date and time values in the SCCM log are formatted as:
time="19:33:19.766-330" date="11-28-2014"
Args:
structure (pyparsing.ParseResults): structure of tokens derived from
a line of... | python | {
"resource": ""
} |
q25396 | SCCMParser.ParseRecord | train | def ParseRecord(self, parser_mediator, key, structure):
"""Parse the record and return an SCCM log event object.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
key (str): name of the parsed structure.
st... | python | {
"resource": ""
} |
q25397 | SCCMParser.VerifyStructure | train | def VerifyStructure(self, parser_mediator, lines):
"""Verifies whether content corresponds to an SCCM log file.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
lines (str): one or more lines from the text file.... | python | {
"resource": ""
} |
q25398 | SelfFeederMixIn.Feed | train | def Feed(self, size=512):
"""Feed data into the buffer.
Args:
size: optional data size to read form the file-like object.
"""
data = | python | {
"resource": ""
} |
q25399 | SelfFeederMixIn.NextToken | train | def NextToken(self):
"""Retrieves the next token.
Returns:
The next token (instance of Token) or None.
"""
# If we don't have enough data - feed ourselves: We assume
# that we must have at least one | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.