Log Desensitiser
I created the below PowerShell script to sanitise log files by removing known hostnames and IPv4 addresses.$nl = [Environment]::NewLine Write-Host "Welcome to the Log Desensitiser Tool - Author Nick Beare $nl This tool can read a txt or csv file and replace all instances of IP V4 addresses with 'IP_ADDRESS', and all Corporate hostnames using the PV, CT and CBR naming conventions with 'HOSTNAME'." $nl $log = Read-Host "Please enter the full path of the log you would like desensitised eg c:\logs\log.txt" (Get-Content $log) | Foreach-Object { $_ -replace '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', "IP_ADDRESS" -replace 'PV\D\D\D.\d\d', "HOSTNAME" -replace 'CT\d\d.', "HOSTNAME" -replace 'CBR\D\D..', "HOSTNAME" } | Set-Content $log $nl Write-Host "$log has been desensitised, goodbye."
Back