_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q25400
Expression.AddArg
train
def AddArg(self, argument): """Adds a new argument to this expression. Args: argument (str): argument to add. Returns: True if the argument is the last argument, False otherwise. Raises: ParseError: If there are too many arguments. """ self.args.append(argument) if len(...
python
{ "resource": "" }
q25401
BinaryExpression.AddOperands
train
def AddOperands(self, lhs, rhs): """Add an operand.""" if isinstance(lhs, Expression) and isinstance(rhs, Expression):
python
{ "resource": "" }
q25402
BinaryExpression.PrintTree
train
def PrintTree(self, depth=''): """Print the tree.""" result = '{0:s}{1:s}\n'.format(depth, self.operator)
python
{ "resource": "" }
q25403
SearchParser.BinaryOperator
train
def BinaryOperator(self, string=None, **unused_kwargs):
python
{ "resource": "" }
q25404
SearchParser.StoreAttribute
train
def StoreAttribute(self, string='', **unused_kwargs): """Store the attribute.""" logging.debug('Storing attribute {0:s}'.format(repr(string))) # TODO: Update the expected number_of_args try:
python
{ "resource": "" }
q25405
SearchParser.StoreOperator
train
def StoreOperator(self, string='', **unused_kwargs): """Store the operator."""
python
{ "resource": "" }
q25406
SearchParser.InsertArg
train
def InsertArg(self, string='', **unused_kwargs): """Insert an argument to the current expression.""" logging.debug('Storing Argument {0:s}'.format(string)) # This expression is complete if self.current_expression.AddArg(string):
python
{ "resource": "" }
q25407
FileNameFileEntryFilter.Match
train
def Match(self, file_entry): """Determines if a file entry matches the filter. Args: file_entry (dfvfs.FileEntry): a file entry.
python
{ "resource": "" }
q25408
BaseParser.GetPluginObjectByName
train
def GetPluginObjectByName(cls, plugin_name): """Retrieves a specific plugin object by its name. Args: plugin_name (str): name of the plugin.
python
{ "resource": "" }
q25409
BaseParser.GetPlugins
train
def GetPlugins(cls): """Retrieves the registered plugins. Yields: tuple[str, type]: name and class of the plugin. """ for plugin_name, plugin_class
python
{ "resource": "" }
q25410
BaseParser.RegisterPlugin
train
def RegisterPlugin(cls, plugin_class): """Registers a plugin class. The plugin classes are identified based on their lower case name. Args: plugin_class (type): class of the plugin. Raises: KeyError: if plugin
python
{ "resource": "" }
q25411
FileEntryParser.Parse
train
def Parse(self, parser_mediator): """Parsers the file entry and extracts event objects. Args: parser_mediator (ParserMediator): a parser mediator. Raises: UnableToParseFile: when the file cannot be parsed. """ file_entry = parser_mediator.GetFileEntry() if not file_entry: rai...
python
{ "resource": "" }
q25412
FileObjectParser.Parse
train
def Parse(self, parser_mediator, file_object): """Parses a single file-like object. Args: parser_mediator (ParserMediator): a parser mediator. file_object (dvfvs.FileIO): a file-like object to parse. Raises: UnableToParseFile: when the file cannot be parsed. """ if not file_objec...
python
{ "resource": "" }
q25413
WinPrefetchParser.ParseFileObject
train
def ParseFileObject(self, parser_mediator, file_object): """Parses a Windows Prefetch file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): file-like object. """ ...
python
{ "resource": "" }
q25414
CCleanerPlugin._ParseUpdateKeyValue
train
def _ParseUpdateKeyValue(self, parser_mediator, registry_value, key_path): """Parses the UpdateKey value. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. registry_value (dfwinreg.WinRegistryValue): Windows Regi...
python
{ "resource": "" }
q25415
HashingAnalyzer.GetResults
train
def GetResults(self): """Retrieves the hashing results. Returns: list[AnalyzerResult]: results. """ results = [] for hasher in self._hashers: logger.debug('Processing results for hasher {0:s}'.format(hasher.NAME)) result = analyzer_result.AnalyzerResult()
python
{ "resource": "" }
q25416
HashingAnalyzer.Reset
train
def Reset(self): """Resets the internal state of the analyzer.""" hasher_names = hashers_manager.HashersManager.GetHasherNamesFromString(
python
{ "resource": "" }
q25417
HashingAnalyzer.SetHasherNames
train
def SetHasherNames(self, hasher_names_string): """Sets the hashers that should be enabled. Args: hasher_names_string (str): comma separated names of hashers to enable. """ hasher_names = hashers_manager.HashersManager.GetHasherNamesFromString( hasher_names_string) debug_hasher_names ...
python
{ "resource": "" }
q25418
SQLiteStorageFileWriter._CreateTaskStorageWriter
train
def _CreateTaskStorageWriter(self, path, task): """Creates a task storage writer. Args: path (str): path to the storage file. task (Task): task. Returns: SQLiteStorageFileWriter:
python
{ "resource": "" }
q25419
L2TCSVOutputModule._FormatField
train
def _FormatField(self, field): """Formats a field. Args: field (str): field value. Returns: str: formatted
python
{ "resource": "" }
q25420
L2TCSVOutputModule._WriteOutputValues
train
def _WriteOutputValues(self, output_values): """Writes values to the output. Args: output_values (list[str]): output values. """ for index, value in enumerate(output_values):
python
{ "resource": "" }
q25421
L2TCSVOutputModule.WriteEventMACBGroup
train
def WriteEventMACBGroup(self, event_macb_group): """Writes an event MACB group to the output. Args: event_macb_group (list[EventObject]): event MACB group. """ output_values = self._GetOutputValues(event_macb_group[0]) timestamp_descriptions
python
{ "resource": "" }
q25422
ChromePreferencesParser._ExtractExtensionInstallEvents
train
def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict (dict[str: object]): settings data from a Preferences file. parser_mediator (ParserMediator): mediates interactions between parsers and other components,...
python
{ "resource": "" }
q25423
ChromePreferencesParser._ExtractContentSettingsExceptions
train
def _ExtractContentSettingsExceptions(self, exceptions_dict, parser_mediator): """Extracts site specific events. Args: exceptions_dict (dict): Permission exceptions data from Preferences file. parser_mediator (ParserMediator): mediates interactions between parsers and other components, su...
python
{ "resource": "" }
q25424
FileSystemArtifactPreprocessorPlugin.Collect
train
def Collect( self, knowledge_base, artifact_definition, searcher, file_system): """Collects values using a file artifact definition. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. artifact_definition (artifacts.ArtifactDefinition): artifact definition. sea...
python
{ "resource": "" }
q25425
FileEntryArtifactPreprocessorPlugin._ParsePathSpecification
train
def _ParsePathSpecification( self, knowledge_base, searcher, file_system, path_specification, path_separator): """Parses a file system for a preprocessing attribute. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. searcher (dfvfs.FileSystemSearcher): file s...
python
{ "resource": "" }
q25426
FileArtifactPreprocessorPlugin._ParseFileEntry
train
def _ParseFileEntry(self, knowledge_base, file_entry): """Parses a file entry for a preprocessing attribute. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. file_entry (dfvfs.FileEntry): file entry that contains the artifact value data. Raises: Pre...
python
{ "resource": "" }
q25427
WindowsRegistryKeyArtifactPreprocessorPlugin.Collect
train
def Collect( self, knowledge_base, artifact_definition, searcher): """Collects values using a Windows Registry value artifact definition. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. artifact_definition (artifacts.ArtifactDefinition): artifact definition. ...
python
{ "resource": "" }
q25428
SAMUsersWindowsRegistryPlugin._ParseFValue
train
def _ParseFValue(self, registry_key): """Parses an F value. Args: registry_key (dfwinreg.WinRegistryKey): Windows Registry key. Returns: f_value: F value stored in the Windows Registry key. Raises: ParseError: if the Windows Registry key does not contain an F value or F va...
python
{ "resource": "" }
q25429
SAMUsersWindowsRegistryPlugin._ParseVValueString
train
def _ParseVValueString( self, parser_mediator, data, user_information_descriptor): """Parses a V value string. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. data (bytes): Windows Registry V value data. ...
python
{ "resource": "" }
q25430
SafariHistoryPluginSqlite.ParsePageVisitRow
train
def ParsePageVisitRow(self, parser_mediator, query, row, **unused_kwargs): """Parses a visited 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.Ro...
python
{ "resource": "" }
q25431
GoogleDrivePlugin.GetLocalPath
train
def GetLocalPath(self, inode, cache, database): """Return local path for a given inode. Args: inode (int): inode number for the file. cache (SQLiteCache): cache. database (SQLiteDatabase): database. Returns: str: full path, including the filename of the given inode value. """ ...
python
{ "resource": "" }
q25432
GoogleDrivePlugin.GetCloudPath
train
def GetCloudPath(self, resource_id, cache, database): """Return cloud path given a resource id. Args: resource_id (str): resource identifier for the file. cache (SQLiteCache): cache. database (SQLiteDatabase): database. Returns: str: full path to the resource value. """ clo...
python
{ "resource": "" }
q25433
GoogleDrivePlugin.ParseCloudEntryRow
train
def ParseCloudEntryRow( self, parser_mediator, query, row, cache=None, database=None, **unused_kwargs): """Parses a cloud entry row. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. query (str): quer...
python
{ "resource": "" }
q25434
GoogleDrivePlugin.ParseLocalEntryRow
train
def ParseLocalEntryRow( self, parser_mediator, query, row, cache=None, database=None, **unused_kwargs): """Parses a local entry row. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. query (str): quer...
python
{ "resource": "" }
q25435
_EventSourceHeap.PopEventSource
train
def PopEventSource(self): """Pops an event source from the heap. Returns: EventSource: an event source or None on if no event source is available. """ try:
python
{ "resource": "" }
q25436
_EventSourceHeap.PushEventSource
train
def PushEventSource(self, event_source): """Pushes an event source onto the heap. Args: event_source (EventSource): event source. """ if event_source.file_entry_type == ( dfvfs_definitions.FILE_ENTRY_TYPE_DIRECTORY):
python
{ "resource": "" }
q25437
TaskMultiProcessEngine._FillEventSourceHeap
train
def _FillEventSourceHeap( self, storage_writer, event_source_heap, start_with_first=False): """Fills the event source heap with the available written event sources. Args: storage_writer (StorageWriter): storage writer for a session storage. event_source_heap (_EventSourceHeap): event source h...
python
{ "resource": "" }
q25438
TaskMultiProcessEngine._MergeTaskStorage
train
def _MergeTaskStorage(self, storage_writer): """Merges a task storage with the session storage. This function checks all task stores that are ready to merge and updates the scheduled tasks. Note that to prevent this function holding up the task scheduling loop only the first available task storage is m...
python
{ "resource": "" }
q25439
TaskMultiProcessEngine._ScheduleTask
train
def _ScheduleTask(self, task): """Schedules a task. Args: task (Task): task. Returns: bool: True if the task was scheduled. """ if self._processing_profiler: self._processing_profiler.StartTiming('schedule_task') try: self._task_queue.PushItem(task, block=False)
python
{ "resource": "" }
q25440
TaskMultiProcessEngine._ScheduleTasks
train
def _ScheduleTasks(self, storage_writer): """Schedules tasks. Args: storage_writer (StorageWriter): storage writer for a session storage. """ logger.debug('Task scheduler started') self._status = definitions.STATUS_INDICATOR_RUNNING # TODO: make tasks persistent. # TODO: protect ta...
python
{ "resource": "" }
q25441
TaskMultiProcessEngine._StopExtractionProcesses
train
def _StopExtractionProcesses(self, abort=False): """Stops the extraction processes. Args: abort (bool): True to indicated the stop is issued on abort. """ logger.debug('Stopping extraction processes.') self._StopMonitoringProcesses() # Note that multiprocessing.Queue is very sensitive re...
python
{ "resource": "" }
q25442
ZshExtendedHistoryParser.VerifyStructure
train
def VerifyStructure(self, parser_mediator, lines): """Verifies whether content corresponds to a Zsh extended_history 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...
python
{ "resource": "" }
q25443
PlistFile.GetValueByPath
train
def GetValueByPath(self, path_segments): """Retrieves a plist value by path. Args: path_segments (list[str]): path segment strings relative to the root of the plist. Returns: object: The value of the key specified by the path or None. """ key = self.root_key for path_segm...
python
{ "resource": "" }
q25444
PlistFile.Read
train
def Read(self, file_object): """Reads a plist from a file-like object. Args: file_object (dfvfs.FileIO): a file-like object containing plist data. Raises: IOError: if the plist file-like object cannot be read. OSError: if the plist file-like object cannot be read. """ try:
python
{ "resource": "" }
q25445
EventFormatter._FormatMessage
train
def _FormatMessage(self, format_string, event_values): """Determines the formatted message string. Args: format_string (str): message format string. event_values (dict[str, object]): event values. Returns: str: formatted message string. """ if not isinstance(format_string, py2to3...
python
{ "resource": "" }
q25446
EventFormatter._FormatMessages
train
def _FormatMessages(self, format_string, short_format_string, event_values): """Determines the formatted message strings. Args: format_string (str): message format string. short_format_string (str): short message format string. event_values (dict[str, object]): event values. Returns: ...
python
{ "resource": "" }
q25447
ConditionalEventFormatter._ConditionalFormatMessages
train
def _ConditionalFormatMessages(self, event_values): """Determines the conditional formatted message strings. Args: event_values (dict[str, object]): event values. Returns: tuple(str, str): formatted message string and short message string. """ # Using getattr here to make sure the attr...
python
{ "resource": "" }
q25448
DateTimeFileEntryFilter.AddDateTimeRange
train
def AddDateTimeRange( self, time_value, start_time_string=None, end_time_string=None): """Adds a date time filter range. The time strings are formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. ...
python
{ "resource": "" }
q25449
SignaturesFileEntryFilter._GetScanner
train
def _GetScanner(self, specification_store, signature_identifiers): """Initializes the scanner form the specification store. Args: specification_store (FormatSpecificationStore): a specification store. signature_identifiers (list[str]): signature identifiers. Returns: pysigscan.scanner: s...
python
{ "resource": "" }
q25450
FileEntryFilterCollection.Matches
train
def Matches(self, file_entry): """Compares the file entry against the filter collection. Args: file_entry (dfvfs.FileEntry): file entry to compare. Returns: bool: True if the file entry matches one of the filters. If no filters are provided or applicable the result will be True. ...
python
{ "resource": "" }
q25451
ZeitgeistActivityDatabasePlugin.ParseZeitgeistEventRow
train
def ParseZeitgeistEventRow( self, parser_mediator, query, row, **unused_kwargs): """Parses a zeitgeist event row. 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": "" }
q25452
WinlogonPlugin._ParseRegisteredDLLs
train
def _ParseRegisteredDLLs(self, parser_mediator, registry_key): """Parses the registered DLLs that receive event notifications. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. registry_key (dfwinreg.WinRegistryK...
python
{ "resource": "" }
q25453
WinlogonPlugin._ParseLogonApplications
train
def _ParseLogonApplications(self, parser_mediator, registry_key): """Parses the registered logon applications. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. registry_key (dfwinreg.WinRegistryKey): Windows Reg...
python
{ "resource": "" }
q25454
AppCompatCacheWindowsRegistryPlugin._CheckSignature
train
def _CheckSignature(self, value_data): """Parses and validates the signature. Args: value_data (bytes): value data. Returns: int: format type or None if format could not be determined. Raises: ParseError: if the value data could not be parsed. """ signature_map = self._GetDa...
python
{ "resource": "" }
q25455
AppCompatCacheWindowsRegistryPlugin._GetCachedEntryDataTypeMap
train
def _GetCachedEntryDataTypeMap( self, format_type, value_data, cached_entry_offset): """Determines the cached entry data type map. Args: format_type (int): format type. value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to...
python
{ "resource": "" }
q25456
AppCompatCacheWindowsRegistryPlugin._ParseCommon2003CachedEntry
train
def _ParseCommon2003CachedEntry(self, value_data, cached_entry_offset): """Parses the cached entry structure common for Windows 2003, Vista and 7. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data...
python
{ "resource": "" }
q25457
AppCompatCacheWindowsRegistryPlugin._ParseCachedEntryXP
train
def _ParseCachedEntryXP(self, value_data, cached_entry_offset): """Parses a Windows XP cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCachedEntr...
python
{ "resource": "" }
q25458
AppCompatCacheWindowsRegistryPlugin._ParseCachedEntry2003
train
def _ParseCachedEntry2003(self, value_data, cached_entry_offset): """Parses a Windows 2003 cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCached...
python
{ "resource": "" }
q25459
AppCompatCacheWindowsRegistryPlugin._ParseCachedEntryVista
train
def _ParseCachedEntryVista(self, value_data, cached_entry_offset): """Parses a Windows Vista cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCach...
python
{ "resource": "" }
q25460
AppCompatCacheWindowsRegistryPlugin._ParseCachedEntry8
train
def _ParseCachedEntry8(self, value_data, cached_entry_offset): """Parses a Windows 8.0 or 8.1 cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCac...
python
{ "resource": "" }
q25461
AppCompatCacheWindowsRegistryPlugin._ParseHeader
train
def _ParseHeader(self, format_type, value_data): """Parses the header. Args: format_type (int): format type. value_data (bytes): value data. Returns: AppCompatCacheHeader: header. Raises: ParseError: if the value data could not be parsed. """ data_type_map_name = self....
python
{ "resource": "" }
q25462
PlistParser.GetTopLevel
train
def GetTopLevel(self, file_object): """Returns the deserialized content of a plist as a dictionary object. Args: file_object (dfvfs.FileIO): a file-like object to parse. Returns: dict[str, object]: contents of the plist. Raises: UnableToParseFile: when the file cannot be parsed. ...
python
{ "resource": "" }
q25463
PlistParser.ParseFileObject
train
def ParseFileObject(self, parser_mediator, file_object): """Parses a plist file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: Un...
python
{ "resource": "" }
q25464
ProcessStatus.UpdateNumberOfEventReports
train
def UpdateNumberOfEventReports( self, number_of_consumed_reports, number_of_produced_reports): """Updates the number of event reports. Args: number_of_consumed_reports (int): total number of event reports consumed by the process. number_of_produced_reports (int): total number of eve...
python
{ "resource": "" }
q25465
ProcessStatus.UpdateNumberOfEvents
train
def UpdateNumberOfEvents( self, number_of_consumed_events, number_of_produced_events): """Updates the number of events. Args: number_of_consumed_events (int): total number of events consumed by the process. number_of_produced_events (int): total number of events produced by ...
python
{ "resource": "" }
q25466
ProcessStatus.UpdateNumberOfEventSources
train
def UpdateNumberOfEventSources( self, number_of_consumed_sources, number_of_produced_sources): """Updates the number of event sources. Args: number_of_consumed_sources (int): total number of event sources consumed by the process. number_of_produced_sources (int): total number of eve...
python
{ "resource": "" }
q25467
ProcessStatus.UpdateNumberOfEventTags
train
def UpdateNumberOfEventTags( self, number_of_consumed_event_tags, number_of_produced_event_tags): """Updates the number of event tags. Args: number_of_consumed_event_tags (int): total number of event tags consumed by the process. number_of_produced_event_tags (int): total number of ...
python
{ "resource": "" }
q25468
ProcessStatus.UpdateNumberOfWarnings
train
def UpdateNumberOfWarnings( self, number_of_consumed_warnings, number_of_produced_warnings): """Updates the number of warnings. Args: number_of_consumed_warnings (int): total number of warnings consumed by the process. number_of_produced_warnings (int): total number of warnings prod...
python
{ "resource": "" }
q25469
ProcessingStatus.workers_status
train
def workers_status(self): """The worker status objects sorted by identifier.""" return [self._workers_status[identifier]
python
{ "resource": "" }
q25470
ProcessingStatus._UpdateProcessStatus
train
def _UpdateProcessStatus( self, process_status, identifier, status, pid, used_memory, display_name, number_of_consumed_sources, number_of_produced_sources, number_of_consumed_events, number_of_produced_events, number_of_consumed_event_tags, number_of_produced_event_tags, number_of_consumed...
python
{ "resource": "" }
q25471
ProcessingStatus.UpdateForemanStatus
train
def UpdateForemanStatus( self, identifier, status, pid, used_memory, display_name, number_of_consumed_sources, number_of_produced_sources, number_of_consumed_events, number_of_produced_events, number_of_consumed_event_tags, number_of_produced_event_tags, number_of_consumed_reports, number_...
python
{ "resource": "" }
q25472
ProcessingStatus.UpdateWorkerStatus
train
def UpdateWorkerStatus( self, identifier, status, pid, used_memory, display_name, number_of_consumed_sources, number_of_produced_sources, number_of_consumed_events, number_of_produced_events, number_of_consumed_event_tags, number_of_produced_event_tags, number_of_consumed_reports, number_o...
python
{ "resource": "" }
q25473
WindowsRegistryKeyPathFilter.key_paths
train
def key_paths(self): """List of key paths defined by the filter.""" if self._wow64_key_path:
python
{ "resource": "" }
q25474
WindowsRegistryPlugin.Process
train
def Process(self, parser_mediator, registry_key, **kwargs): """Processes a Windows Registry key or value. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. registry_key (dfwinreg.WinRegistryKey): Windows Registry...
python
{ "resource": "" }
q25475
WindowsRegistryPlugin.UpdateChainAndProcess
train
def UpdateChainAndProcess(self, parser_mediator, registry_key, **kwargs): """Updates the parser chain and processes a Windows Registry key or value. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. registry_key ...
python
{ "resource": "" }
q25476
NTFSMFTParser._GetDateTime
train
def _GetDateTime(self, filetime): """Retrieves the date and time from a FILETIME timestamp. Args: filetime (int): FILETIME timestamp. Returns: dfdatetime.DateTimeValues: date and time. """ if filetime == 0: return
python
{ "resource": "" }
q25477
NTFSUsnJrnlParser._ParseUSNChangeJournal
train
def _ParseUSNChangeJournal(self, parser_mediator, usn_change_journal): """Parses an USN change journal. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. usn_change_journal (pyfsntsfs.usn_change_journal): USN cha...
python
{ "resource": "" }
q25478
ShellItemsParser._ParseShellItem
train
def _ParseShellItem(self, parser_mediator, shell_item): """Parses a shell item. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. shell_item (pyfwsi.item): shell item. """ path_segment = self._ParseShellI...
python
{ "resource": "" }
q25479
ShellItemsParser._ParseShellItemPathSegment
train
def _ParseShellItemPathSegment(self, shell_item): """Parses a shell item path segment. Args: shell_item (pyfwsi.item): shell item. Returns: str: shell item path segment. """ path_segment = None if isinstance(shell_item, pyfwsi.root_folder): description = shell_folder_ids.DES...
python
{ "resource": "" }
q25480
ShellItemsParser.CopyToPath
train
def CopyToPath(self): """Copies the shell items to a path. Returns: str: converted shell item list path or None. """ number_of_path_segments = len(self._path_segments) if number_of_path_segments == 0: return None strings = [self._path_segments[0]] number_of_path_segments -= 1 ...
python
{ "resource": "" }
q25481
ShellItemsParser.ParseByteStream
train
def ParseByteStream( self, parser_mediator, byte_stream, parent_path_segments=None, codepage='cp1252'): """Parses the shell items from the byte stream. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. ...
python
{ "resource": "" }
q25482
SyslogParser._UpdateYear
train
def _UpdateYear(self, mediator, month): """Updates the year to use for events, based on last observed month. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. month (int): month observed by the parser, where...
python
{ "resource": "" }
q25483
SyslogParser.VerifyStructure
train
def VerifyStructure(self, parser_mediator, lines): """Verifies that this is a syslog-formatted 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. Retur...
python
{ "resource": "" }
q25484
SerializedEventHeap.PushEvent
train
def PushEvent(self, timestamp, event_data): """Pushes a serialized event onto the heap. Args: timestamp (int): event timestamp, which contains the number of
python
{ "resource": "" }
q25485
KnowledgeBase.AddUserAccount
train
def AddUserAccount(self, user_account, session_identifier=CURRENT_SESSION): """Adds an user account. Args: user_account (UserAccountArtifact): user account artifact. session_identifier (Optional[str])): session identifier, where CURRENT_SESSION represents the active session. Raises: ...
python
{ "resource": "" }
q25486
KnowledgeBase.AddEnvironmentVariable
train
def AddEnvironmentVariable(self, environment_variable): """Adds an environment variable. Args: environment_variable (EnvironmentVariableArtifact): environment variable artifact. Raises: KeyError: if the environment variable already exists. """ name = environment_variable.name...
python
{ "resource": "" }
q25487
KnowledgeBase.GetEnvironmentVariable
train
def GetEnvironmentVariable(self, name): """Retrieves an environment variable. Args: name (str): name of the environment variable. Returns: EnvironmentVariableArtifact: environment variable artifact or None
python
{ "resource": "" }
q25488
KnowledgeBase.GetStoredHostname
train
def GetStoredHostname(self): """Retrieves the stored hostname. The hostname is determined based on the preprocessing information that is stored inside the storage file. Returns:
python
{ "resource": "" }
q25489
KnowledgeBase.GetSystemConfigurationArtifact
train
def GetSystemConfigurationArtifact(self, session_identifier=CURRENT_SESSION): """Retrieves the knowledge base as a system configuration artifact. Args: session_identifier (Optional[str])): session identifier, where CURRENT_SESSION represents the active session. Returns: SystemConfigu...
python
{ "resource": "" }
q25490
KnowledgeBase.GetUsernameByIdentifier
train
def GetUsernameByIdentifier( self, user_identifier, session_identifier=CURRENT_SESSION): """Retrieves the username based on an user identifier. Args: user_identifier (str): user identifier, either a UID or SID. session_identifier (Optional[str])): session identifier, where CURRENT_S...
python
{ "resource": "" }
q25491
KnowledgeBase.GetUsernameForPath
train
def GetUsernameForPath(self, path): """Retrieves a username for a specific path. This is determining if a specific path is within a user's directory and returning the username of the user if so. Args: path (str): path. Returns: str: username or None if the path does not appear to be w...
python
{ "resource": "" }
q25492
KnowledgeBase.GetValue
train
def GetValue(self, identifier, default_value=None): """Retrieves a value by identifier. Args: identifier (str): case insensitive unique identifier for the value. default_value (object): default value. Returns: object: value or default value if not available. Raises: TypeError:...
python
{ "resource": "" }
q25493
KnowledgeBase.ReadSystemConfigurationArtifact
train
def ReadSystemConfigurationArtifact( self, system_configuration, session_identifier=CURRENT_SESSION): """Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifac...
python
{ "resource": "" }
q25494
KnowledgeBase.SetCodepage
train
def SetCodepage(self, codepage): """Sets the codepage. Args: codepage (str): codepage. Raises: ValueError: if the codepage is not supported. """ try:
python
{ "resource": "" }
q25495
KnowledgeBase.SetEnvironmentVariable
train
def SetEnvironmentVariable(self, environment_variable): """Sets an environment variable. Args: environment_variable (EnvironmentVariableArtifact): environment variable artifact.
python
{ "resource": "" }
q25496
KnowledgeBase.SetTimeZone
train
def SetTimeZone(self, time_zone): """Sets the time zone. Args: time_zone (str): time zone. Raises: ValueError: if the timezone is not supported. """ try:
python
{ "resource": "" }
q25497
KnowledgeBase.SetValue
train
def SetValue(self, identifier, value): """Sets a value by identifier. Args: identifier (str): case insensitive unique identifier for the value. value (object): value.
python
{ "resource": "" }
q25498
AnalysisPluginOptions._CreateAnalysisPlugins
train
def _CreateAnalysisPlugins(self, options): """Creates the analysis plugins. Args: options (argparse.Namespace): command line arguments. Returns: dict[str, AnalysisPlugin]: analysis plugins and their names. """ if not self._analysis_plugins: return {} analysis_plugins = ( ...
python
{ "resource": "" }
q25499
AnalysisPluginOptions.ListAnalysisPlugins
train
def ListAnalysisPlugins(self): """Lists the analysis modules.""" analysis_plugin_info = ( analysis_manager.AnalysisPluginManager.GetAllPluginInformation()) column_width = 10 for name, _, _ in analysis_plugin_info: if len(name) > column_width: column_width = len(name) table_vi...
python
{ "resource": "" }