Skip to content

Commit 84cd858

Browse files
committed
Worked on EventLog providers script
1 parent ded7c6a commit 84cd858

File tree

7 files changed

+258
-143
lines changed

7 files changed

+258
-143
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
/__pycache__
1414
/build
1515
/dist
16+
/MANIFEST.test_data
1617
/winregrc.egg-info
1718

config/dpkg/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
winreg-kb (20220106-1) unstable; urgency=low
1+
winreg-kb (20220111-1) unstable; urgency=low
22

33
* Auto-generated
44

5-
-- Joachim Metz <[email protected]> Thu, 06 Jan 2022 12:32:48 +0100
5+
-- Joachim Metz <[email protected]> Tue, 11 Jan 2022 06:08:17 +0100

docs/sources/EventLog-keys.md

Lines changed: 98 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,48 @@ Note that the combined information of both keys can be needed, for example
1111
the Services\EventLog key:
1212

1313
```
14-
Log source : WinMgmt
15-
Identifier : {1edeee53-0afe-4609-b846-d8c0b2075b1f}
16-
Log type : Application
14+
Log type : System
15+
Log source : Microsoft-Windows-Time-Service
16+
Identifier : {06edcfeb-0fd0-4e53-acca-a6f8bbf81bcb}
17+
Event message files : %SystemRoot%\system32\w32time.dll
18+
```
19+
20+
```
21+
Log type : System
22+
Log source : W32Time
23+
Identifier : {06edcfeb-0fd0-4e53-acca-a6f8bbf81bcb}
24+
Event message files : %SystemRoot%\system32\w32time.dll
1725
```
1826

1927
In combination with the corresponding WINEVT\Publishers key:
2028

2129
```
22-
Log source : Microsoft-Windows-WMI
23-
Identifier : {1edeee53-0afe-4609-b846-d8c0b2075b1f}
24-
Event message files : %SystemRoot%\system32\wbem\WinMgmtR.dll
30+
Name : Microsoft-Windows-Time-Service
31+
Identifier : {06edcfeb-0fd0-4e53-acca-a6f8bbf81bcb}
32+
Event message files : %SystemRoot%\system32\w32time.dll
33+
```
34+
35+
Is the following EvenLog provider:
36+
37+
```
38+
Name : Microsoft-Windows-Time-Service
39+
Identifier : {06edcfeb-0fd0-4e53-acca-a6f8bbf81bcb}
40+
Log type : System
41+
Log source(s) : Microsoft-Windows-Time-Service
42+
: W32Time
43+
Event message files : %SystemRoot%\system32\w32time.dll
2544
```
2645

27-
Is the following EvenLog provider, that has multiple log sources:
46+
Note that an EventLog provider can have multiple log types and log sources.
47+
It is not known if a log source that matches the EventLog provider name can be
48+
deduplicated.
49+
50+
Or as specified as Event XML:
2851

2952
```
30-
Log source : WinMgmt
31-
: Microsoft-Windows-WMI
32-
Identifier : {1edeee53-0afe-4609-b846-d8c0b2075b1f}
33-
Log type : Application
34-
Event message files : %systemroot%\system32\wbem\winmgmtr.dll
53+
<Provider Name='Microsoft-Windows-Time-Service'
54+
Guid='{06edcfeb-0fd0-4e53-acca-a6f8bbf81bcb}'
55+
EventSourceName='W32Time'/>
3556
```
3657

3758
## Services\EventLog key
@@ -127,15 +148,16 @@ Values:
127148

128149
Name | Data type | Description
129150
--- | --- | ---
130-
(default) | | Case insensitive log source.
131-
MessageFileName | | Path to an event message file. An event message file contains language-dependent strings that describe the events.
132-
ResourceFileName | | Path to an event resource file.
151+
(default) | REG_SZ | Case insensitive log source.
152+
MessageFileName | REG_EXPAND_SZ | Path to an event message file. An event message file contains language-dependent strings that describe the events.
153+
ResourceFileName | REG_EXPAND_SZ | Path to an event resource file.
154+
ParameterFileName | REG_EXPAND_SZ | Path to an event parameter file.
133155

