1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """
20 @author: Andrew Case
21 @license: GNU General Public License 2.0 or later
22 @contact: atcuno@gmail.com
23 @organization: Digital Forensics Solutions
24 """
25
26 from rekall.plugins.linux import common
27
28
30 '''Gathers dmesg buffer.'''
31
32 __name = "dmesg"
33
34 table_header = [
35 dict(name="timestamp", width=16),
36 dict(name="facility", width=2),
37 dict(name="level", width=2),
38 dict(name="message", width=80)
39 ]
40
42 if self.profile.get_obj_size("log"):
43
44
45 dmesg = self.profile.get_constant_object(
46 "log_buf",
47 vm=self.kernel_address_space,
48 target="Pointer",
49 target_args=dict(
50 target="ListArray",
51 target_args=dict(
52 target="log",
53 maximum_size=self.profile.get_constant("log_buf_len")
54 )
55 )
56 )
57
58 for message in dmesg:
59 yield (message.ts_nsec / 1e9, message.facility, message.level,
60 message.message)
61
62 else:
63
64 dmesg = self.profile.get_constant_object(
65 "log_buf",
66 vm=self.kernel_address_space,
67 target="Pointer",
68 target_args=dict(
69 target="UnicodeString",
70 target_args=dict(
71 length=int(self.profile.get_constant_object(
72 "log_buf_len", target="unsigned int"))
73 )
74 )
75 )
76
77 yield dict(message=dmesg.deref())
78