_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q25600
AnalysisPluginManager.GetAllPluginInformation
train
def GetAllPluginInformation(cls, show_all=True): """Retrieves a list of the registered analysis plugins. Args: show_all (Optional[bool]): True if all analysis plugin names should be listed. Returns: list[tuple[str, str, str]]: the name, docstring and type string of each ana...
python
{ "resource": "" }
q25601
AnalysisPluginManager.GetPluginObjects
train
def GetPluginObjects(cls, plugin_names): """Retrieves the plugin objects. Args: plugin_names (list[str]): names of plugins that should be retrieved. Returns: dict[str, AnalysisPlugin]: analysis plugins per name. """ plugin_objects = {}
python
{ "resource": "" }
q25602
CompoundZIPPlugin.Process
train
def Process(self, parser_mediator, zip_file, archive_members): """Determines if this is the correct plugin; if so proceed with processing. This method checks if the zip file being contains the paths specified in REQUIRED_PATHS. If all paths are present, the plugin logic processing continues in InspectZ...
python
{ "resource": "" }
q25603
PinfoTool._CalculateStorageCounters
train
def _CalculateStorageCounters(self, storage_reader): """Calculates the counters of the entire storage. Args: storage_reader (StorageReader): storage reader. Returns: dict[str,collections.Counter]: storage counters. """ analysis_reports_counter = collections.Counter() analysis_repor...
python
{ "resource": "" }
q25604
PinfoTool._PrintAnalysisReportsDetails
train
def _PrintAnalysisReportsDetails(self, storage_reader): """Prints the details of the analysis reports. Args: storage_reader (StorageReader): storage reader. """ if not storage_reader.HasAnalysisReports(): self._output_writer.Write('No analysis reports stored.\n\n') return for ind...
python
{ "resource": "" }
q25605
PinfoTool._PrintWarningCounters
train
def _PrintWarningCounters(self, storage_counters): """Prints a summary of the warnings. Args: storage_counters (dict): storage counters. """ warnings_by_pathspec = storage_counters.get('warnings_by_path_spec', {}) warnings_by_parser_chain = storage_counters.get( 'warnings_by_parser_ch...
python
{ "resource": "" }
q25606
PinfoTool._PrintWarningsDetails
train
def _PrintWarningsDetails(self, storage): """Prints the details of the warnings. Args: storage (BaseStore): storage. """ if not storage.HasWarnings(): self._output_writer.Write('No warnings stored.\n\n') return for index, warning in enumerate(storage.GetWarnings()): title =...
python
{ "resource": "" }
q25607
PinfoTool._PrintEventLabelsCounter
train
def _PrintEventLabelsCounter( self, event_labels_counter, session_identifier=None): """Prints the event labels counter. Args: event_labels_counter (collections.Counter): number of event tags per label. session_identifier (Optional[str]): session identifier. """ if not event_...
python
{ "resource": "" }
q25608
PinfoTool._PrintParsersCounter
train
def _PrintParsersCounter(self, parsers_counter, session_identifier=None): """Prints the parsers counter Args: parsers_counter (collections.Counter): number of events per parser or parser plugin. session_identifier (Optional[str]): session identifier. """ if not parsers_counter: ...
python
{ "resource": "" }
q25609
PinfoTool._PrintPreprocessingInformation
train
def _PrintPreprocessingInformation(self, storage_reader, session_number=None): """Prints the details of the preprocessing information. Args: storage_reader (StorageReader): storage reader. session_number (Optional[int]): session number. """ knowledge_base_object = knowledge_base.KnowledgeBa...
python
{ "resource": "" }
q25610
PinfoTool._PrintSessionsDetails
train
def _PrintSessionsDetails(self, storage_reader): """Prints the details of the sessions. Args: storage_reader (BaseStore): storage. """ for session_number, session in enumerate(storage_reader.GetSessions()): session_identifier = uuid.UUID(hex=session.identifier) session_identifier = '{...
python
{ "resource": "" }
q25611
PinfoTool._PrintSessionsOverview
train
def _PrintSessionsOverview(self, storage_reader): """Prints a sessions overview. Args: storage_reader (StorageReader): storage reader. """ table_view = views.ViewsFactory.GetTableView( self._views_format_type, title='Sessions') for session in storage_reader.GetSessions(): start...
python
{ "resource": "" }
q25612
PinfoTool._PrintStorageInformationAsText
train
def _PrintStorageInformationAsText(self, storage_reader): """Prints information about the store as human-readable text. Args: storage_reader (StorageReader): storage reader. """ table_view = views.ViewsFactory.GetTableView( self._views_format_type, title='Plaso Storage Information') t...
python
{ "resource": "" }
q25613
PinfoTool._PrintStorageInformationAsJSON
train
def _PrintStorageInformationAsJSON(self, storage_reader): """Writes a summary of sessions as machine-readable JSON. Args: storage_reader (StorageReader): storage reader. """ serializer = json_serializer.JSONAttributeContainerSerializer storage_counters = self._CalculateStorageCounters(storage...
python
{ "resource": "" }
q25614
PinfoTool._PrintTasksInformation
train
def _PrintTasksInformation(self, storage_reader): """Prints information about the tasks. Args: storage_reader (StorageReader): storage reader. """ table_view = views.ViewsFactory.GetTableView( self._views_format_type, title='Tasks') for task_start, _ in storage_reader.GetSessions(): ...
python
{ "resource": "" }
q25615
PinfoTool.PrintStorageInformation
train
def PrintStorageInformation(self): """Prints the storage information.""" storage_reader = storage_factory.StorageFactory.CreateStorageReaderForFile( self._storage_file_path) if not storage_reader: logger.error( 'Format of storage file: {0:s} not supported'.format( self....
python
{ "resource": "" }
q25616
FileStatParser._GetFileSystemTypeFromFileEntry
train
def _GetFileSystemTypeFromFileEntry(self, file_entry): """Retrieves the file system type indicator of a file entry. Args: file_entry (dfvfs.FileEntry): a file entry. Returns: str: file system type. """ if file_entry.type_indicator != dfvfs_definitions.TYPE_INDICATOR_TSK: return f...
python
{ "resource": "" }
q25617
FileStatParser.ParseFileEntry
train
def ParseFileEntry(self, parser_mediator, file_entry): """Parses a file entry. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_entry (dfvfs.FileEntry): a file entry. """ stat_object = file_entry.Ge...
python
{ "resource": "" }
q25618
BSMParser._FormatArgToken
train
def _FormatArgToken(self, token_data): """Formats an argument token as a dictionary of values. Args: token_data (bsm_token_data_arg32|bsm_token_data_arg64): AUT_ARG32 or AUT_ARG64 token data. Returns: dict[str, str]: token values. """
python
{ "resource": "" }
q25619
BSMParser._FormatAttrToken
train
def _FormatAttrToken(self, token_data): """Formats an attribute token as a dictionary of values. Args: token_data (bsm_token_data_attr32|bsm_token_data_attr64): AUT_ATTR32 or AUT_ATTR64 token data. Returns: dict[str, str]: token values. """ return { 'mode': token_data...
python
{ "resource": "" }
q25620
BSMParser._FormatDataToken
train
def _FormatDataToken(self, token_data): """Formats a data token as a dictionary of values. Args: token_data (bsm_token_data_data): AUT_DATA token data. Returns: dict[str, str]: token values. """ format_string = bsmtoken.BSM_TOKEN_DATA_PRINT.get(
python
{ "resource": "" }
q25621
BSMParser._FormatInAddrExToken
train
def _FormatInAddrExToken(self, token_data): """Formats an extended IPv4 address token as a dictionary of values. Args: token_data (bsm_token_data_in_addr_ex): AUT_IN_ADDR_EX token data. Returns: dict[str, str]: token values. """ protocol = bsmtoken.BSM_PROTOCOLS.get(token_data.net_type...
python
{ "resource": "" }
q25622
BSMParser._FormatIPCPermToken
train
def _FormatIPCPermToken(self, token_data): """Formats an IPC permissions token as a dictionary of values. Args: token_data (bsm_token_data_ipc_perm): AUT_IPC_PERM token data. Returns: dict[str, str]: token values. """ return { 'user_id': token_data.user_identifier, 'gro...
python
{ "resource": "" }
q25623
BSMParser._FormatIPToken
train
def _FormatIPToken(self, token_data): """Formats an IPv4 packet header token as a dictionary of values. Args: token_data (bsm_token_data_ip): AUT_IP token data. Returns: dict[str, str]:
python
{ "resource": "" }
q25624
BSMParser._FormatOpaqueToken
train
def _FormatOpaqueToken(self, token_data): """Formats an opaque token as a dictionary of values. Args: token_data (bsm_token_data_opaque): AUT_OPAQUE token data. Returns: dict[str, str]: token
python
{ "resource": "" }
q25625
BSMParser._FormatOtherFileToken
train
def _FormatOtherFileToken(self, token_data): """Formats an other file token as a dictionary of values. Args: token_data (bsm_token_data_other_file32): AUT_OTHER_FILE32 token data. Returns: dict[str, str]: token values. """ # TODO: if this timestamp is useful, it must be extracted as a ...
python
{ "resource": "" }
q25626
BSMParser._FormatReturnOrExitToken
train
def _FormatReturnOrExitToken(self, token_data): """Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: dict[str...
python
{ "resource": "" }
q25627
BSMParser._FormatSocketExToken
train
def _FormatSocketExToken(self, token_data): """Formats an extended socket token as a dictionary of values. Args: token_data (bsm_token_data_socket_ex): AUT_SOCKET_EX token data. Returns: dict[str, str]: token values. """ if token_data.socket_domain == 10: local_ip_address = self....
python
{ "resource": "" }
q25628
BSMParser._FormatSocketUnixToken
train
def _FormatSocketUnixToken(self, token_data): """Formats an Unix socket token as a dictionary of values. Args: token_data (bsm_token_data_sockunix): AUT_SOCKUNIX token data. Returns: dict[str, str]: token values.
python
{ "resource": "" }
q25629
BSMParser._FormatTokenData
train
def _FormatTokenData(self, token_type, token_data): """Formats the token data as a dictionary of values. Args: token_type (int): token type. token_data (object): token data. Returns: dict[str, str]: formatted token values or an empty dictionary if no formatted token values coul...
python
{ "resource": "" }
q25630
BSMParser._ParseRecord
train
def _ParseRecord(self, parser_mediator, file_object): """Parses an event record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): file-like object. Raises: ParseError: if t...
python
{ "resource": "" }
q25631
BSMParser._ParseToken
train
def _ParseToken(self, file_object, file_offset): """Parses a token. Args: file_object (dfvfs.FileIO): file-like object. file_offset (int): offset of the token relative to the start of the file-like object. Returns: tuple: containing: int: token type object: toke...
python
{ "resource": "" }
q25632
BSMParser._ParseTokenType
train
def _ParseTokenType(self, file_object, file_offset): """Parses a token type. Args: file_object (dfvfs.FileIO): file-like object. file_offset (int): offset of the token relative to the start of the file-like object. Returns: int: token type
python
{ "resource": "" }
q25633
BSMParser.ParseFileObject
train
def ParseFileObject(self, parser_mediator, file_object): """Parses a BSM 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: Unab...
python
{ "resource": "" }
q25634
SymantecParser._GetTimeElementsTuple
train
def _GetTimeElementsTuple(self, timestamp): """Retrieves a time elements tuple from the timestamp. A Symantec log timestamp consist of six hexadecimal octets, that represent: First octet: Number of years since 1970 Second octet: Month, where January is represented by 0 Third octet: Day of the...
python
{ "resource": "" }
q25635
SpotlightVolumePlugin.GetEntries
train
def GetEntries(self, parser_mediator, match=None, **unused_kwargs): """Extracts relevant Volume Configuration Spotlight entries. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. match (Optional[dict[str: object]...
python
{ "resource": "" }
q25636
TransmissionPlugin.GetEntries
train
def GetEntries(self, parser_mediator, data=None, **unused_kwargs): """Extract data from Transmission's resume folder files. This is the main parsing engine for the parser. It determines if the selected file is the proper file to parse and extracts current running torrents. Transmission stores an i...
python
{ "resource": "" }
q25637
ExtractionTool._CreateProcessingConfiguration
train
def _CreateProcessingConfiguration(self, knowledge_base): """Creates a processing configuration. Args: knowledge_base (KnowledgeBase): contains information from the source data needed for parsing. Returns: ProcessingConfiguration: processing configuration. Raises: BadConfi...
python
{ "resource": "" }
q25638
ExtractionTool._ParsePerformanceOptions
train
def _ParsePerformanceOptions(self, options): """Parses the performance options. Args: options (argparse.Namespace): command line arguments. Raises: BadConfigOption: if the options are invalid. """ self._buffer_size = getattr(options, 'buffer_size', 0) if self._buffer_size: # ...
python
{ "resource": "" }
q25639
ExtractionTool._ReadParserPresetsFromFile
train
def _ReadParserPresetsFromFile(self): """Reads the parser presets from the presets.yaml file. Raises: BadConfigOption: if the parser presets file cannot be read. """ self._presets_file = os.path.join( self._data_location, self._PRESETS_FILE_NAME) if not os.path.isfile(self._presets_fi...
python
{ "resource": "" }
q25640
ExtractionTool._SetExtractionParsersAndPlugins
train
def _SetExtractionParsersAndPlugins(self, configuration, session): """Sets the parsers and plugins before extraction. Args: configuration (ProcessingConfiguration): processing configuration. session (Session): session. """ names_generator = parsers_manager.ParsersManager.GetParserAndPluginN...
python
{ "resource": "" }
q25641
ExtractionTool._SetExtractionPreferredTimeZone
train
def _SetExtractionPreferredTimeZone(self, knowledge_base): """Sets the preferred time zone before extraction. Args: knowledge_base (KnowledgeBase): contains information from the source data needed for parsing. """ # Note session.preferred_time_zone will default to UTC but # self._pr...
python
{ "resource": "" }
q25642
ExtractionTool.AddPerformanceOptions
train
def AddPerformanceOptions(self, argument_group): """Adds the performance options to the argument group. Args: argument_group (argparse._ArgumentGroup): argparse argument group. """ argument_group.add_argument( '--buffer_size', '--buffer-size', '--bs', dest='buffer_size', action='s...
python
{ "resource": "" }
q25643
ExtractionTool.AddProcessingOptions
train
def AddProcessingOptions(self, argument_group): """Adds the processing options to the argument group. Args: argument_group (argparse._ArgumentGroup): argparse argument group. """ argument_group.add_argument( '--single_process', '--single-process', dest='single_process', action='st...
python
{ "resource": "" }
q25644
ExtractionTool.ListParsersAndPlugins
train
def ListParsersAndPlugins(self): """Lists information about the available parsers and plugins.""" parsers_information = parsers_manager.ParsersManager.GetParsersInformation() table_view = views.ViewsFactory.GetTableView( self._views_format_type, column_names=['Name', 'Description'], title='...
python
{ "resource": "" }
q25645
XChatLogParser._ParseHeader
train
def _ParseHeader(self, parser_mediator, structure): """Parses a log header. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. structure (pyparsing.ParseResults): structure of tokens derived from a line ...
python
{ "resource": "" }
q25646
XChatLogParser.VerifyStructure
train
def VerifyStructure(self, parser_mediator, line): """Verify that this file is a XChat log file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. line (str): line from a text file. Returns: bool: True ...
python
{ "resource": "" }
q25647
CustomDestinationsParser._ParseLNKFile
train
def _ParseLNKFile( self, parser_mediator, file_entry, file_offset, remaining_file_size): """Parses a LNK file stored within the .customDestinations-ms file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. ...
python
{ "resource": "" }
q25648
HangoutsMessagePlugin.ParseMessagesRow
train
def ParseMessagesRow(self, parser_mediator, query, row, **unused_kwargs): """Parses an Messages 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.R...
python
{ "resource": "" }
q25649
SharedElasticsearchOutputModule._Connect
train
def _Connect(self): """Connects to an Elasticsearch server.""" elastic_host = {'host': self._host, 'port': self._port} if self._url_prefix: elastic_host['url_prefix'] = self._url_prefix elastic_http_auth = None if self._username is not None: elastic_http_auth = (self._username, self._p...
python
{ "resource": "" }
q25650
SharedElasticsearchOutputModule._CreateIndexIfNotExists
train
def _CreateIndexIfNotExists(self, index_name, mappings): """Creates an Elasticsearch index if it does not exist. Args: index_name (str): mame of the index. mappings (dict[str, object]): mappings of the index. Raises: RuntimeError: if the Elasticsearch index cannot be created. """ ...
python
{ "resource": "" }
q25651
SharedElasticsearchOutputModule._FlushEvents
train
def _FlushEvents(self): """Inserts the buffered event documents into Elasticsearch.""" try: # pylint: disable=unexpected-keyword-arg # pylint does not recognizes request_timeout as a valid kwarg. According # to http://elasticsearch-py.readthedocs.io/en/master/api.html#timeout # it should...
python
{ "resource": "" }
q25652
SharedElasticsearchOutputModule._GetSanitizedEventValues
train
def _GetSanitizedEventValues(self, event): """Sanitizes the event for use in Elasticsearch. The event values need to be sanitized to prevent certain values from causing problems when indexing with Elasticsearch. For example the path specification is a nested dictionary which will cause problems for ...
python
{ "resource": "" }
q25653
SharedElasticsearchOutputModule._InsertEvent
train
def _InsertEvent(self, event, force_flush=False): """Inserts an event. Events are buffered in the form of documents and inserted to Elasticsearch when either forced to flush or when the flush interval (threshold) has been reached. Args: event (EventObject): event. force_flush (bool): T...
python
{ "resource": "" }
q25654
SharedElasticsearchOutputModule.SetDocumentType
train
def SetDocumentType(self, document_type): """Sets the document type. Args: document_type (str):
python
{ "resource": "" }
q25655
SharedElasticsearchOutputModule.SetFlushInterval
train
def SetFlushInterval(self, flush_interval): """Set the flush interval. Args: flush_interval (int): number of events to buffer before doing a bulk insert.
python
{ "resource": "" }
q25656
SharedElasticsearchOutputModule.SetIndexName
train
def SetIndexName(self, index_name): """Set the index name. Args: index_name (str): name of the index. """ self._index_name = index_name
python
{ "resource": "" }
q25657
SharedElasticsearchOutputModule.SetServerInformation
train
def SetServerInformation(self, server, port): """Set the server information. Args: server (str): IP address or hostname of the server.
python
{ "resource": "" }
q25658
SharedElasticsearchOutputModule.SetUsername
train
def SetUsername(self, username): """Sets the username. Args: username (str): username
python
{ "resource": "" }
q25659
SharedElasticsearchOutputModule.SetUseSSL
train
def SetUseSSL(self, use_ssl): """Sets the use of ssl. Args: use_ssl (bool): enforces
python
{ "resource": "" }
q25660
SharedElasticsearchOutputModule.SetCACertificatesPath
train
def SetCACertificatesPath(self, ca_certificates_path): """Sets the path to the CA certificates. Args: ca_certificates_path (str): path to file containing a list of root certificates to trust. Raises: BadConfigOption: if the CA certificates file does not exist. """ if not ca_cer...
python
{ "resource": "" }
q25661
LsQuarantinePlugin.ParseLSQuarantineRow
train
def ParseLSQuarantineRow( self, parser_mediator, query, row, **unused_kwargs): """Parses a launch services quarantine event row. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. query (str): query that cre...
python
{ "resource": "" }
q25662
MacOSSecuritydLogParser.VerifyStructure
train
def VerifyStructure(self, parser_mediator, line): """Verify that this file is a securityd log file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. line (str): line from a text file. Returns: bool: T...
python
{ "resource": "" }
q25663
FormatterMediator._GetWinevtRcDatabaseReader
train
def _GetWinevtRcDatabaseReader(self): """Opens the Windows Event Log resource database reader. Returns: WinevtResourcesSqlite3DatabaseReader: Windows Event Log resource database reader or None. """ if not self._winevt_database_reader and self._data_location: database_path = os.pat...
python
{ "resource": "" }
q25664
FormatterMediator.GetWindowsEventMessage
train
def GetWindowsEventMessage(self, log_source, message_identifier): """Retrieves the message string for a specific Windows Event Log source. Args: log_source (str): Event Log source, such as "Application Error". message_identifier (int): message identifier. Returns: str: message string or ...
python
{ "resource": "" }
q25665
FormatterMediator.SetPreferredLanguageIdentifier
train
def SetPreferredLanguageIdentifier(self, language_identifier): """Sets the preferred language identifier. Args: language_identifier (str): language identifier string such as "en-US" for US English or "is-IS" for Icelandic. Raises: KeyError: if the language identifier is not defined. ...
python
{ "resource": "" }
q25666
ArgumentHelperManager.AddCommandLineArguments
train
def AddCommandLineArguments( cls, argument_group, category=None, names=None): """Adds command line arguments to a configuration object. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group. category (Optional[str]): category of helpers to apply to ...
python
{ "resource": "" }
q25667
ArgumentHelperManager.DeregisterHelper
train
def DeregisterHelper(cls, helper_class): """Deregisters a helper class. The helper classes are identified based on their lower case name. Args: helper_class (type): class object of the argument helper. Raises: KeyError: if helper class is not set for the corresponding name. """ he...
python
{ "resource": "" }
q25668
ArgumentHelperManager.ParseOptions
train
def ParseOptions(cls, options, config_object, category=None, names=None): """Parses and validates arguments using the appropriate helpers. Args: options (argparse.Namespace): parser options. config_object (object): object to be configured by an argument helper. category (Optional[str]): categ...
python
{ "resource": "" }
q25669
ViperAnalyzer._QueryHash
train
def _QueryHash(self, digest): """Queries the Viper Server for a specfic hash. Args: digest (str): hash to look up. Returns: dict[str, object]: JSON response or None on error. """ if not self._url: self._url = '{0:s}://{1:s}:{2:d}/file/find'.format( self._protocol, self....
python
{ "resource": "" }
q25670
ViperAnalyzer.Analyze
train
def Analyze(self, hashes): """Looks up hashes in Viper using the Viper HTTP API. Args: hashes (list[str]): hashes to look up. Returns: list[HashAnalysis]: hash analysis. Raises: RuntimeError: If no host has been set for Viper. """ hash_analyses = [] for digest in hashes:
python
{ "resource": "" }
q25671
KeychainParser._ReadAttributeValueDateTime
train
def _ReadAttributeValueDateTime( self, attribute_values_data, record_offset, attribute_values_data_offset, attribute_value_offset): """Reads a date time attribute value. Args: attribute_values_data (bytes): attribute values data. record_offset (int): offset of the record relative to the...
python
{ "resource": "" }
q25672
KeychainParser._ReadAttributeValueInteger
train
def _ReadAttributeValueInteger( self, attribute_values_data, record_offset, attribute_values_data_offset, attribute_value_offset): """Reads an integer attribute value. Args: attribute_values_data (bytes): attribute values data. record_offset (int): offset of the record relative to the s...
python
{ "resource": "" }
q25673
KeychainParser._ReadAttributeValueString
train
def _ReadAttributeValueString( self, attribute_values_data, record_offset, attribute_values_data_offset, attribute_value_offset): """Reads a string attribute value. Args: attribute_values_data (bytes): attribute values data. record_offset (int): offset of the record relative to the star...
python
{ "resource": "" }
q25674
KeychainParser._ReadFileHeader
train
def _ReadFileHeader(self, file_object): """Reads the file header. Args: file_object (file): file-like object. Returns: keychain_file_header: file header. Raises: ParseError: if the file header cannot be read. """ data_type_map = self._GetDataTypeMap('keychain_file_header') ...
python
{ "resource": "" }
q25675
KeychainParser._ReadRecord
train
def _ReadRecord(self, tables, file_object, record_offset, record_type): """Reads the record. Args: tables (dict[int, KeychainDatabaseTable]): tables per identifier. file_object (file): file-like object. record_offset (int): offset of the record relative to the start of the file. ...
python
{ "resource": "" }
q25676
KeychainParser._ReadRecordAttributeValueOffset
train
def _ReadRecordAttributeValueOffset( self, file_object, file_offset, number_of_attribute_values): """Reads the record attribute value offsets. Args: file_object (file): file-like object. file_offset (int): offset of the record attribute values offsets relative to the start of the fi...
python
{ "resource": "" }
q25677
KeychainParser._ReadRecordHeader
train
def _ReadRecordHeader(self, file_object, record_header_offset): """Reads the record header. Args: file_object (file): file-like object. record_header_offset (int): offset of the record header relative to the start of the file. Returns: keychain_record_header: record header. ...
python
{ "resource": "" }
q25678
KeychainParser._ReadTable
train
def _ReadTable(self, tables, file_object, table_offset): """Reads the table. Args: tables (dict[int, KeychainDatabaseTable]): tables per identifier. file_object (file): file-like object. table_offset (int): offset of the table relative to the start of the file. Raises: Pa...
python
{ "resource": "" }
q25679
KeychainParser._ReadTableHeader
train
def _ReadTableHeader(self, file_object, table_header_offset): """Reads the table header. Args: file_object (file): file-like object. table_header_offset (int): offset of the tables header relative to the start of the file. Returns: keychain_table_header: table header. Rais...
python
{ "resource": "" }
q25680
KeychainParser._ReadTablesArray
train
def _ReadTablesArray(self, file_object, tables_array_offset): """Reads the tables array. Args: file_object (file): file-like object. tables_array_offset (int): offset of the tables array relative to the start of the file. Returns: dict[int, KeychainDatabaseTable]: tables per id...
python
{ "resource": "" }
q25681
KeychainParser._ParseDateTimeValue
train
def _ParseDateTimeValue(self, parser_mediator, date_time_value): """Parses a date time value. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. date_time_value (str): date time value (CSSM_DB_ATTRIBUTE_...
python
{ "resource": "" }
q25682
KeychainParser._ParseBinaryDataAsString
train
def _ParseBinaryDataAsString(self, parser_mediator, binary_data_value): """Parses a binary data value as string Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. binary_data_value (bytes): binary data value ...
python
{ "resource": "" }
q25683
KeychainParser._ParseApplicationPasswordRecord
train
def _ParseApplicationPasswordRecord(self, parser_mediator, record): """Extracts the information from an application password record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. record (dict[str, object]): d...
python
{ "resource": "" }
q25684
KeychainParser._ParseInternetPasswordRecord
train
def _ParseInternetPasswordRecord(self, parser_mediator, record): """Extracts the information from an Internet password record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. record (dict[str, object]): databas...
python
{ "resource": "" }
q25685
KeychainParser.ParseFileObject
train
def ParseFileObject(self, parser_mediator, file_object): """Parses a MacOS keychain 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:...
python
{ "resource": "" }
q25686
Shared4n6TimeOutputModule._FormatDateTime
train
def _FormatDateTime(self, event): """Formats the date and time. Args: event (EventObject): event. Returns: str: date and time string or "N/A" if no event timestamp is available. """ if not event.timestamp: return 'N/A' # TODO: preserve dfdatetime as an object. # TODO: ad...
python
{ "resource": "" }
q25687
SQLite4n6TimeOutputModule._GetDistinctValues
train
def _GetDistinctValues(self, field_name): """Query database for unique field types. Args: field_name (str): name of the filed to retrieve. Returns: dict[str, int]: counts of field types by name. """ self._cursor.execute( 'SELECT {0:s}, COUNT({0:s}) FROM log2timeline GROUP BY {0...
python
{ "resource": "" }
q25688
SQLite4n6TimeOutputModule._ListTags
train
def _ListTags(self): """Query database for unique tag types.""" all_tags = [] self._cursor.execute('SELECT DISTINCT tag FROM log2timeline') # This cleans up the messy SQL return. tag_row = self._cursor.fetchone() while tag_row: tag_string = tag_row[0] if tag_string: tags = t...
python
{ "resource": "" }
q25689
SQLite4n6TimeOutputModule.Close
train
def Close(self): """Disconnects from the database. This method will create the necessary indices and commit outstanding transactions before disconnecting. """ # Build up indices for the fields specified in the args. # It will commit the inserts automatically before creating index. if not se...
python
{ "resource": "" }
q25690
FilterFile.BuildFindSpecs
train
def BuildFindSpecs(self, environment_variables=None): """Build find specification from a filter file. Args: environment_variables (Optional[list[EnvironmentVariableArtifact]]): environment variables. Returns: list[dfvfs.FindSpec]: find specification. """ path_attributes = {} ...
python
{ "resource": "" }
q25691
ParsersManager._GetParserFilters
train
def _GetParserFilters(cls, parser_filter_expression): """Retrieves the parsers and plugins to include and exclude. Takes a comma separated string and splits it up into two dictionaries, of parsers and plugins to include and to exclude from selection. If a particular filter is prepended with an exclamat...
python
{ "resource": "" }
q25692
ParsersManager._GetParsersFromPresetCategory
train
def _GetParsersFromPresetCategory(cls, category): """Retrieves the parser names of specific preset category. Args: category (str): parser preset categories. Returns: list[str]: parser names in alphabetical order. """ preset_definition = cls._presets.GetPresetByName(category) if pre...
python
{ "resource": "" }
q25693
ParsersManager._ReduceParserFilters
train
def _ReduceParserFilters(cls, includes, excludes): """Reduces the parsers and plugins to include and exclude. If an intersection is found, the parser or plugin is removed from the inclusion set. If a parser is not in inclusion set there is no need to have it in the exclusion set. Args: inclu...
python
{ "resource": "" }
q25694
ParsersManager.CreateSignatureScanner
train
def CreateSignatureScanner(cls, specification_store): """Creates a signature scanner for format specifications with signatures. Args: specification_store (FormatSpecificationStore): format specifications with signatures. Returns: pysigscan.scanner: signature scanner. """ scan...
python
{ "resource": "" }
q25695
ParsersManager.GetFormatsWithSignatures
train
def GetFormatsWithSignatures(cls, parser_filter_expression=None): """Retrieves the format specifications that have signatures. This method will create a specification store for parsers that define a format specification with signatures and a list of parser names for those that do not. Args: ...
python
{ "resource": "" }
q25696
ParsersManager.GetNamesOfParsersWithPlugins
train
def GetNamesOfParsersWithPlugins(cls): """Retrieves the names of all parsers with plugins. Returns: list[str]: names of all parsers with plugins. """ parser_names = []
python
{ "resource": "" }
q25697
ParsersManager.GetParserAndPluginNames
train
def GetParserAndPluginNames(cls, parser_filter_expression=None): """Retrieves the parser and parser plugin names. Args: parser_filter_expression (Optional[str]): parser filter expression, where None represents all parsers and plugins. Returns: list[str]: parser and parser plugin name...
python
{ "resource": "" }
q25698
ParsersManager.GetParserPluginsInformation
train
def GetParserPluginsInformation(cls, parser_filter_expression=None): """Retrieves the parser plugins information. Args: parser_filter_expression (Optional[str]): parser filter expression, where None represents all parsers and plugins. Returns: list[tuple[str, str]]: pairs of parser p...
python
{ "resource": "" }
q25699
ParsersManager.GetParserObjectByName
train
def GetParserObjectByName(cls, parser_name): """Retrieves a specific parser object by its name. Args: parser_name (str): name of the
python
{ "resource": "" }