Esempio n. 1
0
from dftimewolf.lib import state
from dftimewolf.lib.containers import containers
from dftimewolf.lib.collectors import gcloud

FAKE_PROJECT = gcp_project.GoogleCloudProject('test-target-project-name',
                                              'fake_zone')
FAKE_ANALYSIS_VM = compute.GoogleComputeInstance(FAKE_PROJECT.project_id,
                                                 'fake_zone',
                                                 'fake-analysis-vm')
FAKE_INSTANCE = compute.GoogleComputeInstance(FAKE_PROJECT.project_id,
                                              'fake_zone', 'fake-instance')
FAKE_DISK = compute.GoogleComputeDisk(FAKE_PROJECT.project_id, 'fake_zone',
                                      'disk1')
FAKE_BOOT_DISK = compute.GoogleComputeDisk(FAKE_PROJECT.project_id,
                                           'fake_zone', 'bootdisk')
FAKE_SNAPSHOT = compute.GoogleComputeSnapshot(FAKE_DISK, 'fake_snapshot')
FAKE_DISK_COPY = compute.GoogleComputeDisk(FAKE_PROJECT.project_id,
                                           'fake_zone', 'disk1-copy')


class GoogleCloudCollectorTest(unittest.TestCase):
    """Tests for the GCloud collector."""
    def testInitialization(self):
        """Tests that the collector can be initialized."""
        test_state = state.DFTimewolfState(config.Config)
        gcloud_collector = gcloud.GoogleCloudCollector(test_state)
        self.assertIsNotNone(gcloud_collector)

    # pylint: disable=invalid-name,line-too-long
    @mock.patch(
        'libcloudforensics.providers.gcp.internal.compute_base_resource.GoogleComputeBaseResource.AddLabels'
Esempio n. 2
0
                                        'fake-image')

# Source project with the instance that needs forensicating
FAKE_SOURCE_PROJECT = gcp_project.GoogleCloudProject('fake-source-project',
                                                     'fake-zone')

FAKE_INSTANCE = compute.GoogleComputeInstance(FAKE_SOURCE_PROJECT.project_id,
                                              'fake-zone', 'fake-instance')

FAKE_DISK = compute.GoogleComputeDisk(FAKE_SOURCE_PROJECT.project_id,
                                      'fake-zone', 'fake-disk')

FAKE_BOOT_DISK = compute.GoogleComputeDisk(FAKE_SOURCE_PROJECT.project_id,
                                           'fake-zone', 'fake-boot-disk')

FAKE_SNAPSHOT = compute.GoogleComputeSnapshot(FAKE_DISK, 'fake-snapshot')

FAKE_SNAPSHOT_LONG_NAME = compute.GoogleComputeSnapshot(
    FAKE_DISK,
    'this-is-a-kind-of-long-fake-snapshot-name-and-is-definitely-over-63-chars'
)

FAKE_DISK_COPY = compute.GoogleComputeDisk(FAKE_SOURCE_PROJECT.project_id,
                                           'fake-zone', 'fake-disk-copy')

FAKE_LOGS = gcp_log.GoogleCloudLog('fake-target-project')

FAKE_LOG_LIST = [
    'projects/fake-target-project/logs/GCEGuestAgent',
    'projects/fake-target-project/logs/OSConfigAgent'
]