grr/server/grr_response_server/flows/general/collectors_test.py
def testRegistryKeyArtifactWithPathRecursion(self):
    """Test that a registry key artifact can be collected."""

    artifact_list = ["TestRegistryKey"]

    self.cleanup = InitGRRWithTestSources(r"""
name: TestRegistryKey
doc: A sample registry key artifact.
sources:
- type: REGISTRY_KEY
  attributes:
    keys: [
      'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\**\Session Manager\*'
    ]
""")

    with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.REGISTRY,
                                   vfs_test_lib.FakeRegistryVFSHandler):
      with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.OS,
                                     vfs_test_lib.FakeFullVFSHandler):

        # Run the ArtifactCollector to get the expected result.
        session_id = flow_test_lib.TestFlowHelper(
            aff4_flows.ArtifactCollectorFlow.__name__,
            action_mocks.FileFinderClientMock(),
            artifact_list=artifact_list,
            token=self.token,
            client_id=self.client_id,
            apply_parsers=False)
        expected = flow_test_lib.GetFlowResults(self.client_id, session_id)[0]
        self.assertIsInstance(expected, rdf_client_fs.StatEntry)

        # Run the ClientArtifactCollector to get the actual result.
        results = self._RunFlow(
            aff4_flows.ClientArtifactCollector,
            artifact_collector.ArtifactCollector,
            artifact_list,
            apply_parsers=False)
        artifact_response = results[0]
        self.assertIsInstance(artifact_response, rdf_client_fs.StatEntry)

        self.assertEqual(artifact_response, expected)
Test that a registry key artifact can be collected.
Test that a registry key artifact can be collected.
Test that a registry key artifact can be collected .
def testRegistryKeyArtifactWithPathRecursion(self):
    artifact_list = ["TestRegistryKey"]
    self.cleanup = InitGRRWithTestSources(r"""
name: TestRegistryKey
doc: A sample registry key artifact.
sources:
- type: REGISTRY_KEY
  attributes:
    keys: [
      'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\**\Session Manager\*'
    ]
""")
    with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.REGISTRY,
                                   vfs_test_lib.FakeRegistryVFSHandler):
      with vfs_test_lib.VFSOverrider(rdf_paths.PathSpec.PathType.OS,
                                     vfs_test_lib.FakeFullVFSHandler):
        session_id = flow_test_lib.TestFlowHelper(
            aff4_flows.ArtifactCollectorFlow.__name__,
            action_mocks.FileFinderClientMock(),
            artifact_list=artifact_list,
            token=self.token,
            client_id=self.client_id,
            apply_parsers=False)
        expected = flow_test_lib.GetFlowResults(self.client_id, session_id)[0]
        self.assertIsInstance(expected, rdf_client_fs.StatEntry)
        results = self._RunFlow(
            aff4_flows.ClientArtifactCollector,
            artifact_collector.ArtifactCollector,
            artifact_list,
            apply_parsers=False)
        artifact_response = results[0]
        self.assertIsInstance(artifact_response, rdf_client_fs.StatEntry)
        self.assertEqual(artifact_response, expected)
def testRegistryKeyArtifactWithPathRecursion ( self ) : artifact_list = [ "TestRegistryKey" ] self . cleanup = InitGRRWithTestSources ( r"""
name: TestRegistryKey
doc: A sample registry key artifact.
sources:
- type: REGISTRY_KEY
  attributes:
    keys: [
      'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\**\Session Manager\*'
    ]
""" ) with vfs_test_lib . VFSOverrider ( rdf_paths . PathSpec . PathType . REGISTRY , vfs_test_lib . FakeRegistryVFSHandler ) : with vfs_test_lib . VFSOverrider ( rdf_paths . PathSpec . PathType . OS , vfs_test_lib . FakeFullVFSHandler ) : session_id = flow_test_lib . TestFlowHelper ( aff4_flows . ArtifactCollectorFlow . __name__ , action_mocks . FileFinderClientMock ( ) , artifact_list = artifact_list , token = self . token , client_id = self . client_id , apply_parsers = False ) expected = flow_test_lib . GetFlowResults ( self . client_id , session_id ) [ 0 ] self . assertIsInstance ( expected , rdf_client_fs . StatEntry ) results = self . _RunFlow ( aff4_flows . ClientArtifactCollector , artifact_collector . ArtifactCollector , artifact_list , apply_parsers = False ) artifact_response = results [ 0 ] self . assertIsInstance ( artifact_response , rdf_client_fs . StatEntry ) self . assertEqual ( artifact_response , expected )
Test that a registry key artifact can be collected.
Test that a registry key artifact can be collected .
"""Test that a registry key artifact can be collected.""" # Run the ArtifactCollector to get the expected result. # Run the ClientArtifactCollector to get the actual result.
self