|
| 1 | +from dissect.target.helpers.regutil import VirtualKey, VirtualValue |
| 2 | +from dissect.target.plugins.os.windows.regf.muicache import MuiCachePlugin |
| 3 | + |
| 4 | + |
| 5 | +def test_muicache_plugin(target_win_users, hive_hku): |
| 6 | + # NT >= 6.0 |
| 7 | + muicache_shell_key = VirtualKey( |
| 8 | + hive_hku, |
| 9 | + "Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache", |
| 10 | + ) |
| 11 | + muicache_shell_key.add_value("LangID", VirtualValue(hive_hku, "LangID", b"\t\x04")) |
| 12 | + muicache_shell_key.add_value( |
| 13 | + "C:\\Windows\\System32\\fsquirt.exe.FriendlyAppName", |
| 14 | + VirtualValue(hive_hku, "C:\\Windows\\System32\\fsquirt.exe.FriendlyAppName", "fsquir"), |
| 15 | + ) |
| 16 | + muicache_shell_key.add_value( |
| 17 | + "C:\\Windows\\System32\\fsquirt.test.exe.ApplicationCompany", |
| 18 | + VirtualValue(hive_hku, "C:\\Windows\\System32\\fsquirt.test.exe.ApplicationCompany", "fsquir"), |
| 19 | + ) |
| 20 | + |
| 21 | + # NT >= 6.0 (subkey) |
| 22 | + muicache_key = VirtualKey( |
| 23 | + hive_hku, |
| 24 | + "Software\\Classes\\Local Settings\\MuiCache\\35\\52C64B7E", |
| 25 | + ) |
| 26 | + muicache_key.add_value( |
| 27 | + "@C:\\Windows\\system32\\wsecedit.dll,-718", |
| 28 | + VirtualValue(hive_hku, "@C:\\Windows\\system32\\wsecedit.dll,-718", "Local Security Policy"), |
| 29 | + ) |
| 30 | + |
| 31 | + # NT < 6.0 |
| 32 | + muicache_shellnoroam_key = VirtualKey( |
| 33 | + hive_hku, |
| 34 | + "Software\\Microsoft\\Windows\\ShellNoRoam\\MUICache", |
| 35 | + ) |
| 36 | + muicache_shellnoroam_key.add_value( |
| 37 | + "@C:\\WINDOWS\\inf\\unregmp2.exe,-4", |
| 38 | + VirtualValue(hive_hku, "@C:\\WINDOWS\\inf\\unregmp2.exe,-4", "Windows Media Player"), |
| 39 | + ) |
| 40 | + |
| 41 | + hive_hku.map_key(muicache_shell_key.path, muicache_shell_key) |
| 42 | + hive_hku.map_key(muicache_key.path, muicache_key) |
| 43 | + hive_hku.map_key(muicache_shellnoroam_key.path, muicache_shellnoroam_key) |
| 44 | + |
| 45 | + target_win_users.add_plugin(MuiCachePlugin) |
| 46 | + |
| 47 | + results = list(target_win_users.muicache()) |
| 48 | + |
| 49 | + assert len(results) == 4 |
| 50 | + assert results[0].index == 1 |
| 51 | + assert results[0].name == "FriendlyAppName" |
| 52 | + assert results[0].value == "fsquir" |
| 53 | + assert str(results[0].path) == "C:\\Windows\\System32\\fsquirt.exe" |
| 54 | + assert results[1].index == 2 |
| 55 | + assert results[1].name == "ApplicationCompany" |
| 56 | + assert results[1].value == "fsquir" |
| 57 | + assert str(results[1].path) == "C:\\Windows\\System32\\fsquirt.test.exe" |
| 58 | + assert results[2].index == 0 |
| 59 | + assert results[2].name is None |
| 60 | + assert results[2].value == "Local Security Policy" |
| 61 | + assert str(results[2].path) == "@C:\\Windows\\system32\\wsecedit.dll" |
| 62 | + assert results[3].index == 0 |
| 63 | + assert results[3].name is None |
| 64 | + assert results[3].value == "Windows Media Player" |
| 65 | + assert str(results[3].path) == "@C:\\WINDOWS\\inf\\unregmp2.exe" |
0 commit comments