1010from dftimewolf .lib .module import BaseModule
1111
1212from turbinia import client as turbinia_client
13- from turbinia import config
13+ from turbinia import config as turbinia_config
1414from turbinia import evidence
1515from turbinia import output_manager
1616from 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