bloginfo

Get used domain names from Unbound logs

Dec 18th, 2019
135
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Get used domain names from Unbound logs
  2. Clear
  3. $fic=Get-Content -Path 'E:\unbound.log'|Select-String -Pattern 'A{1,4} IN NOERROR 0.[0-9]{6} 0 [0-9]{1,3}'
  4. $res=@()
  5. ForEach($line in $fic)
  6. {
  7.   If($line -match "[a-z0-9\.\-]+\.[a-z]+\.")
  8.   {
  9.     $tmp=$Matches[0]
  10.     $res+=[PSCustomObject] @{domaine=$tmp.Substring(0,$tmp.Length-1)}
  11.   }
  12. }
  13. $res=$res|Sort -Property domaine -Unique
  14. $res|Out-GridView
RAW Paste Data