예제 #1
0
    def testListArtifacts(self):
        artifact = rdf_artifacts.Artifact(name='FakeArtifact')

        registry_stub = artifact_registry.ArtifactRegistry()
        registry_stub.RegisterArtifact(artifact)
        data_store.REL_DB.WriteArtifact(artifact)

        with mock.patch.object(artifact_registry, 'REGISTRY', registry_stub):
            results = grr_colab.list_artifacts()

        self.assertLen(results, 1)
        self.assertEqual(results[0].artifact.name, 'FakeArtifact')
예제 #2
0
def grr_list_artifacts_impl() -> pd.DataFrame:
    """Lists all registered GRR artifacts.

  Returns:
    A list of artifact descriptors.
  """
    df = convert.from_sequence(grr_colab.list_artifacts())

    priority_columns = [
        'artifact.name',
        'artifact.doc',
        'artifact.supported_os',
        'artifact.labels',
    ]
    df = convert.reindex_dataframe(df, priority_columns=priority_columns)

    return df