Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Get used domain names from Unbound logs
- Clear
- $fic=Get-Content -Path 'E:\unbound.log'|Select-String -Pattern 'A{1,4} IN NOERROR 0.[0-9]{6} 0 [0-9]{1,3}'
- $res=@()
- ForEach($line in $fic)
- {
- If($line -match "[a-z0-9\.\-]+\.[a-z]+\.")
- {
- $tmp=$Matches[0]
- $res+=[PSCustomObject] @{domaine=$tmp.Substring(0,$tmp.Length-1)}
- }
- }
- $res=$res|Sort -Property domaine -Unique
- $res|Out-GridView
Add Comment
Please, Sign In to add comment