forked from log2timeline/plaso
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to handling message file resource paths log2timeline#4259
- Loading branch information
1 parent
eff61ca
commit f3483d5
Showing
2 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
"""Tests for the Windows EventLog providers helper.""" | ||
|
||
import unittest | ||
|
||
from plaso.helpers.windows import eventlog_providers | ||
|
||
from tests import test_lib as shared_test_lib | ||
|
||
|
||
class WindowsEventLogProvidersHelperTest(shared_test_lib.BaseTestCase): | ||
"""Tests for the Windows EventLog providers helper.""" | ||
|
||
# pylint: disable=protected-access | ||
|
||
def testGetNormalizedPath(self): | ||
"""Tests the _GetNormalizedPath function.""" | ||
test_helper = eventlog_providers.WindowsEventLogProvidersHelper() | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'%SystemRoot%\\System32\\IoLogMsg.dll') | ||
self.assertEqual(normalized_path, '%SystemRoot%\\System32\\IoLogMsg.dll') | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'%windir%\\System32\\lsasrv.dll') | ||
self.assertEqual(normalized_path, '%SystemRoot%\\System32\\lsasrv.dll') | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'C:\\Windows\\System32\\mscoree.dll') | ||
self.assertEqual(normalized_path, '%SystemRoot%\\System32\\mscoree.dll') | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'werfault.exe') | ||
self.assertEqual(normalized_path, '%SystemRoot%\\System32\\werfault.exe') | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'system32\\drivers\\WdFilter.sys') | ||
self.assertEqual(normalized_path, ( | ||
'%SystemRoot%\\System32\\drivers\\WdFilter.sys')) | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\84.0.522.52\\' | ||
'eventlog_provider.dll') | ||
self.assertEqual(normalized_path, ( | ||
'\\Program Files (x86)\\Microsoft\\Edge\\Application\\84.0.522.52\\' | ||
'eventlog_provider.dll')) | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'%ProgramFiles%\\Windows Defender\\MpClient.dll') | ||
self.assertEqual(normalized_path, ( | ||
'%ProgramFiles%\\Windows Defender\\MpClient.dll')) | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'%programdata%\\Microsoft\\Windows Defender\\Definition Updates\\' | ||
'Default\\MpEngine.dll') | ||
self.assertEqual(normalized_path, ( | ||
'%programdata%\\Microsoft\\Windows Defender\\Definition Updates\\' | ||
'Default\\MpEngine.dll')) | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'$(runtime.system32)\\WinML.dll') | ||
self.assertEqual(normalized_path, '%SystemRoot%\\System32\\WinML.dll') | ||
|
||
normalized_path = test_helper._GetNormalizedPath( | ||
'$(runtime.windows)\\immersivecontrolpanel\\systemsettings.exe') | ||
self.assertEqual(normalized_path, ( | ||
'%SystemRoot%\\immersivecontrolpanel\\systemsettings.exe')) | ||
|
||
# TODO: add tests for Merge | ||
# TODO: add tests for NormalizeMessageFiles | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |