Elven
10-10-2016, 17:17
Имеются логи аудита SRP, кто имел с ними дело сразу поймут что это за кака с маком и что читать их "вручную" просто нереально. Посему нужен скрипт на парсинг этого счастья хотя бы по упрощенной схеме: отображение (или пересылка в файл) строк НЕ попадающих в список исключений находящихся в текстовом файле.
Т.е.:
Дано: куча логов forfiles.exe (PID = 5112) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified C:\Program Files\Common Files\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPSVC.EXE as Unrestricted using path rule, Guid = {4a2371bb-8664-43de-a137-1aa6af4e215c}
services.exe (PID = 752) identified C:\Windows\system32\sppsvc.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4924) identified C:\Windows\sep_install.cmd as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified C:\Windows\System32\svchost.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified taskhost.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 5784) identified C:\Windows\defrag_c.cmd as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
powershell.exe (PID = 5140) identified C:\Windows\SRP_LogRotation.ps1 as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\ktmw32.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\wevtapi.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\CRYPTBASE.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\CRYPTSP.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\rsaenh.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\SspiCli.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\RpcRtRemote.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\tschannel.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\XmlLite.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified C:\Windows\SYSTEM32\cmd.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\apphelp.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4592) identified \??\C:\Windows\SYSTEM32\WINBRAND.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4592) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
Это маленький кусочек логов, на самом деле у отдельных людей они достигают 25 Mb в сутки.
список исключений
C:\Windows\System32
C:\Program Files\
C:\Program Files x86\
c:\какая-нить_хитрая_софтина_которая_не_хочет_жить_в_programfiles
Ну и хочется получить на выходе файл (или вывод в консоль) с теми строками, которые не попадают под список исключений.
Начинал писать на cmd, но понял, что обрабатываться оно будет до второго пришествия, из-за того лучше обратиться к PS, в котором я, к сожалению, все еще как известное животное в известных фруктах, вот помощи и прошу.
И если случайно у кого-то найдется готовое решение для парсинга логов SRP аудита то я буду просто в восторге.
Т.е.:
Дано: куча логов forfiles.exe (PID = 5112) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified C:\Program Files\Common Files\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPSVC.EXE as Unrestricted using path rule, Guid = {4a2371bb-8664-43de-a137-1aa6af4e215c}
services.exe (PID = 752) identified C:\Windows\system32\sppsvc.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4924) identified C:\Windows\sep_install.cmd as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified C:\Windows\System32\svchost.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
services.exe (PID = 752) identified taskhost.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 5784) identified C:\Windows\defrag_c.cmd as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
powershell.exe (PID = 5140) identified C:\Windows\SRP_LogRotation.ps1 as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
svchost.exe (PID = 1064) identified taskeng.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\ktmw32.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\wevtapi.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\CRYPTBASE.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\CRYPTSP.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\rsaenh.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\SspiCli.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\RpcRtRemote.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\tschannel.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\XmlLite.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified C:\Windows\SYSTEM32\cmd.exe as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
taskeng.exe (PID = 1696) identified \??\C:\Windows\system32\apphelp.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4592) identified \??\C:\Windows\SYSTEM32\WINBRAND.dll as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
cmd.exe (PID = 4592) identified \??\C:\Windows\system32\IMM32.DLL as Unrestricted using path rule, Guid = {b12c17a2-e0db-44c7-a400-a609e7da509b}
Это маленький кусочек логов, на самом деле у отдельных людей они достигают 25 Mb в сутки.
список исключений
C:\Windows\System32
C:\Program Files\
C:\Program Files x86\
c:\какая-нить_хитрая_софтина_которая_не_хочет_жить_в_programfiles
Ну и хочется получить на выходе файл (или вывод в консоль) с теми строками, которые не попадают под список исключений.
Начинал писать на cmd, но понял, что обрабатываться оно будет до второго пришествия, из-за того лучше обратиться к PS, в котором я, к сожалению, все еще как известное животное в известных фруктах, вот помощи и прошу.
И если случайно у кого-то найдется готовое решение для парсинга логов SRP аудита то я буду просто в восторге.