1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """This plugin is used for displaying information about the Kernel Processor
24 Control Blocks.
25 """
26
27
28 from rekall import obj
29 from rekall.plugins.windows import common
30
31
32 -class KPCR(common.WindowsCommandPlugin):
33 """A plugin to print all KPCR blocks."""
34 __name = "kpcr"
35
37 """A generator of KPCR objects (one for each CPU)."""
38
39 initial_pcr = self.profile.get_constant_object(
40 "KiInitialPCR",
41 "_KPCR")
42
43
44 self_Pcr = initial_pcr.m("SelfPcr") or initial_pcr.m("Self")
45 if self_Pcr.v() == initial_pcr.obj_offset:
46 return initial_pcr
47
48
49 pcr = self.profile._KPCR(0xFFDFF000)
50 if pcr.SelfPcr.v() == pcr.obj_offset:
51 return pcr
52
53 return obj.NoneObject("Unknown KPCR")
54
56 kpcr = self.kpcr()
57
58 renderer.section()
59
60 renderer.table_header([("Property", "property", "<30"),
61 ("Value", "value", "<")])
62
63 renderer.table_row("Offset (V)", "%#x" % kpcr.obj_offset)
64 renderer.table_row("KdVersionBlock", kpcr.KdVersionBlock, style="full")
65
66 renderer.table_row("IDT", "%#x" % kpcr.IDT)
67 renderer.table_row("GDT", "%#x" % kpcr.GDT)
68
69 current_thread = kpcr.ProcessorBlock.CurrentThread
70 idle_thread = kpcr.ProcessorBlock.IdleThread
71 next_thread = kpcr.ProcessorBlock.NextThread
72
73 if current_thread:
74 renderer.format("{0:<30}: {1:#x} TID {2} ({3}:{4})\n",
75 "CurrentThread",
76 current_thread, current_thread.Cid.UniqueThread,
77 current_thread.owning_process().ImageFileName,
78 current_thread.Cid.UniqueProcess,
79 )
80
81 if idle_thread:
82 renderer.format("{0:<30}: {1:#x} TID {2} ({3}:{4})\n",
83 "IdleThread",
84 idle_thread, idle_thread.Cid.UniqueThread,
85 idle_thread.owning_process().ImageFileName,
86 idle_thread.Cid.UniqueProcess,
87 )
88
89 if next_thread:
90 renderer.format("{0:<30}: {1:#x} TID {2} ({3}:{4})\n",
91 "NextThread",
92 next_thread,
93 next_thread.Cid.UniqueThread,
94 next_thread.owning_process().ImageFileName,
95 next_thread.Cid.UniqueProcess,
96 )
97
98 renderer.format("{0:<30}: CPU {1} ({2} @ {3} MHz)\n",
99 "Details",
100 kpcr.ProcessorBlock.Number,
101 kpcr.ProcessorBlock.VendorString,
102 kpcr.ProcessorBlock.MHz)
103
104 renderer.format(
105 "{0:<30}: {1:#x}\n", "CR3/DTB",
106 kpcr.ProcessorBlock.ProcessorState.SpecialRegisters.Cr3)
107