10
10
from dftimewolf .lib .module import BaseModule
11
11
12
12
from turbinia import client as turbinia_client
13
- from turbinia import config
13
+ from turbinia import config as turbinia_config
14
14
from turbinia import evidence
15
15
from turbinia import output_manager
16
16
from turbinia import TurbiniaException
@@ -22,11 +22,11 @@ class TurbiniaProcessor(BaseModule):
22
22
23
23
Attributes:
24
24
client: A TurbiniaClient object
25
- disk_name: Name of the disk to process
25
+ disk_name (string) : Name of the disk to process
26
26
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
30
30
_output_path: The path to output files
31
31
"""
32
32
@@ -41,17 +41,18 @@ def __init__(self, state):
41
41
self .disk_name = None
42
42
self .instance = None
43
43
self .project = None
44
- self .region = None
45
- self .zone = None
44
+ self .turbinia_region = None
45
+ self .turbinia_zone = None
46
46
self ._output_path = None
47
47
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 ):
49
50
"""Sets up the object attributes.
50
51
51
52
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
55
56
"""
56
57
# TODO: Consider the case when multiple disks are provided by the previous
57
58
# module or by the CLI.
@@ -60,27 +61,27 @@ def setup(self, disk_name, project, zone): # pylint: disable=arguments-differ
60
61
disk_name = disk .name
61
62
print ('Using disk {0:s} from previous collector' .format (disk_name ))
62
63
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 :
64
65
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 )
67
68
return
68
69
self .disk_name = disk_name
69
70
self .project = project
70
- self .zone = zone
71
- self ._output_path = tempfile .mkdtemp ()
71
+ self .turbinia_zone = turbinia_zone
72
72
73
73
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 :
78
78
self .state .add_error (
79
79
'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 '
81
81
'into the same project.' .format (
82
- self .project , config .PROJECT ), critical = True )
82
+ self .project , turbinia_config .PROJECT ), critical = True )
83
83
return
84
+ self ._output_path = tempfile .mkdtemp ()
84
85
self .client = turbinia_client .TurbiniaClient ()
85
86
except TurbiniaException as e :
86
87
self .state .add_error (e , critical = True )
@@ -95,7 +96,7 @@ def process(self):
95
96
print ('Turbinia log file: {0:s}' .format (log_file_path ))
96
97
97
98
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 )
99
100
request = TurbiniaRequest ()
100
101
request .evidence .append (evidence_ )
101
102
@@ -106,14 +107,15 @@ def process(self):
106
107
print ('Waiting for Turbinia request {0:s} to complete' .format (
107
108
request .request_id ))
108
109
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 )
111
112
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 )
114
115
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 ))
117
119
except TurbiniaException as e :
118
120
self .state .add_error (e , critical = True )
119
121
return
0 commit comments