134156
## Message file paths
135157

136158
A message file path can be defined in numerous different ways for example:
137159

138-
As an abosolute path
160+
As an absolute path
139161

140162
```
141163
C:\Windows\System32\mscoree.dll
@@ -177,8 +199,10 @@ Last written time: Oct 30, 2015 07:25:12.126588100 UTC
177199
Value: 0 providerGuid
178200
Type: string (REG_SZ)
179201
Data size: 78
180-
Data: {D4BE7726-DC7A-11DF-A6E6-0902DFD72085}
202+
Data: {d4be7726-dc7a-11df-a6e6-0902dfd72085}
203+
```
181204

205+
```
182206
Key path: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WINEVT\Publishers\{89203471-d554-47d4-bde4-7552ec219999}
183207
Name: {89203471-d554-47d4-bde4-7552ec219999}
184208
Last written time: Oct 30, 2015 07:25:53.860831900 UTC
@@ -199,6 +223,63 @@ Data size: 66
199223
Data: %SystemRoot%\system32\KdsCli.dll
200224
```
201225

226+
## EventLog provider with multiple log types
227+
228+
Seen on Windows 10:
229+
230+
```
231+
Key path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\Application\Microsoft-Windows-EventCollector
232+
Name: Microsoft-Windows-EventCollector
233+
Last written time: Sep 13, 2014 07:27:56.080450600 UTC
234+
235+
Value: 0 ProviderGuid
236+
Type: string (REG_SZ)
237+
Data size: 78
238+
Data: {b977cf02-76f6-df84-cc1a-6a4b232322b6}
239+
240+
Value: 1 EventMessageFile
241+
Type: expandable string (REG_EXPAND_SZ)
242+
Data size: 66
243+
Data: %SystemRoot%\system32\wecsvc.dll
244+
```
245+
246+
```
247+
Key path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\System\Microsoft-Windows-EventCollector
248+
Name: Microsoft-Windows-EventCollector
249+
Last written time: Sep 13, 2014 07:27:56.080450600 UTC
250+
251+
Value: 0 ProviderGuid
252+
Type: string (REG_SZ)
253+
Data size: 78
254+
Data: {b977cf02-76f6-df84-cc1a-6a4b232322b6}
255+
256+
Value: 1 EventMessageFile
257+
Type: expandable string (REG_EXPAND_SZ)
258+
Data size: 66
259+
Data: %SystemRoot%\system32\wecsvc.dll
260+
```
261+
262+
```
263+
Key path: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WINEVT\Publishers\{b977cf02-76f6-df84-cc1a-6a4b232322b6}
264+
Name: {b977cf02-76f6-df84-cc1a-6a4b232322b6}
265+
Last written time: Sep 13, 2014 07:27:56.080450600 UTC
266+
267+
Value: 0 (default)
268+
Type: string (REG_SZ)
269+
Data size: 66
270+
Data: Microsoft-Windows-EventCollector
271+
272+
Value: 1 ResourceFileName
273+
Type: expandable string (REG_EXPAND_SZ)
274+
Data size: 66
275+
Data: %SystemRoot%\system32\wecsvc.dll
276+
277+
Value: 2 MessageFileName
278+
Type: expandable string (REG_EXPAND_SZ)
279+
Data size: 66
280+
Data: %SystemRoot%\system32\wecsvc.dll
281+
```
282+
202283
## External Links
203284

