Skip to content

Commit b22a85c

Browse files
committed
Fix review comments
1 parent ff54cb5 commit b22a85c

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

dftimewolf/cli/recipes/gcp_turbinia_import.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
'remote_project_name': '@remote_project_name',
2424
'remote_instance_name': '@instance',
2525
'incident_id': '@incident_id',
26-
'zone': '@zone',
26+
'turbinia_zone': '@turbinia_zone',
2727
'disk_names': '@disks',
2828
'all_disks': '@all_disks',
2929
'boot_disk_size': '@boot_disk_size',
@@ -33,7 +33,7 @@
3333
'args': {
3434
'disk_name': None, # Taken from GoogleCloudCollector's output
3535
'project': '@analysis_project_name',
36-
'zone': '@zone',
36+
'turbinia_zone': '@turbinia_zone',
3737
},
3838
}, {
3939
'name': 'TimesketchExporter',
@@ -50,10 +50,10 @@
5050
args = [
5151
('remote_project_name',
5252
'Name of the project containing the instance / disks to copy ', None),
53-
('--zone', 'The GCP zone the disk to process (and Turbinia workers) are in',
54-
None),
53+
('--turbinia_zone', 'The GCP zone the disk to process (and Turbinia '
54+
'workers) are in', None),
5555
('--incident_id', 'Incident ID (used for Timesketch description)',
56-
datetime.now().strftime("%Y%m%d%H%M%S")),
56+
datetime.now().strftime('%Y%m%d%H%M%S')),
5757
('--sketch_id', 'Sketch to which the timeline should be added', None),
5858
('--timesketch_endpoint', 'Endpoint of the Timesketch server to use',
5959
'https://localhost:5000'),

dftimewolf/lib/processors/turbinia.py

+31-29
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from dftimewolf.lib.module import BaseModule
1111

1212
from turbinia import client as turbinia_client
13-
from turbinia import config
13+
from turbinia import config as turbinia_config
1414
from turbinia import evidence
1515
from turbinia import output_manager
1616
from turbinia import TurbiniaException
@@ -22,11 +22,11 @@ class TurbiniaProcessor(BaseModule):
2222
2323
Attributes:
2424
client: A TurbiniaClient object
25-
disk_name: Name of the disk to process
25+
disk_name (string): Name of the disk to process
2626
instance (string): The name of the Turbinia instance
27-
project: The project containing the disk to process
28-
region (string): The region Turbinia is in
29-
zone: The zone containing the disk to process
27+
project (string): The project containing the disk to process
28+
turbinia_region (string): The region Turbinia is in
29+
turbinia_zone (string): The zone Turbinia is in
3030
_output_path: The path to output files
3131
"""
3232

@@ -41,17 +41,18 @@ def __init__(self, state):
4141
self.disk_name = None
4242
self.instance = None
4343
self.project = None
44-
self.region = None
45-
self.zone = None
44+
self.turbinia_region = None
45+
self.turbinia_zone = None
4646
self._output_path = None
4747

48-
def setup(self, disk_name, project, zone): # pylint: disable=arguments-differ
48+
# pylint: disable=arguments-differ
49+
def setup(self, disk_name, project, turbinia_zone):
4950
"""Sets up the object attributes.
5051
5152
Args:
52-
disk_name: Name of the disk to process
53-
project: The project containing the disk to process
54-
zone: The zone containing the disk to process
53+
disk_name (string): Name of the disk to process
54+
project (string): The project containing the disk to process
55+
turbinia_zone (string): The zone containing the disk to process
5556
"""
5657
# TODO: Consider the case when multiple disks are provided by the previous
5758
# module or by the CLI.
@@ -60,27 +61,27 @@ def setup(self, disk_name, project, zone): # pylint: disable=arguments-differ
6061
disk_name = disk.name
6162
print('Using disk {0:s} from previous collector'.format(disk_name))
6263

63-
if disk_name is None or project is None or zone is None:
64+
if disk_name is None or project is None or turbinia_zone is None:
6465
self.state.add_error(
65-
'disk_name, project or zone are not all specified, bailing out',
66-
critical=True)
66+
'disk_name, project or turbinia_zone are not all specified, bailing '
67+
'out', critical=True)
6768
return
6869
self.disk_name = disk_name
6970
self.project = project
70-
self.zone = zone
71-
self._output_path = tempfile.mkdtemp()
71+
self.turbinia_zone = turbinia_zone
7272

7373
try:
74-
config.LoadConfig()
75-
self.region = config.TURBINIA_REGION
76-
self.instance = config.PUBSUB_TOPIC
77-
if config.PROJECT != self.project:
74+
turbinia_config.LoadConfig()
75+
self.turbinia_region = turbinia_config.TURBINIA_REGION
76+
self.instance = turbinia_config.PUBSUB_TOPIC
77+
if turbinia_config.PROJECT != self.project:
7878
self.state.add_error(
7979
'Specified project {0:s} does not match Turbinia configured '
80-
'project {1:s}. Use gcp_forensics_import recipe to copy the disk '
80+
'project {1:s}. Use gcp_turbinia_import recipe to copy the disk '
8181
'into the same project.'.format(
82-
self.project, config.PROJECT), critical=True)
82+
self.project, turbinia_config.PROJECT), critical=True)
8383
return
84+
self._output_path = tempfile.mkdtemp()
8485
self.client = turbinia_client.TurbiniaClient()
8586
except TurbiniaException as e:
8687
self.state.add_error(e, critical=True)
@@ -95,7 +96,7 @@ def process(self):
9596
print('Turbinia log file: {0:s}'.format(log_file_path))
9697

9798
evidence_ = evidence.GoogleCloudDisk(
98-
disk_name=self.disk_name, project=self.project, zone=self.zone)
99+
disk_name=self.disk_name, project=self.project, zone=self.turbinia_zone)
99100
request = TurbiniaRequest()
100101
request.evidence.append(evidence_)
101102

@@ -106,14 +107,15 @@ def process(self):
106107
print('Waiting for Turbinia request {0:s} to complete'.format(
107108
request.request_id))
108109
self.client.wait_for_request(
109-
instance=self.instance, project=self.project, region=self.region,
110-
request_id=request.request_id)
110+
instance=self.instance, project=self.project,
111+
region=self.turbinia_region, request_id=request.request_id)
111112
task_data = self.client.get_task_data(
112-
instance=self.instance, project=self.project, region=self.region,
113-
request_id=request.request_id)
113+
instance=self.instance, project=self.project,
114+
region=self.turbinia_region, request_id=request.request_id)
114115
print(self.client.format_task_status(
115-
instance=self.instance, project=self.project, region=self.region,
116-
request_id=request.request_id, all_fields=True))
116+
instance=self.instance, project=self.project,
117+
region=self.turbinia_region, request_id=request.request_id,
118+
all_fields=True))
117119
except TurbiniaException as e:
118120
self.state.add_error(e, critical=True)
119121
return

0 commit comments

Comments
 (0)