7
7
from plaso .formatters import manager
8
8
9
9
10
- class NTFSFileStatEventFormatter (interface .CustomEventFormatterHelper ):
11
- """Custom formatter for NTFS file system stat event values ."""
10
+ class NTFSFileReferenceFormatterHelper (interface .CustomEventFormatterHelper ):
11
+ """NTFS file reference formatter helper ."""
12
12
13
- DATA_TYPE = 'fs:stat:ntfs '
13
+ IDENTIFIER = 'ntfs_file_reference '
14
14
15
15
def FormatEventValues (self , event_values ):
16
16
"""Formats event values using the helper.
@@ -23,37 +23,41 @@ def FormatEventValues(self, event_values):
23
23
event_values ['file_reference' ] = '{0:d}-{1:d}' .format (
24
24
file_reference & 0xffffffffffff , file_reference >> 48 )
25
25
26
+
27
+ class NTFSParentFileReferenceFormatterHelper (
28
+ interface .CustomEventFormatterHelper ):
29
+ """NTFS parent file reference formatter helper."""
30
+
31
+ IDENTIFIER = 'ntfs_parent_file_reference'
32
+
33
+ def FormatEventValues (self , event_values ):
34
+ """Formats event values using the helper.
35
+
36
+ Args:
37
+ event_values (dict[str, object]): event values.
38
+ """
26
39
parent_file_reference = event_values .get ('parent_file_reference' , None )
27
40
if parent_file_reference :
28
41
event_values ['parent_file_reference' ] = '{0:d}-{1:d}' .format (
29
42
parent_file_reference & 0xffffffffffff , parent_file_reference >> 48 )
30
43
31
- path_hints = event_values .get ('path_hints' , [])
32
- if path_hints :
33
- event_values ['path_hints' ] = ';' .join (path_hints )
34
-
35
44
36
- class NTFSUSNChangeEventFormatter (interface .CustomEventFormatterHelper ):
37
- """Custom formatter for NTFS USN change event values ."""
45
+ class NTFSPathHintsFormatterHelper (interface .CustomEventFormatterHelper ):
46
+ """NTFS path hints formatter helper ."""
38
47
39
- DATA_TYPE = 'fs:ntfs:usn_change '
48
+ IDENTIFIER = 'ntfs_path_hints '
40
49
41
50
def FormatEventValues (self , event_values ):
42
51
"""Formats event values using the helper.
43
52
44
53
Args:
45
54
event_values (dict[str, object]): event values.
46
55
"""
47
- file_reference = event_values .get ('file_reference' , None )
48
- if file_reference :
49
- event_values ['file_reference' ] = '{0:d}-{1:d}' .format (
50
- file_reference & 0xffffffffffff , file_reference >> 48 )
51
-
52
- parent_file_reference = event_values .get ('parent_file_reference' , None )
53
- if parent_file_reference :
54
- event_values ['parent_file_reference' ] = '{0:d}-{1:d}' .format (
55
- parent_file_reference & 0xffffffffffff , parent_file_reference >> 48 )
56
+ path_hints = event_values .get ('path_hints' , [])
57
+ if path_hints :
58
+ event_values ['path_hints' ] = ';' .join (path_hints )
56
59
57
60
58
61
manager .FormattersManager .RegisterEventFormatterHelpers ([
59
- NTFSFileStatEventFormatter , NTFSUSNChangeEventFormatter ])
62
+ NTFSFileReferenceFormatterHelper , NTFSParentFileReferenceFormatterHelper ,
63
+ NTFSPathHintsFormatterHelper ])
0 commit comments