204285
* [Eventlog Key](https://docs.microsoft.com/en-us/windows/win32/eventlog/eventlog-key)

scripts/eventlog_providers.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,55 @@ def WriteEventLogProvider(self, eventlog_provider):
2222
Args:
2323
eventlog_provider (EventLogProvider): Event Log provider.
2424
"""
25-
for index, log_source in enumerate(sorted(eventlog_provider.log_sources)):
26-
if index == 0:
27-
text = 'Log source(s)\t\t: {0:s}\n'.format(log_source)
28-
else:
29-
text = '\t\t\t: {0:s}\n'.format(log_source)
30-
self.WriteText(text)
31-
32-
if eventlog_provider.log_type:
33-
text = 'Log type\t\t: {0:s}\n'.format(eventlog_provider.log_type)
25+
if eventlog_provider.name:
26+
text = 'Name\t\t\t\t: {0:s}\n'.format(eventlog_provider.name)
3427
self.WriteText(text)
3528

3629
if eventlog_provider.identifier:
37-
text = 'Identifier\t\t: {0:s}\n'.format(eventlog_provider.identifier)
30+
text = 'Identifier\t\t\t: {0:s}\n'.format(eventlog_provider.identifier)
3831
self.WriteText(text)
3932

4033
if eventlog_provider.additional_identifier:
41-
text = 'Additional identifier\t: {0:s}\n'.format(
34+
text = 'Additional identifier\t\t: {0:s}\n'.format(
4235
eventlog_provider.additional_identifier)
4336
self.WriteText(text)
4437

38+
for index, log_type in enumerate(sorted(eventlog_provider.log_types)):
39+
if index == 0:
40+
text = 'Log type(s)\t\t\t: {0:s}\n'.format(log_type)
41+
else:
42+
text = '\t\t\t\t: {0:s}\n'.format(log_type)
43+
self.WriteText(text)
44+
45+
for index, log_source in enumerate(sorted(eventlog_provider.log_sources)):
46+
if index == 0:
47+
text = 'Log source(s)\t\t\t: {0:s}\n'.format(log_source)
48+
else:
49+
text = '\t\t\t\t: {0:s}\n'.format(log_source)
50+
self.WriteText(text)
51+
4552
for index, path in enumerate(sorted((
4653
eventlog_provider.category_message_files))):
4754
if index == 0:
4855
text = 'Category message file(s)\t: {0:s}\n'.format(path)
4956
else:
50-
text = '\t\t\t: {0:s}\n'.format(path)
57+
text = '\t\t\t\t: {0:s}\n'.format(path)
5158
self.WriteText(text)
5259

5360
for index, path in enumerate(sorted((
5461
eventlog_provider.event_message_files))):
5562
if index == 0:
56-
text = 'Event message file(s)\t: {0:s}\n'.format(path)
63+
text = 'Event message file(s)\t\t: {0:s}\n'.format(path)
5764
else:
58-
text = '\t\t\t: {0:s}\n'.format(path)
65+
text = '\t\t\t\t: {0:s}\n'.format(path)
5966
self.WriteText(text)
6067

6168
for index, path in enumerate(sorted((
6269
eventlog_provider.parameter_message_files))):
6370
if index == 0:
6471
text = 'Parameter message file(s)\t: {0:s}\n'.format(path)
6572
else:
66-
text = '\t\t\t: {0:s}\n'.format(path)
73+
text = '\t\t\t\t: {0:s}\n'.format(path)
6774
self.WriteText(text)
6875

6976
self.WriteText('\n')

tests/eventlog_providers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def testCollect(self):
5151

5252
eventlog_provider = test_results[0]
5353
self.assertIsNone(eventlog_provider.identifier)
54+
self.assertIsNone(eventlog_provider.name)
5455
self.assertEqual(eventlog_provider.log_sources, ['.NET Runtime'])
55-
self.assertEqual(eventlog_provider.log_type, 'Application')
56+
self.assertEqual(eventlog_provider.log_types, ['Application'])
5657
self.assertEqual(eventlog_provider.category_message_files, set())
5758
self.assertEqual(
5859
eventlog_provider.event_message_files,

winregrc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
"""Windows Registry resources (winregrc)."""
33

4-
__version__ = '20220106'
4+
__version__ = '20220111'

0 commit comments

Comments
 (0)