WordPress.com
function Get-CTXPorts{################################################################Based on Get-ClientIPFromIISLogs from 2013 Scripting Games archive#Enhancements - returns Date and Time hash# - Resolves IP to hostname#Assumes Citrix sites only hosted on IIS Server################################################################[CmdletBinding()] Param ( # Path to log file directory# [Parameter(Mandatory, ValueFromPipeline,# ValueFromPipelineByPropertyName)]# [ValidateScript({# if (-not ( Test-Path $_ -PathType Container ))# {Throw "Directory path $_ was not found." } # if ( -not (Test-path $_\*.log -PathType Leaf ))# {Throw "No log files were found at $_" } # else {$true} })] [Parameter()][Alias('FullName')] [string]$Path, # ClientIP filter #[ValidatePattern('^[0-9a-e.:]+\*$')] #[String]$Pattern = '*', # RW Rule Set[Parameter()] [String] $rule# # Count - Enables instance counters per ClientIP.# [Parameter()]# [switch] $Count, # # # AsHash - Returns ClientIPs and counts as a hash table instead of objects.# [Parameter()]# [switch] $AsHash ) End{$strrule = "XD","NS"$HTclip_raw = @{} Filter HashScript { $HTclip_raw[$_]=$true } # hash function Filter HashPorts { $HTetlIP[$_]=$true } # hash function $objarray = @() if ($strrule -contains $rule) { Get-Content $Path | foreach { $_ -replace '^(\w{4}\s)(\w\s)(\w+\s\w+)(\s\w.)', '$1 $2 $3 $4'} | HashScript$r=1$i=1$rules = $rule + 'R1'# initialise hash tabl$prevrule = ""$HTclip_raw.Keys -match "^$rule" | foreach {$HTetlIP = @{}$HTClientIP = @{} #(\d+:\d+:\d+)||(\d+:\d+:\d+) (\d+:\d+:\d+)|((\d{1,3}\.){3}\d{1,3})$rules = [string] $_.substring(0,4) #Write-Host "String Rule " $rules#Write-Host "Rules " $rules#if ( $rules -ne $prevrule) {#Write-Host "Prev " $prevrule$rules = $rule + 'R' + $r++#Write-Host "if val" $rules$CustomObject = New-Object psobject$HTclip_raw.Keys -match "$rules(\s+)" |foreach {# $HTetlIP.Add($_.keys,$_.value) if( $_ -match '^\w+\sT' ){ $strtopic = [string] $_.substring(7)# Write-Host $strtopic# Write-Host $_$data =[regex]::split($strtopic,';')#Write-Host $data[0].Trim()#Write-Host $data[1].Trim() if ($CustomObject.From -ne $true) {$CustomObject | Add-Member -Force Noteproperty -Name "From" -Value $data[0].Trim()}if ($CustomObject.To -ne $true) {$CustomObject | Add-Member -Force Noteproperty -Name "To" -Value $data[1].Trim()}}if( $_ -match '^\w+\sP\w+' ){if ( $r -lt 10) {$strport = [string] $_.substring(6) }elseif ( $r -gt 10 ) {$strport = [string] $_.substring(7)}#Write-Host $strport.Trim()$nPort = "Port" + $i++ $CustomObject | Add-Member Noteproperty -Name $nPort -Value $strport.Trim()} if( $_ -match '^\w+\sC\w+' ) {if ( $r -lt 10) {$strcomment = [string] $_.substring(6) }elseif ( $r -gt 10 ) {$strcomment = [string] $_.substring(7) }#Write-Host $strcomment.Trim()$CustomObject | Add-Member -force Noteproperty -Name "Comment" -Value $strcomment.Trim()}#foreach { # $HTetlIP.Add($,$strcname.HostName) # }#$_ | Out-GridView## }## } #eachloop #} #if#$title = " From -> To PortsComments"#$title#unique$objarray += $CustomObject# $objarray | Format-Table From,To,Port*,Comment -wrap $prevrule = $rules$i=1# $CustomObject | select-object From,To,Port*,Comment | Export-Csv c:\scripts\psobject.csv -NoTypeInformation}#$CustomObject | select-object From,To,Port*,Comment | Export-Csv c:\scripts\psobject.csv -NoTypeInformation$paramcsv = "c:\scripts\FirewallRules-"+ $rule +".csv" $objarray | select-object -Unique From,To,Port*,Comment | Export-Csv $paramcsv -NoTypeInformation}else { Write-Host "Enter Rule Set as NS,IN" } }}$pathcl=$args[0]$rulecl=$args[1]Get-CTXPorts $pathcl $rulecl ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post